diff options
| author | Michael Albinus | 2023-10-29 15:28:11 +0100 |
|---|---|---|
| committer | Michael Albinus | 2023-10-29 15:28:11 +0100 |
| commit | 4a579e047124fe1dbf24ee712f4debb47e357b8b (patch) | |
| tree | bae2ac947bd61341fde838e479428f4e01eb368a | |
| parent | 3d25a9fccfa620aebc93947a1738a4553b1b8592 (diff) | |
| parent | 3bc092270027660a4edbbb8c5a4e5a37f114076c (diff) | |
| download | emacs-4a579e047124fe1dbf24ee712f4debb47e357b8b.tar.gz emacs-4a579e047124fe1dbf24ee712f4debb47e357b8b.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
| -rw-r--r-- | doc/emacs/misc.texi | 12 | ||||
| -rw-r--r-- | doc/lispref/frames.texi | 37 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 11 | ||||
| -rw-r--r-- | etc/NEWS | 19 | ||||
| -rw-r--r-- | etc/emacsclient-mail.desktop | 7 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsNative.java | 3 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsSdk11Clipboard.java | 24 | ||||
| -rw-r--r-- | lisp/eshell/em-smart.el | 81 | ||||
| -rw-r--r-- | lisp/gnus/nnrss.el | 2 | ||||
| -rw-r--r-- | lisp/language/hanja-util.el | 18 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 11 | ||||
| -rw-r--r-- | lisp/progmodes/which-func.el | 39 | ||||
| -rw-r--r-- | lisp/server.el | 27 | ||||
| -rw-r--r-- | lisp/startup.el | 5 | ||||
| -rw-r--r-- | src/android.c | 8 | ||||
| -rw-r--r-- | src/casefiddle.c | 25 | ||||
| -rw-r--r-- | src/search.c | 11 | ||||
| -rw-r--r-- | src/xdisp.c | 10 | ||||
| -rw-r--r-- | test/lisp/progmodes/which-func-tests.el | 58 | ||||
| -rw-r--r-- | test/src/casefiddle-tests.el | 12 |
20 files changed, 296 insertions, 124 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index d7168fa1ca0..d3c5712099d 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi | |||
| @@ -2078,6 +2078,18 @@ files. When this option is given, the arguments to | |||
| 2078 | @command{emacsclient} are interpreted as a list of expressions to | 2078 | @command{emacsclient} are interpreted as a list of expressions to |
| 2079 | evaluate, @emph{not} as a list of files to visit. | 2079 | evaluate, @emph{not} as a list of files to visit. |
| 2080 | 2080 | ||
| 2081 | @vindex server-eval-args-left | ||
| 2082 | Passing complex Lisp expression via the @option{--eval} command-line | ||
| 2083 | option sometimes requires elaborate escaping of characters special to | ||
| 2084 | the shell. To avoid this, you can pass arguments to Lisp functions in | ||
| 2085 | your expression as additional separate arguments to | ||
| 2086 | @command{emacsclient}, and use @var{server-eval-args-left} in the | ||
| 2087 | expression to access those arguments. Be careful to have your | ||
| 2088 | expression remove the processed arguments from | ||
| 2089 | @var{server-eval-args-left} regardless of whether your code succeeds, | ||
| 2090 | for example by using @code{pop}, otherwise Emacs will attempt to | ||
| 2091 | evaluate those arguments as separate Lisp expressions. | ||
| 2092 | |||
| 2081 | @item -f @var{server-file} | 2093 | @item -f @var{server-file} |
| 2082 | @itemx --server-file=@var{server-file} | 2094 | @itemx --server-file=@var{server-file} |
| 2083 | Specify a server file (@pxref{TCP Emacs server}) for connecting to an | 2095 | Specify a server file (@pxref{TCP Emacs server}) for connecting to an |
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index fc36346f773..6193a4fe1cd 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi | |||
| @@ -4058,20 +4058,29 @@ under X, and @xref{Other Selections} for those elsewhere. | |||
| 4058 | 4058 | ||
| 4059 | @defopt selection-coding-system | 4059 | @defopt selection-coding-system |
| 4060 | This variable provides a coding system (@pxref{Coding Systems}) which | 4060 | This variable provides a coding system (@pxref{Coding Systems}) which |
| 4061 | is used to encode selection data, and takes effect on MS-DOS, | 4061 | is used to encode selection data, and takes effect on MS-Windows and |
| 4062 | MS-Windows and X@. | 4062 | X@. It is also used in the MS-DOS port when it runs on MS-Windows and |
| 4063 | 4063 | can access the Windows clipboard text. | |
| 4064 | Under MS-DOS and MS-Windows, it is the coding system by which all | 4064 | |
| 4065 | non-ASCII clipboard text will be encoded and decoded; if set under X, | 4065 | On X, the value of this variable provides the coding system which |
| 4066 | it provides the coding system calls to @code{gui-get-selection} will | 4066 | @code{gui-get-selection} will use to decode selection data for a |
| 4067 | decode selection data for a subset of text data types by, and also | 4067 | subset of text data types, and also forces replies to selection |
| 4068 | forces replies to selection requests for the polymorphic @code{TEXT} | 4068 | requests for the polymorphic @code{TEXT} data type to be encoded by |
| 4069 | data type to be encoded by the @code{compound-text-with-extensions} | 4069 | the @code{compound-text-with-extensions} coding system rather than |
| 4070 | coding system rather than Unicode. | 4070 | Unicode. |
| 4071 | 4071 | ||
| 4072 | Its default value is the system code page under MS-Windows 95, 98 or | 4072 | On MS-Windows, this variable is generally ignored, as the MS-Windows |
| 4073 | Me, @code{utf-16le-dos} under NT/W2K/XP, @code{iso-latin-1-dos} on | 4073 | clipboard provides the information about decoding as part of the |
| 4074 | MS-DOS, and @code{nil} elsewhere. | 4074 | clipboard data, and uses either UTF-16 or locale-specific encoding |
| 4075 | automatically as appropriate. We recommend to set the value of this | ||
| 4076 | variable only on the older Windows 9X, as it is otherwise used only in | ||
| 4077 | the very rare cases when the information provided by the clipboard | ||
| 4078 | data is unusable for some reason. | ||
| 4079 | |||
| 4080 | The default value of this variable is the system code page under | ||
| 4081 | MS-Windows 95, 98 or Me, @code{utf-16le-dos} on Windows | ||
| 4082 | NT/W2K/XP/Vista/7/8/10/11, @code{iso-latin-1-dos} on MS-DOS, and | ||
| 4083 | @code{nil} elsewhere. | ||
| 4075 | @end defopt | 4084 | @end defopt |
| 4076 | 4085 | ||
| 4077 | For backward compatibility, there are obsolete aliases | 4086 | For backward compatibility, there are obsolete aliases |
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 7d11db49def..d05b0b36475 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -1508,9 +1508,12 @@ has been capitalized. This means that the first character of each | |||
| 1508 | word is converted to upper case, and the rest are converted to lower | 1508 | word is converted to upper case, and the rest are converted to lower |
| 1509 | case. | 1509 | case. |
| 1510 | 1510 | ||
| 1511 | @vindex case-symbols-as-words | ||
| 1511 | The definition of a word is any sequence of consecutive characters that | 1512 | The definition of a word is any sequence of consecutive characters that |
| 1512 | are assigned to the word constituent syntax class in the current syntax | 1513 | are assigned to the word constituent syntax class in the current syntax |
| 1513 | table (@pxref{Syntax Class Table}). | 1514 | table (@pxref{Syntax Class Table}); if @code{case-symbols-as-words} |
| 1515 | is non-nil, characters assigned to the symbol constituent syntax | ||
| 1516 | class are also considered as word constituent. | ||
| 1514 | 1517 | ||
| 1515 | When @var{string-or-char} is a character, this function does the same | 1518 | When @var{string-or-char} is a character, this function does the same |
| 1516 | thing as @code{upcase}. | 1519 | thing as @code{upcase}. |
| @@ -1540,9 +1543,9 @@ letters other than the initials. It returns a new string whose | |||
| 1540 | contents are a copy of @var{string-or-char}, in which each word has | 1543 | contents are a copy of @var{string-or-char}, in which each word has |
| 1541 | had its initial letter converted to upper case. | 1544 | had its initial letter converted to upper case. |
| 1542 | 1545 | ||
| 1543 | The definition of a word is any sequence of consecutive characters that | 1546 | The definition of a word for this function is the same as described |
| 1544 | are assigned to the word constituent syntax class in the current syntax | 1547 | for @code{capitalize} above, and @code{case-symbols-as-words} has the |
| 1545 | table (@pxref{Syntax Class Table}). | 1548 | same effect on word constituent characters. |
| 1546 | 1549 | ||
| 1547 | When the argument to @code{upcase-initials} is a character, | 1550 | When the argument to @code{upcase-initials} is a character, |
| 1548 | @code{upcase-initials} has the same result as @code{upcase}. | 1551 | @code{upcase-initials} has the same result as @code{upcase}. |
| @@ -233,6 +233,17 @@ to enter the file you want to modify. | |||
| 233 | It can be used to customize the look of the appointment notification | 233 | It can be used to customize the look of the appointment notification |
| 234 | displayed on the mode line when 'appt-display-mode-line' is non-nil. | 234 | displayed on the mode line when 'appt-display-mode-line' is non-nil. |
| 235 | 235 | ||
| 236 | ** Emacs Server and Client | ||
| 237 | |||
| 238 | --- | ||
| 239 | *** 'server-eval-args-left' can be used to pop and eval subsequent args. | ||
| 240 | When '--eval' is passed to emacsclient and Emacs is evaluating each | ||
| 241 | argument, this variable is set to those arguments not yet evaluated. | ||
| 242 | It can be used to 'pop' arguments and process them by the function | ||
| 243 | called in the '--eval' expression, which is useful when those | ||
| 244 | arguments contain arbitrary characters that otherwise might require | ||
| 245 | elaborate and error-prone escaping (to protect them from the shell). | ||
| 246 | |||
| 236 | 247 | ||
| 237 | * Editing Changes in Emacs 30.1 | 248 | * Editing Changes in Emacs 30.1 |
| 238 | 249 | ||
| @@ -1194,6 +1205,14 @@ instead of "ctags", "ebrowse", "etags", "hexl", "emacsclient", and | |||
| 1194 | subprocess. | 1205 | subprocess. |
| 1195 | 1206 | ||
| 1196 | +++ | 1207 | +++ |
| 1208 | ** New variable 'case-symbols-as-words' affects case operations for symbols. | ||
| 1209 | If non-nil, then case operations such as 'upcase-initials' or | ||
| 1210 | 'replace-match' (with nil FIXEDCASE) will treat the entire symbol name | ||
| 1211 | as a single word. This is useful for programming languages and styles | ||
| 1212 | where only the first letter of a symbol's name is ever capitalized. | ||
| 1213 | The default value of this variable is nil. | ||
| 1214 | |||
| 1215 | +++ | ||
| 1197 | ** 'x-popup-menu' now understands touch screen events. | 1216 | ** 'x-popup-menu' now understands touch screen events. |
| 1198 | When a 'touchscreen-begin' or 'touchscreen-end' event is passed as the | 1217 | When a 'touchscreen-begin' or 'touchscreen-end' event is passed as the |
| 1199 | POSITION argument, it will behave as if that event was a mouse event. | 1218 | POSITION argument, it will behave as if that event was a mouse event. |
diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..4f7f00ebefd 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop | |||
| @@ -1,10 +1,7 @@ | |||
| 1 | [Desktop Entry] | 1 | [Desktop Entry] |
| 2 | Categories=Network;Email; | 2 | Categories=Network;Email; |
| 3 | Comment=GNU Emacs is an extensible, customizable text editor - and more | 3 | Comment=GNU Emacs is an extensible, customizable text editor - and more |
| 4 | # We want to pass the following commands to the shell wrapper: | 4 | Exec=emacsclient --alternate-editor= --eval "(message-mailto (pop server-eval-args-left))" %u |
| 5 | # u=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" | ||
| 6 | # Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. | ||
| 7 | Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u | ||
| 8 | Icon=emacs | 5 | Icon=emacs |
| 9 | Name=Emacs (Mail, Client) | 6 | Name=Emacs (Mail, Client) |
| 10 | MimeType=x-scheme-handler/mailto; | 7 | MimeType=x-scheme-handler/mailto; |
| @@ -16,7 +13,7 @@ Actions=new-window;new-instance; | |||
| 16 | 13 | ||
| 17 | [Desktop Action new-window] | 14 | [Desktop Action new-window] |
| 18 | Name=New Window | 15 | Name=New Window |
| 19 | Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u | 16 | Exec=emacsclient --alternate-editor= --create-frame --eval "(message-mailto (pop server-eval-args-left))" %u |
| 20 | 17 | ||
| 21 | [Desktop Action new-instance] | 18 | [Desktop Action new-instance] |
| 22 | Name=New Instance | 19 | Name=New Instance |
diff --git a/java/org/gnu/emacs/EmacsNative.java b/java/org/gnu/emacs/EmacsNative.java index 7d7e1e5d831..f15927bb3a7 100644 --- a/java/org/gnu/emacs/EmacsNative.java +++ b/java/org/gnu/emacs/EmacsNative.java | |||
| @@ -39,6 +39,9 @@ public final class EmacsNative | |||
| 39 | /* Like `dup' in C. */ | 39 | /* Like `dup' in C. */ |
| 40 | public static native int dup (int fd); | 40 | public static native int dup (int fd); |
| 41 | 41 | ||
| 42 | /* Like `close' in C. */ | ||
| 43 | public static native int close (int fd); | ||
| 44 | |||
| 42 | /* Obtain the fingerprint of this build of Emacs. The fingerprint | 45 | /* Obtain the fingerprint of this build of Emacs. The fingerprint |
| 43 | can be used to determine the dump file name. */ | 46 | can be used to determine the dump file name. */ |
| 44 | public static native String getFingerprint (); | 47 | public static native String getFingerprint (); |
diff --git a/java/org/gnu/emacs/EmacsSdk11Clipboard.java b/java/org/gnu/emacs/EmacsSdk11Clipboard.java index b8a43496b6d..b068a89831e 100644 --- a/java/org/gnu/emacs/EmacsSdk11Clipboard.java +++ b/java/org/gnu/emacs/EmacsSdk11Clipboard.java | |||
| @@ -245,6 +245,8 @@ public final class EmacsSdk11Clipboard extends EmacsClipboard | |||
| 245 | if (data == null || data.getItemCount () < 1) | 245 | if (data == null || data.getItemCount () < 1) |
| 246 | return null; | 246 | return null; |
| 247 | 247 | ||
| 248 | fd = -1; | ||
| 249 | |||
| 248 | try | 250 | try |
| 249 | { | 251 | { |
| 250 | uri = data.getItemAt (0).getUri (); | 252 | uri = data.getItemAt (0).getUri (); |
| @@ -267,12 +269,34 @@ public final class EmacsSdk11Clipboard extends EmacsClipboard | |||
| 267 | /* Close the original offset. */ | 269 | /* Close the original offset. */ |
| 268 | assetFd.close (); | 270 | assetFd.close (); |
| 269 | } | 271 | } |
| 272 | catch (SecurityException e) | ||
| 273 | { | ||
| 274 | /* Guarantee a file descriptor duplicated or detached is | ||
| 275 | ultimately closed if an error arises. */ | ||
| 276 | |||
| 277 | if (fd != -1) | ||
| 278 | EmacsNative.close (fd); | ||
| 279 | |||
| 280 | return null; | ||
| 281 | } | ||
| 270 | catch (FileNotFoundException e) | 282 | catch (FileNotFoundException e) |
| 271 | { | 283 | { |
| 284 | /* Guarantee a file descriptor duplicated or detached is | ||
| 285 | ultimately closed if an error arises. */ | ||
| 286 | |||
| 287 | if (fd != -1) | ||
| 288 | EmacsNative.close (fd); | ||
| 289 | |||
| 272 | return null; | 290 | return null; |
| 273 | } | 291 | } |
| 274 | catch (IOException e) | 292 | catch (IOException e) |
| 275 | { | 293 | { |
| 294 | /* Guarantee a file descriptor duplicated or detached is | ||
| 295 | ultimately closed if an error arises. */ | ||
| 296 | |||
| 297 | if (fd != -1) | ||
| 298 | EmacsNative.close (fd); | ||
| 299 | |||
| 276 | return null; | 300 | return null; |
| 277 | } | 301 | } |
| 278 | 302 | ||
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index 4c39a991ec6..fc283547519 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el | |||
| @@ -95,7 +95,7 @@ it to get a real sense of how it works." | |||
| 95 | (list | 95 | (list |
| 96 | (lambda () | 96 | (lambda () |
| 97 | (remove-hook 'window-configuration-change-hook | 97 | (remove-hook 'window-configuration-change-hook |
| 98 | 'eshell-refresh-windows))) | 98 | 'eshell-smart-scroll))) |
| 99 | "A hook that gets run when `eshell-smart' is unloaded." | 99 | "A hook that gets run when `eshell-smart' is unloaded." |
| 100 | :type 'hook | 100 | :type 'hook |
| 101 | :group 'eshell-smart) | 101 | :group 'eshell-smart) |
| @@ -159,9 +159,7 @@ The options are `begin', `after' or `end'." | |||
| 159 | 159 | ||
| 160 | ;;; Internal Variables: | 160 | ;;; Internal Variables: |
| 161 | 161 | ||
| 162 | (defvar eshell-smart-displayed nil) | ||
| 163 | (defvar eshell-smart-command-done nil) | 162 | (defvar eshell-smart-command-done nil) |
| 164 | (defvar eshell-currently-handling-window nil) | ||
| 165 | 163 | ||
| 166 | ;;; Functions: | 164 | ;;; Functions: |
| 167 | 165 | ||
| @@ -174,10 +172,9 @@ The options are `begin', `after' or `end'." | |||
| 174 | (setq-local eshell-scroll-to-bottom-on-input nil) | 172 | (setq-local eshell-scroll-to-bottom-on-input nil) |
| 175 | (setq-local eshell-scroll-show-maximum-output t) | 173 | (setq-local eshell-scroll-show-maximum-output t) |
| 176 | 174 | ||
| 177 | (add-hook 'window-scroll-functions 'eshell-smart-scroll-window nil t) | 175 | (add-hook 'window-configuration-change-hook 'eshell-smart-scroll nil t) |
| 178 | (add-hook 'window-configuration-change-hook 'eshell-refresh-windows) | ||
| 179 | 176 | ||
| 180 | (add-hook 'eshell-output-filter-functions 'eshell-refresh-windows t t) | 177 | (add-hook 'eshell-output-filter-functions 'eshell-smart-scroll-windows 90 t) |
| 181 | 178 | ||
| 182 | (add-hook 'after-change-functions 'eshell-disable-after-change nil t) | 179 | (add-hook 'after-change-functions 'eshell-disable-after-change nil t) |
| 183 | 180 | ||
| @@ -193,28 +190,15 @@ The options are `begin', `after' or `end'." | |||
| 193 | (add-hook 'eshell-post-command-hook | 190 | (add-hook 'eshell-post-command-hook |
| 194 | 'eshell-smart-maybe-jump-to-end nil t)))) | 191 | 'eshell-smart-maybe-jump-to-end nil t)))) |
| 195 | 192 | ||
| 196 | ;; This is called by window-scroll-functions with two arguments. | 193 | (defun eshell-smart-scroll-windows () |
| 197 | (defun eshell-smart-scroll-window (wind _start) | 194 | "Scroll all eshell windows to display as much output as possible, smartly." |
| 198 | "Scroll the given Eshell window WIND accordingly." | 195 | (walk-windows |
| 199 | (unless eshell-currently-handling-window | 196 | (lambda (wind) |
| 200 | (let ((eshell-currently-handling-window t)) | 197 | (with-current-buffer (window-buffer wind) |
| 201 | (with-selected-window wind | 198 | (if eshell-mode |
| 202 | (eshell-smart-redisplay))))) | 199 | (with-selected-window wind |
| 203 | 200 | (eshell-smart-scroll))))) | |
| 204 | (defun eshell-refresh-windows (&optional frame) | 201 | 0 t)) |
| 205 | "Refresh all visible Eshell buffers." | ||
| 206 | (let (affected) | ||
| 207 | (walk-windows | ||
| 208 | (lambda (wind) | ||
| 209 | (with-current-buffer (window-buffer wind) | ||
| 210 | (if eshell-mode | ||
| 211 | (let (window-scroll-functions) ;;FIXME: Why? | ||
| 212 | (eshell-smart-scroll-window wind (window-start)) | ||
| 213 | (setq affected t))))) | ||
| 214 | 0 frame) | ||
| 215 | (if affected | ||
| 216 | (let (window-scroll-functions) ;;FIXME: Why? | ||
| 217 | (redisplay))))) | ||
| 218 | 202 | ||
| 219 | (defun eshell-smart-display-setup () | 203 | (defun eshell-smart-display-setup () |
| 220 | "Set the point to somewhere in the beginning of the last command." | 204 | "Set the point to somewhere in the beginning of the last command." |
| @@ -231,8 +215,7 @@ The options are `begin', `after' or `end'." | |||
| 231 | (t | 215 | (t |
| 232 | (error "Invalid value for `eshell-where-to-jump'"))) | 216 | (error "Invalid value for `eshell-where-to-jump'"))) |
| 233 | (setq eshell-smart-command-done nil) | 217 | (setq eshell-smart-command-done nil) |
| 234 | (add-hook 'pre-command-hook 'eshell-smart-display-move nil t) | 218 | (add-hook 'pre-command-hook 'eshell-smart-display-move nil t)) |
| 235 | (eshell-refresh-windows)) | ||
| 236 | 219 | ||
| 237 | ;; Called from after-change-functions with 3 arguments. | 220 | ;; Called from after-change-functions with 3 arguments. |
| 238 | (defun eshell-disable-after-change (_b _e _l) | 221 | (defun eshell-disable-after-change (_b _e _l) |
| @@ -254,28 +237,22 @@ and the end of the buffer are still visible." | |||
| 254 | (goto-char (point-max)) | 237 | (goto-char (point-max)) |
| 255 | (remove-hook 'pre-command-hook 'eshell-smart-display-move t))) | 238 | (remove-hook 'pre-command-hook 'eshell-smart-display-move t))) |
| 256 | 239 | ||
| 257 | (defun eshell-smart-redisplay () | 240 | (defun eshell-smart-scroll () |
| 258 | "Display as much output as possible, smartly." | 241 | "Scroll WINDOW to display as much output as possible, smartly." |
| 259 | (if (eobp) | 242 | (let ((top-point (point))) |
| 243 | (and (memq 'eshell-smart-display-move pre-command-hook) | ||
| 244 | (>= (point) eshell-last-input-start) | ||
| 245 | (< (point) eshell-last-input-end) | ||
| 246 | (set-window-start (selected-window) | ||
| 247 | (pos-bol) t)) | ||
| 248 | (when (pos-visible-in-window-p (point-max) (selected-window)) | ||
| 260 | (save-excursion | 249 | (save-excursion |
| 261 | (recenter -1) | 250 | (goto-char (point-max)) |
| 262 | ;; trigger the redisplay now, so that we catch any attempted | 251 | (recenter -1) |
| 263 | ;; point motion; this is to cover for a redisplay bug | 252 | (unless (pos-visible-in-window-p top-point (selected-window)) |
| 264 | (redisplay)) | 253 | (goto-char top-point) |
| 265 | (let ((top-point (point))) | 254 | (set-window-start (selected-window) |
| 266 | (and (memq 'eshell-smart-display-move pre-command-hook) | 255 | (pos-bol) t)))))) |
| 267 | (>= (point) eshell-last-input-start) | ||
| 268 | (< (point) eshell-last-input-end) | ||
| 269 | (set-window-start (selected-window) | ||
| 270 | (line-beginning-position) t)) | ||
| 271 | (if (pos-visible-in-window-p (point-max)) | ||
| 272 | (save-excursion | ||
| 273 | (goto-char (point-max)) | ||
| 274 | (recenter -1) | ||
| 275 | (unless (pos-visible-in-window-p top-point) | ||
| 276 | (goto-char top-point) | ||
| 277 | (set-window-start (selected-window) | ||
| 278 | (line-beginning-position) t))))))) | ||
| 279 | 256 | ||
| 280 | (defun eshell-smart-goto-end () | 257 | (defun eshell-smart-goto-end () |
| 281 | "Like `end-of-buffer', but do not push a mark." | 258 | "Like `end-of-buffer', but do not push a mark." |
| @@ -323,7 +300,7 @@ and the end of the buffer are still visible." | |||
| 323 | (remove-hook 'pre-command-hook 'eshell-smart-display-move t)))) | 300 | (remove-hook 'pre-command-hook 'eshell-smart-display-move t)))) |
| 324 | 301 | ||
| 325 | (defun em-smart-unload-hook () | 302 | (defun em-smart-unload-hook () |
| 326 | (remove-hook 'window-configuration-change-hook #'eshell-refresh-windows)) | 303 | (remove-hook 'window-configuration-change-hook #'eshell-smart-scroll)) |
| 327 | 304 | ||
| 328 | (provide 'em-smart) | 305 | (provide 'em-smart) |
| 329 | 306 | ||
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el index c5f2cb672d7..06a0bc7e799 100644 --- a/lisp/gnus/nnrss.el +++ b/lisp/gnus/nnrss.el | |||
| @@ -629,7 +629,7 @@ which RSS 2.0 allows." | |||
| 629 | (assoc 'href | 629 | (assoc 'href |
| 630 | (nnrss-discover-feed | 630 | (nnrss-discover-feed |
| 631 | (read-string | 631 | (read-string |
| 632 | (format "URL to search for %s: " group) "http://"))))) | 632 | (format "URL to search for %s: " group) "https://"))))) |
| 633 | (let ((pair (assoc-string group nnrss-server-data))) | 633 | (let ((pair (assoc-string group nnrss-server-data))) |
| 634 | (if pair | 634 | (if pair |
| 635 | (setcdr (cdr pair) (list url)) | 635 | (setcdr (cdr pair) (list url)) |
diff --git a/lisp/language/hanja-util.el b/lisp/language/hanja-util.el index be0364b1c23..b5ef9230d27 100644 --- a/lisp/language/hanja-util.el +++ b/lisp/language/hanja-util.el | |||
| @@ -6479,11 +6479,7 @@ character. This variable is initialized by `hanja-init-load'.") | |||
| 6479 | map) | 6479 | map) |
| 6480 | "Keymap for Hanja (Korean Hanja Converter).") | 6480 | "Keymap for Hanja (Korean Hanja Converter).") |
| 6481 | 6481 | ||
| 6482 | (defun hanja-filter (condp lst) | 6482 | (define-obsolete-function-alias 'hanja-filter #'seq-filter "30.1") |
| 6483 | "Construct a list from the elements of LST for which CONDP returns true." | ||
| 6484 | (delq | ||
| 6485 | nil | ||
| 6486 | (mapcar (lambda (x) (and (funcall condp x) x)) lst))) | ||
| 6487 | 6483 | ||
| 6488 | (defun hanja-list-prev-group () | 6484 | (defun hanja-list-prev-group () |
| 6489 | "Select the previous group of hangul->hanja conversions." | 6485 | "Select the previous group of hangul->hanja conversions." |
| @@ -6570,12 +6566,12 @@ The value is a hanja character that is selected interactively." | |||
| 6570 | 0 0 | 6566 | 0 0 |
| 6571 | ;; Filter characters that can not be decoded. | 6567 | ;; Filter characters that can not be decoded. |
| 6572 | ;; Maybe it can not represent characters in current terminal coding. | 6568 | ;; Maybe it can not represent characters in current terminal coding. |
| 6573 | (hanja-filter (lambda (x) (car x)) | 6569 | (seq-filter #'car |
| 6574 | (mapcar (lambda (c) | 6570 | (mapcar (lambda (c) |
| 6575 | (if (listp c) | 6571 | (if (listp c) |
| 6576 | (cons (car c) (cdr c)) | 6572 | (cons (car c) (cdr c)) |
| 6577 | (list c))) | 6573 | (list c))) |
| 6578 | (aref hanja-table char))))) | 6574 | (aref hanja-table char))))) |
| 6579 | (unwind-protect | 6575 | (unwind-protect |
| 6580 | (when (aref hanja-conversions 2) | 6576 | (when (aref hanja-conversions 2) |
| 6581 | (catch 'exit-input-loop | 6577 | (catch 'exit-input-loop |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 7cc7adc45c7..ecfeb9f8f84 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -2974,20 +2974,13 @@ keywords when no KEYWORD is given." | |||
| 2974 | browse-url-button-regexp) | 2974 | browse-url-button-regexp) |
| 2975 | "Regexp matching URLs. Set to nil to disable URL features in rcirc.") | 2975 | "Regexp matching URLs. Set to nil to disable URL features in rcirc.") |
| 2976 | 2976 | ||
| 2977 | ;; cf cl-remove-if-not | ||
| 2978 | (defun rcirc-condition-filter (condp lst) | ||
| 2979 | "Remove all items not satisfying condition CONDP in list LST. | ||
| 2980 | CONDP is a function that takes a list element as argument and returns | ||
| 2981 | non-nil if that element should be included. Returns a new list." | ||
| 2982 | (delq nil (mapcar (lambda (x) (and (funcall condp x) x)) lst))) | ||
| 2983 | |||
| 2984 | (defun rcirc-browse-url (&optional arg) | 2977 | (defun rcirc-browse-url (&optional arg) |
| 2985 | "Prompt for URL to browse based on URLs in buffer before point. | 2978 | "Prompt for URL to browse based on URLs in buffer before point. |
| 2986 | 2979 | ||
| 2987 | If ARG is given, opens the URL in a new browser window." | 2980 | If ARG is given, opens the URL in a new browser window." |
| 2988 | (interactive "P") | 2981 | (interactive "P") |
| 2989 | (let* ((point (point)) | 2982 | (let* ((point (point)) |
| 2990 | (filtered (rcirc-condition-filter | 2983 | (filtered (seq-filter |
| 2991 | (lambda (x) (>= point (cdr x))) | 2984 | (lambda (x) (>= point (cdr x))) |
| 2992 | rcirc-urls)) | 2985 | rcirc-urls)) |
| 2993 | (completions (mapcar (lambda (x) (car x)) filtered)) | 2986 | (completions (mapcar (lambda (x) (car x)) filtered)) |
| @@ -4008,6 +4001,8 @@ PROCESS is the process object for the current connection." | |||
| 4008 | (define-obsolete-function-alias 'rcirc-format-strike-trough | 4001 | (define-obsolete-function-alias 'rcirc-format-strike-trough |
| 4009 | 'rcirc-format-strike-through "30.1") | 4002 | 'rcirc-format-strike-through "30.1") |
| 4010 | 4003 | ||
| 4004 | (define-obsolete-function-alias 'rcirc-condition-filter #'seq-filter "30.1") | ||
| 4005 | |||
| 4011 | (provide 'rcirc) | 4006 | (provide 'rcirc) |
| 4012 | 4007 | ||
| 4013 | ;;; rcirc.el ends here | 4008 | ;;; rcirc.el ends here |
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 09d0250515f..0e04bab6ea4 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el | |||
| @@ -208,21 +208,28 @@ non-nil.") | |||
| 208 | (add-hook 'after-change-major-mode-hook #'which-func-ff-hook t) | 208 | (add-hook 'after-change-major-mode-hook #'which-func-ff-hook t) |
| 209 | 209 | ||
| 210 | (defun which-func-try-to-enable () | 210 | (defun which-func-try-to-enable () |
| 211 | (unless (or (not which-function-mode) | 211 | (when which-function-mode |
| 212 | (local-variable-p 'which-func-mode)) | 212 | (unless (local-variable-p 'which-func-mode) |
| 213 | (setq which-func-mode (or (eq which-func-modes t) | 213 | (setq which-func-mode (or (eq which-func-modes t) |
| 214 | (member major-mode which-func-modes))) | 214 | (member major-mode which-func-modes))) |
| 215 | (setq which-func--use-mode-line | 215 | (setq which-func--use-mode-line |
| 216 | (member which-func-display '(mode mode-and-header))) | 216 | (member which-func-display '(mode mode-and-header))) |
| 217 | (setq which-func--use-header-line | 217 | (setq which-func--use-header-line |
| 218 | (member which-func-display '(header mode-and-header))) | 218 | (member which-func-display '(header mode-and-header)))) |
| 219 | (when (and which-func-mode which-func--use-header-line) | 219 | ;; We might need to re-add which-func-format to the header line, |
| 220 | ;; if which-function-mode was toggled off and on. | ||
| 221 | (when (and which-func-mode which-func--use-header-line | ||
| 222 | (listp header-line-format)) | ||
| 220 | (add-to-list 'header-line-format '("" which-func-format " "))))) | 223 | (add-to-list 'header-line-format '("" which-func-format " "))))) |
| 221 | 224 | ||
| 222 | (defun which-func--disable () | 225 | (defun which-func--header-line-remove () |
| 223 | (when (and which-func-mode which-func--use-header-line) | 226 | (when (and which-func-mode which-func--use-header-line |
| 227 | (listp header-line-format)) | ||
| 224 | (setq header-line-format | 228 | (setq header-line-format |
| 225 | (delete '("" which-func-format " ") header-line-format))) | 229 | (delete '("" which-func-format " ") header-line-format)))) |
| 230 | |||
| 231 | (defun which-func--disable () | ||
| 232 | (which-func--header-line-remove) | ||
| 226 | (setq which-func-mode nil)) | 233 | (setq which-func-mode nil)) |
| 227 | 234 | ||
| 228 | (defun which-func-ff-hook () | 235 | (defun which-func-ff-hook () |
| @@ -288,9 +295,11 @@ in certain major modes." | |||
| 288 | (when which-function-mode | 295 | (when which-function-mode |
| 289 | ;;Turn it on. | 296 | ;;Turn it on. |
| 290 | (setq which-func-update-timer | 297 | (setq which-func-update-timer |
| 291 | (run-with-idle-timer idle-update-delay t #'which-func-update)) | 298 | (run-with-idle-timer idle-update-delay t #'which-func-update))) |
| 292 | (dolist (buf (buffer-list)) | 299 | (dolist (buf (buffer-list)) |
| 293 | (with-current-buffer buf (which-func-try-to-enable))))) | 300 | (with-current-buffer buf |
| 301 | (which-func--header-line-remove) | ||
| 302 | (which-func-ff-hook)))) | ||
| 294 | 303 | ||
| 295 | (defvar which-function-imenu-failed nil | 304 | (defvar which-function-imenu-failed nil |
| 296 | "Locally t in a buffer if `imenu--make-index-alist' found nothing there.") | 305 | "Locally t in a buffer if `imenu--make-index-alist' found nothing there.") |
diff --git a/lisp/server.el b/lisp/server.el index ce68e9aebc9..a2671165bfc 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -1199,6 +1199,7 @@ The following commands are accepted by the client: | |||
| 1199 | parent-id ; Window ID for XEmbed | 1199 | parent-id ; Window ID for XEmbed |
| 1200 | dontkill ; t if client should not be killed. | 1200 | dontkill ; t if client should not be killed. |
| 1201 | commands | 1201 | commands |
| 1202 | evalexprs | ||
| 1202 | dir | 1203 | dir |
| 1203 | use-current-frame | 1204 | use-current-frame |
| 1204 | frame-parameters ;parameters for newly created frame | 1205 | frame-parameters ;parameters for newly created frame |
| @@ -1332,8 +1333,7 @@ The following commands are accepted by the client: | |||
| 1332 | (let ((expr (pop args-left))) | 1333 | (let ((expr (pop args-left))) |
| 1333 | (if coding-system | 1334 | (if coding-system |
| 1334 | (setq expr (decode-coding-string expr coding-system))) | 1335 | (setq expr (decode-coding-string expr coding-system))) |
| 1335 | (push (lambda () (server-eval-and-print expr proc)) | 1336 | (push expr evalexprs) |
| 1336 | commands) | ||
| 1337 | (setq filepos nil))) | 1337 | (setq filepos nil))) |
| 1338 | 1338 | ||
| 1339 | ;; -env NAME=VALUE: An environment variable. | 1339 | ;; -env NAME=VALUE: An environment variable. |
| @@ -1358,7 +1358,7 @@ The following commands are accepted by the client: | |||
| 1358 | ;; arguments, use an existing frame. | 1358 | ;; arguments, use an existing frame. |
| 1359 | (and nowait | 1359 | (and nowait |
| 1360 | (not (eq tty-name 'window-system)) | 1360 | (not (eq tty-name 'window-system)) |
| 1361 | (or files commands) | 1361 | (or files commands evalexprs) |
| 1362 | (setq use-current-frame t)) | 1362 | (setq use-current-frame t)) |
| 1363 | 1363 | ||
| 1364 | (setq frame | 1364 | (setq frame |
| @@ -1407,7 +1407,7 @@ The following commands are accepted by the client: | |||
| 1407 | (let ((default-directory | 1407 | (let ((default-directory |
| 1408 | (if (and dir (file-directory-p dir)) | 1408 | (if (and dir (file-directory-p dir)) |
| 1409 | dir default-directory))) | 1409 | dir default-directory))) |
| 1410 | (server-execute proc files nowait commands | 1410 | (server-execute proc files nowait commands evalexprs |
| 1411 | dontkill frame tty-name))))) | 1411 | dontkill frame tty-name))))) |
| 1412 | 1412 | ||
| 1413 | (when (or frame files) | 1413 | (when (or frame files) |
| @@ -1417,22 +1417,35 @@ The following commands are accepted by the client: | |||
| 1417 | ;; condition-case | 1417 | ;; condition-case |
| 1418 | (t (server-return-error proc err)))) | 1418 | (t (server-return-error proc err)))) |
| 1419 | 1419 | ||
| 1420 | (defun server-execute (proc files nowait commands dontkill frame tty-name) | 1420 | (defvar server-eval-args-left nil |
| 1421 | "List of eval args not yet processed. | ||
| 1422 | |||
| 1423 | Adding or removing strings from this variable while the Emacs | ||
| 1424 | server is processing a series of eval requests will affect what | ||
| 1425 | Emacs evaluates. | ||
| 1426 | |||
| 1427 | See also `argv' for a similar variable which works for | ||
| 1428 | invocations of \"emacs\".") | ||
| 1429 | |||
| 1430 | (defun server-execute (proc files nowait commands evalexprs dontkill frame tty-name) | ||
| 1421 | ;; This is run from timers and process-filters, i.e. "asynchronously". | 1431 | ;; This is run from timers and process-filters, i.e. "asynchronously". |
| 1422 | ;; But w.r.t the user, this is not really asynchronous since the timer | 1432 | ;; But w.r.t the user, this is not really asynchronous since the timer |
| 1423 | ;; is run after 0s and the process-filter is run in response to the | 1433 | ;; is run after 0s and the process-filter is run in response to the |
| 1424 | ;; user running `emacsclient'. So it is OK to override the | 1434 | ;; user running `emacsclient'. So it is OK to override the |
| 1425 | ;; inhibit-quit flag, which is good since `commands' (as well as | 1435 | ;; inhibit-quit flag, which is good since `evalexprs' (as well as |
| 1426 | ;; find-file-noselect via the major-mode) can run arbitrary code, | 1436 | ;; find-file-noselect via the major-mode) can run arbitrary code, |
| 1427 | ;; including code that needs to wait. | 1437 | ;; including code that needs to wait. |
| 1428 | (with-local-quit | 1438 | (with-local-quit |
| 1429 | (condition-case err | 1439 | (condition-case err |
| 1430 | (let ((buffers (server-visit-files files proc nowait))) | 1440 | (let ((buffers (server-visit-files files proc nowait))) |
| 1431 | (mapc 'funcall (nreverse commands)) | 1441 | (mapc 'funcall (nreverse commands)) |
| 1442 | (let ((server-eval-args-left (nreverse evalexprs))) | ||
| 1443 | (while server-eval-args-left | ||
| 1444 | (server-eval-and-print (pop server-eval-args-left) proc))) | ||
| 1432 | ;; If we were told only to open a new client, obey | 1445 | ;; If we were told only to open a new client, obey |
| 1433 | ;; `initial-buffer-choice' if it specifies a file | 1446 | ;; `initial-buffer-choice' if it specifies a file |
| 1434 | ;; or a function. | 1447 | ;; or a function. |
| 1435 | (unless (or files commands) | 1448 | (unless (or files commands evalexprs) |
| 1436 | (let ((buf | 1449 | (let ((buf |
| 1437 | (cond ((stringp initial-buffer-choice) | 1450 | (cond ((stringp initial-buffer-choice) |
| 1438 | (find-file-noselect initial-buffer-choice)) | 1451 | (find-file-noselect initial-buffer-choice)) |
diff --git a/lisp/startup.el b/lisp/startup.el index 6329e3ea8d0..37843eab176 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -120,7 +120,10 @@ the remaining command-line args are in the variable `command-line-args-left'.") | |||
| 120 | "List of command-line args not yet processed. | 120 | "List of command-line args not yet processed. |
| 121 | This is a convenience alias, so that one can write (pop argv) | 121 | This is a convenience alias, so that one can write (pop argv) |
| 122 | inside of --eval command line arguments in order to access | 122 | inside of --eval command line arguments in order to access |
| 123 | following arguments.")) | 123 | following arguments. |
| 124 | |||
| 125 | See also `server-eval-args-left' for a similar variable which | ||
| 126 | works for invocations of \"emacsclient --eval\".")) | ||
| 124 | (internal-make-var-non-special 'argv) | 127 | (internal-make-var-non-special 'argv) |
| 125 | 128 | ||
| 126 | (defvar command-line-args-left nil | 129 | (defvar command-line-args-left nil |
diff --git a/src/android.c b/src/android.c index 3344a773d5f..79f16568fd4 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -1260,6 +1260,14 @@ NATIVE_NAME (dup) (JNIEnv *env, jobject object, jint fd) | |||
| 1260 | return dup (fd); | 1260 | return dup (fd); |
| 1261 | } | 1261 | } |
| 1262 | 1262 | ||
| 1263 | JNIEXPORT jint JNICALL | ||
| 1264 | NATIVE_NAME (close) (JNIEnv *env, jobject object, jint fd) | ||
| 1265 | { | ||
| 1266 | JNI_STACK_ALIGNMENT_PROLOGUE; | ||
| 1267 | |||
| 1268 | return close (fd); | ||
| 1269 | } | ||
| 1270 | |||
| 1263 | JNIEXPORT jstring JNICALL | 1271 | JNIEXPORT jstring JNICALL |
| 1264 | NATIVE_NAME (getFingerprint) (JNIEnv *env, jobject object) | 1272 | NATIVE_NAME (getFingerprint) (JNIEnv *env, jobject object) |
| 1265 | { | 1273 | { |
diff --git a/src/casefiddle.c b/src/casefiddle.c index d567a5e353a..3afb131c50e 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -92,6 +92,12 @@ prepare_casing_context (struct casing_context *ctx, | |||
| 92 | SETUP_BUFFER_SYNTAX_TABLE (); /* For syntax_prefix_flag_p. */ | 92 | SETUP_BUFFER_SYNTAX_TABLE (); /* For syntax_prefix_flag_p. */ |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | static bool | ||
| 96 | case_ch_is_word (enum syntaxcode syntax) | ||
| 97 | { | ||
| 98 | return syntax == Sword || (case_symbols_as_words && syntax == Ssymbol); | ||
| 99 | } | ||
| 100 | |||
| 95 | struct casing_str_buf | 101 | struct casing_str_buf |
| 96 | { | 102 | { |
| 97 | unsigned char data[max (6, MAX_MULTIBYTE_LENGTH)]; | 103 | unsigned char data[max (6, MAX_MULTIBYTE_LENGTH)]; |
| @@ -115,7 +121,7 @@ case_character_impl (struct casing_str_buf *buf, | |||
| 115 | 121 | ||
| 116 | /* Update inword state */ | 122 | /* Update inword state */ |
| 117 | bool was_inword = ctx->inword; | 123 | bool was_inword = ctx->inword; |
| 118 | ctx->inword = SYNTAX (ch) == Sword && | 124 | ctx->inword = case_ch_is_word (SYNTAX (ch)) && |
| 119 | (!ctx->inbuffer || was_inword || !syntax_prefix_flag_p (ch)); | 125 | (!ctx->inbuffer || was_inword || !syntax_prefix_flag_p (ch)); |
| 120 | 126 | ||
| 121 | /* Normalize flag so its one of CASE_UP, CASE_DOWN or CASE_CAPITALIZE. */ | 127 | /* Normalize flag so its one of CASE_UP, CASE_DOWN or CASE_CAPITALIZE. */ |
| @@ -222,7 +228,7 @@ case_character (struct casing_str_buf *buf, struct casing_context *ctx, | |||
| 222 | has a word syntax (i.e. current character is end of word), use final | 228 | has a word syntax (i.e. current character is end of word), use final |
| 223 | sigma. */ | 229 | sigma. */ |
| 224 | if (was_inword && ch == GREEK_CAPITAL_LETTER_SIGMA && changed | 230 | if (was_inword && ch == GREEK_CAPITAL_LETTER_SIGMA && changed |
| 225 | && (!next || SYNTAX (STRING_CHAR (next)) != Sword)) | 231 | && (!next || !case_ch_is_word (SYNTAX (STRING_CHAR (next))))) |
| 226 | { | 232 | { |
| 227 | buf->len_bytes = CHAR_STRING (GREEK_SMALL_LETTER_FINAL_SIGMA, buf->data); | 233 | buf->len_bytes = CHAR_STRING (GREEK_SMALL_LETTER_FINAL_SIGMA, buf->data); |
| 228 | buf->len_chars = 1; | 234 | buf->len_chars = 1; |
| @@ -720,6 +726,21 @@ Called with one argument METHOD which can be: | |||
| 720 | 3rd argument. */); | 726 | 3rd argument. */); |
| 721 | Vregion_extract_function = Qnil; /* simple.el sets this. */ | 727 | Vregion_extract_function = Qnil; /* simple.el sets this. */ |
| 722 | 728 | ||
| 729 | DEFVAR_BOOL ("case-symbols-as-words", case_symbols_as_words, | ||
| 730 | doc: /* If non-nil, case functions treat symbol syntax as part of words. | ||
| 731 | |||
| 732 | Functions such as `upcase-initials' and `replace-match' check or modify | ||
| 733 | the case pattern of sequences of characters. Normally, these operate on | ||
| 734 | sequences of characters whose syntax is word constituent. If this | ||
| 735 | variable is non-nil, then they operate on sequences of characters whose | ||
| 736 | syntax is either word constituent or symbol constituent. | ||
| 737 | |||
| 738 | This is useful for programming languages and styles where only the first | ||
| 739 | letter of a symbol's name is ever capitalized.*/); | ||
| 740 | case_symbols_as_words = 0; | ||
| 741 | DEFSYM (Qcase_symbols_as_words, "case-symbols-as-words"); | ||
| 742 | Fmake_variable_buffer_local (Qcase_symbols_as_words); | ||
| 743 | |||
| 723 | defsubr (&Supcase); | 744 | defsubr (&Supcase); |
| 724 | defsubr (&Sdowncase); | 745 | defsubr (&Sdowncase); |
| 725 | defsubr (&Scapitalize); | 746 | defsubr (&Scapitalize); |
diff --git a/src/search.c b/src/search.c index e9b29bb7179..692d8488049 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2365,7 +2365,7 @@ text has only capital letters and has at least one multiletter word, | |||
| 2365 | convert NEWTEXT to all caps. Otherwise if all words are capitalized | 2365 | convert NEWTEXT to all caps. Otherwise if all words are capitalized |
| 2366 | in the replaced text, capitalize each word in NEWTEXT. Note that | 2366 | in the replaced text, capitalize each word in NEWTEXT. Note that |
| 2367 | what exactly is a word is determined by the syntax tables in effect | 2367 | what exactly is a word is determined by the syntax tables in effect |
| 2368 | in the current buffer. | 2368 | in the current buffer, and the variable `case-symbols-as-words'. |
| 2369 | 2369 | ||
| 2370 | If optional third arg LITERAL is non-nil, insert NEWTEXT literally. | 2370 | If optional third arg LITERAL is non-nil, insert NEWTEXT literally. |
| 2371 | Otherwise treat `\\' as special: | 2371 | Otherwise treat `\\' as special: |
| @@ -2479,7 +2479,8 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2479 | /* Cannot be all caps if any original char is lower case */ | 2479 | /* Cannot be all caps if any original char is lower case */ |
| 2480 | 2480 | ||
| 2481 | some_lowercase = 1; | 2481 | some_lowercase = 1; |
| 2482 | if (SYNTAX (prevc) != Sword) | 2482 | if (SYNTAX (prevc) != Sword |
| 2483 | && !(case_symbols_as_words && SYNTAX (prevc) == Ssymbol)) | ||
| 2483 | some_nonuppercase_initial = 1; | 2484 | some_nonuppercase_initial = 1; |
| 2484 | else | 2485 | else |
| 2485 | some_multiletter_word = 1; | 2486 | some_multiletter_word = 1; |
| @@ -2487,7 +2488,8 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2487 | else if (uppercasep (c)) | 2488 | else if (uppercasep (c)) |
| 2488 | { | 2489 | { |
| 2489 | some_uppercase = 1; | 2490 | some_uppercase = 1; |
| 2490 | if (SYNTAX (prevc) != Sword) | 2491 | if (SYNTAX (prevc) != Sword |
| 2492 | && !(case_symbols_as_words && SYNTAX (prevc) == Ssymbol)) | ||
| 2491 | ; | 2493 | ; |
| 2492 | else | 2494 | else |
| 2493 | some_multiletter_word = 1; | 2495 | some_multiletter_word = 1; |
| @@ -2496,7 +2498,8 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2496 | { | 2498 | { |
| 2497 | /* If the initial is a caseless word constituent, | 2499 | /* If the initial is a caseless word constituent, |
| 2498 | treat that like a lowercase initial. */ | 2500 | treat that like a lowercase initial. */ |
| 2499 | if (SYNTAX (prevc) != Sword) | 2501 | if (SYNTAX (prevc) != Sword |
| 2502 | && !(case_symbols_as_words && SYNTAX (prevc) == Ssymbol)) | ||
| 2500 | some_nonuppercase_initial = 1; | 2503 | some_nonuppercase_initial = 1; |
| 2501 | } | 2504 | } |
| 2502 | 2505 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 578131a4005..20c7634fc3e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -35537,6 +35537,16 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 35537 | w = XWINDOW (window); | 35537 | w = XWINDOW (window); |
| 35538 | frame_to_window_pixel_xy (w, &x, &y); | 35538 | frame_to_window_pixel_xy (w, &x, &y); |
| 35539 | 35539 | ||
| 35540 | #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_MENU_BAR) | ||
| 35541 | /* Handle menu-bar window differently since it doesn't display a | ||
| 35542 | buffer. */ | ||
| 35543 | if (EQ (window, f->menu_bar_window)) | ||
| 35544 | { | ||
| 35545 | cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor; | ||
| 35546 | goto set_cursor; | ||
| 35547 | } | ||
| 35548 | #endif | ||
| 35549 | |||
| 35540 | #if defined (HAVE_WINDOW_SYSTEM) | 35550 | #if defined (HAVE_WINDOW_SYSTEM) |
| 35541 | /* Handle tab-bar window differently since it doesn't display a | 35551 | /* Handle tab-bar window differently since it doesn't display a |
| 35542 | buffer. */ | 35552 | buffer. */ |
diff --git a/test/lisp/progmodes/which-func-tests.el b/test/lisp/progmodes/which-func-tests.el new file mode 100644 index 00000000000..73709f1c5e5 --- /dev/null +++ b/test/lisp/progmodes/which-func-tests.el | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | ;;; which-func-tests.el --- tests for which-func -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2023 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Spencer Baugh <sbaugh@catern.com> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; This program is free software; you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; This program is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;;; Code: | ||
| 25 | (require 'ert) | ||
| 26 | (require 'which-func) | ||
| 27 | |||
| 28 | (ert-deftest which-func-tests-toggle () | ||
| 29 | (let ((which-func-display 'mode-and-header) buf-code buf-not) | ||
| 30 | (setq buf-code (find-file-noselect "which-func-tests.el")) | ||
| 31 | (setq buf-not (get-buffer-create "fundamental")) | ||
| 32 | (with-current-buffer buf-code | ||
| 33 | (should-not which-func-mode) (should-not header-line-format)) | ||
| 34 | (with-current-buffer buf-not | ||
| 35 | (should-not which-func-mode) (should-not header-line-format)) | ||
| 36 | (which-function-mode 1) | ||
| 37 | (with-current-buffer buf-code | ||
| 38 | (should which-func-mode) (should header-line-format)) | ||
| 39 | (with-current-buffer buf-not | ||
| 40 | (should-not which-func-mode) (should-not header-line-format)) | ||
| 41 | (which-function-mode -1) | ||
| 42 | ;; which-func-mode stays set even when which-function-mode is off. | ||
| 43 | (with-current-buffer buf-code | ||
| 44 | (should which-func-mode) (should-not header-line-format)) | ||
| 45 | (with-current-buffer buf-not | ||
| 46 | (should-not which-func-mode) (should-not header-line-format)) | ||
| 47 | (kill-buffer buf-code) | ||
| 48 | (kill-buffer buf-not) | ||
| 49 | (which-function-mode 1) | ||
| 50 | (setq buf-code (find-file-noselect "which-func-tests.el")) | ||
| 51 | (setq buf-not (get-buffer-create "fundamental")) | ||
| 52 | (with-current-buffer buf-code | ||
| 53 | (should which-func-mode) (should header-line-format)) | ||
| 54 | (with-current-buffer buf-not | ||
| 55 | (should-not which-func-mode) (should-not header-line-format)))) | ||
| 56 | |||
| 57 | (provide 'which-func-tests) | ||
| 58 | ;;; which-func-tests.el ends here | ||
diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el index e7f4348b0c6..12984d898b9 100644 --- a/test/src/casefiddle-tests.el +++ b/test/src/casefiddle-tests.el | |||
| @@ -294,4 +294,16 @@ | |||
| 294 | ;;(should (string-equal (capitalize "indIá") "İndıa")) | 294 | ;;(should (string-equal (capitalize "indIá") "İndıa")) |
| 295 | )) | 295 | )) |
| 296 | 296 | ||
| 297 | (defun casefiddle-tests--check-syms (init with-words with-symbols) | ||
| 298 | (let ((case-symbols-as-words nil)) | ||
| 299 | (should (string-equal (upcase-initials init) with-words))) | ||
| 300 | (let ((case-symbols-as-words t)) | ||
| 301 | (should (string-equal (upcase-initials init) with-symbols)))) | ||
| 302 | |||
| 303 | (ert-deftest casefiddle-case-symbols-as-words () | ||
| 304 | (casefiddle-tests--check-syms "Aa_bb Cc_dd" "Aa_Bb Cc_Dd" "Aa_bb Cc_dd") | ||
| 305 | (casefiddle-tests--check-syms "Aa_bb cc_DD" "Aa_Bb Cc_DD" "Aa_bb Cc_DD") | ||
| 306 | (casefiddle-tests--check-syms "aa_bb cc_dd" "Aa_Bb Cc_Dd" "Aa_bb Cc_dd") | ||
| 307 | (casefiddle-tests--check-syms "Aa_Bb Cc_Dd" "Aa_Bb Cc_Dd" "Aa_Bb Cc_Dd")) | ||
| 308 | |||
| 297 | ;;; casefiddle-tests.el ends here | 309 | ;;; casefiddle-tests.el ends here |