diff options
| author | Alan Mackenzie | 2016-03-30 16:53:36 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2016-03-30 16:53:36 +0000 |
| commit | ed19f207449c43f7f08285ada87ae7a46c61c8d1 (patch) | |
| tree | fc495d64b752f276f1e8dc86427098de80789988 /lisp | |
| parent | eabd667a9584fe5bd2422e296d256dceea67debf (diff) | |
| parent | 7c1802f6ffc2704ba8042c7c1c6faa73dfa210d1 (diff) | |
| download | emacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.tar.gz emacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.zip | |
Merge branch 'emacs-25' of /home/acm/emacs/emacs.git/emacs-25 into emacs-25
Diffstat (limited to 'lisp')
38 files changed, 348 insertions, 283 deletions
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 24400a94d6a..f33dd011eda 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -194,7 +194,7 @@ update-subdirs: | |||
| 194 | $(srcdir)/../build-aux/update-subdirs $$file; \ | 194 | $(srcdir)/../build-aux/update-subdirs $$file; \ |
| 195 | done; | 195 | done; |
| 196 | 196 | ||
| 197 | .PHONY: updates repo-update update-authors | 197 | .PHONY: updates repo-update update-authors update-gnus-news |
| 198 | 198 | ||
| 199 | # Some modes of make-dist use this. | 199 | # Some modes of make-dist use this. |
| 200 | updates: update-subdirs autoloads finder-data custom-deps | 200 | updates: update-subdirs autoloads finder-data custom-deps |
| @@ -207,12 +207,16 @@ updates: update-subdirs autoloads finder-data custom-deps | |||
| 207 | # this directory's autoloads rule. | 207 | # this directory's autoloads rule. |
| 208 | repo-update: compile finder-data custom-deps | 208 | repo-update: compile finder-data custom-deps |
| 209 | 209 | ||
| 210 | # Update the AUTHORS file. | 210 | # Update etc/AUTHORS and etc/GNUS-NEWS. |
| 211 | 211 | ||
| 212 | update-authors: | 212 | update-authors: |
| 213 | $(emacs) -L "$(top_srcdir)/admin" -l authors \ | 213 | $(emacs) -L "$(top_srcdir)/admin" -l authors \ |
| 214 | -f batch-update-authors "$(top_srcdir)/etc/AUTHORS" "$(top_srcdir)" | 214 | -f batch-update-authors "$(top_srcdir)/etc/AUTHORS" "$(top_srcdir)" |
| 215 | 215 | ||
| 216 | update-gnus-news: | ||
| 217 | $(emacs) -L "$(top_srcdir)/doc/misc" -l gnus-news -f batch-gnus-news \ | ||
| 218 | "$(top_srcdir)/doc/misc/gnus-news.texi" \ | ||
| 219 | "$(top_srcdir)/etc/GNUS-NEWS" | ||
| 216 | 220 | ||
| 217 | ETAGS = ../lib-src/etags | 221 | ETAGS = ../lib-src/etags |
| 218 | 222 | ||
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 94cd08eaa4e..9574c03043e 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el | |||
| @@ -1414,7 +1414,12 @@ the archive of the file moved to, creating it if it does not exist." | |||
| 1414 | (setq todo-files (funcall todo-files-function)) | 1414 | (setq todo-files (funcall todo-files-function)) |
| 1415 | (todo-reevaluate-filelist-defcustoms)) | 1415 | (todo-reevaluate-filelist-defcustoms)) |
| 1416 | (dolist (buf buffers) | 1416 | (dolist (buf buffers) |
| 1417 | ;; Make sure archive file is in Todo Archive mode so that | ||
| 1418 | ;; todo-categories has correct value. | ||
| 1417 | (with-current-buffer (find-file-noselect buf) | 1419 | (with-current-buffer (find-file-noselect buf) |
| 1420 | (when (equal (file-name-extension (buffer-file-name)) "toda") | ||
| 1421 | (unless (derived-mode-p 'todo-archive-mode) | ||
| 1422 | (todo-archive-mode))) | ||
| 1418 | (widen) | 1423 | (widen) |
| 1419 | (goto-char (point-max)) | 1424 | (goto-char (point-max)) |
| 1420 | (let* ((beg (re-search-backward | 1425 | (let* ((beg (re-search-backward |
| @@ -1466,10 +1471,18 @@ the archive of the file moved to, creating it if it does not exist." | |||
| 1466 | (re-search-backward | 1471 | (re-search-backward |
| 1467 | (concat "^" (regexp-quote todo-category-beg) | 1472 | (concat "^" (regexp-quote todo-category-beg) |
| 1468 | "\\(" (regexp-quote cat) "\\)$") nil t) | 1473 | "\\(" (regexp-quote cat) "\\)$") nil t) |
| 1469 | (replace-match new nil nil nil 1))) | 1474 | (replace-match new nil nil nil 1)) |
| 1470 | (setq todo-categories | 1475 | (setq todo-categories |
| 1471 | (append todo-categories (list (cons (or new cat) counts)))) | 1476 | (append todo-categories (list (cons (or new cat) counts)))) |
| 1472 | (todo-update-categories-sexp) | 1477 | (goto-char (point-min)) |
| 1478 | (if (looking-at "((\"") | ||
| 1479 | ;; Delete existing sexp. | ||
| 1480 | (delete-region (line-beginning-position) (line-end-position)) | ||
| 1481 | ;; Otherwise, file is new, so make space for categories sexp. | ||
| 1482 | (insert "\n") | ||
| 1483 | (goto-char (point-min))) | ||
| 1484 | ;; Insert (new or updated) sexp. | ||
| 1485 | (prin1 todo-categories (current-buffer))) | ||
| 1473 | ;; If archive was just created, save it to avoid "File | 1486 | ;; If archive was just created, save it to avoid "File |
| 1474 | ;; <xyz> no longer exists!" message on invoking | 1487 | ;; <xyz> no longer exists!" message on invoking |
| 1475 | ;; `todo-view-archived-items'. | 1488 | ;; `todo-view-archived-items'. |
| @@ -1500,9 +1513,7 @@ the archive of the file moved to, creating it if it does not exist." | |||
| 1500 | (setq todo-category-number 1)) | 1513 | (setq todo-category-number 1)) |
| 1501 | (todo-category-select))))) | 1514 | (todo-category-select))))) |
| 1502 | (set-window-buffer (selected-window) | 1515 | (set-window-buffer (selected-window) |
| 1503 | (set-buffer (find-file-noselect nfile))) | 1516 | (set-buffer (find-file-noselect nfile)))))) |
| 1504 | (todo-category-number (or new cat)) | ||
| 1505 | (todo-category-select)))) | ||
| 1506 | 1517 | ||
| 1507 | (defun todo-merge-category (&optional file) | 1518 | (defun todo-merge-category (&optional file) |
| 1508 | "Merge current category into another existing category. | 1519 | "Merge current category into another existing category. |
diff --git a/lisp/comint.el b/lisp/comint.el index dcd4a5ae4cf..cb79c175f0e 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -816,6 +816,13 @@ series of processes in the same Comint buffer. The hook | |||
| 816 | (format "COLUMNS=%d" (window-width))) | 816 | (format "COLUMNS=%d" (window-width))) |
| 817 | (list "TERM=emacs" | 817 | (list "TERM=emacs" |
| 818 | (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) | 818 | (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) |
| 819 | |||
| 820 | ;; This hack is for backward compatibility with Bash 4.3 and | ||
| 821 | ;; earlier. It can break common uses of 'configure', so | ||
| 822 | ;; remove it once Bash 4.4 or later is common. | ||
| 823 | (unless (getenv "EMACS") | ||
| 824 | (list "EMACS=t")) | ||
| 825 | |||
| 819 | (list (format "INSIDE_EMACS=%s,comint" emacs-version)) | 826 | (list (format "INSIDE_EMACS=%s,comint" emacs-version)) |
| 820 | process-environment)) | 827 | process-environment)) |
| 821 | (default-directory | 828 | (default-directory |
diff --git a/lisp/dired-x.el b/lisp/dired-x.el index dccaa9e96ca..088ca81ed8d 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el | |||
| @@ -816,12 +816,11 @@ If in a Dired buffer, reverts it." | |||
| 816 | (interactive) | 816 | (interactive) |
| 817 | (if (file-exists-p dired-local-variables-file) | 817 | (if (file-exists-p dired-local-variables-file) |
| 818 | (error "Old-style dired-local-variables-file `./%s' found; | 818 | (error "Old-style dired-local-variables-file `./%s' found; |
| 819 | replace it with a dir-locals-file `./%s.el'" | 819 | replace it with a dir-locals-file `./%s'" |
| 820 | dired-local-variables-file | 820 | dired-local-variables-file |
| 821 | dir-locals-file)) | 821 | dir-locals-file)) |
| 822 | (if (dir-locals--all-files default-directory) | 822 | (if (file-exists-p dir-locals-file) |
| 823 | (message "File `./%s' already exists." | 823 | (message "File `./%s' already exists." dir-locals-file) |
| 824 | (car (dir-locals--all-files default-directory))) | ||
| 825 | (add-dir-local-variable 'dired-mode 'subdirs nil) | 824 | (add-dir-local-variable 'dired-mode 'subdirs nil) |
| 826 | (add-dir-local-variable 'dired-mode 'dired-omit-mode t) | 825 | (add-dir-local-variable 'dired-mode 'dired-omit-mode t) |
| 827 | ;; Run extra-hooks and revert directory. | 826 | ;; Run extra-hooks and revert directory. |
diff --git a/lisp/dired.el b/lisp/dired.el index 24b128f2944..5741872cfc8 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -2736,9 +2736,18 @@ instead of `dired-actual-switches'." | |||
| 2736 | (save-excursion | 2736 | (save-excursion |
| 2737 | (goto-char (point-min)) | 2737 | (goto-char (point-min)) |
| 2738 | (dired-goto-file-1 file file (point-max))) | 2738 | (dired-goto-file-1 file file (point-max))) |
| 2739 | ;; Otherwise, look for it as a relative name. The | 2739 | ;; Next, look for it as a relative name with leading |
| 2740 | ;; hair is to get the result of `dired-goto-subdir' | 2740 | ;; subdirectories. (This happens in Dired buffers |
| 2741 | ;; without calling it if we don't have any subdirs. | 2741 | ;; created by find-dired, for example.) |
| 2742 | (save-excursion | ||
| 2743 | (goto-char (point-min)) | ||
| 2744 | (dired-goto-file-1 (file-relative-name file | ||
| 2745 | default-directory) | ||
| 2746 | file (point-max))) | ||
| 2747 | ;; Otherwise, look for it as a relative name, a base | ||
| 2748 | ;; name only. The hair is to get the result of | ||
| 2749 | ;; `dired-goto-subdir' without calling it if we don't | ||
| 2750 | ;; have any subdirs. | ||
| 2742 | (save-excursion | 2751 | (save-excursion |
| 2743 | (when (if (string= dir (expand-file-name default-directory)) | 2752 | (when (if (string= dir (expand-file-name default-directory)) |
| 2744 | (goto-char (point-min)) | 2753 | (goto-char (point-min)) |
| @@ -4428,7 +4437,7 @@ instead. | |||
| 4428 | 4437 | ||
| 4429 | ;;;*** | 4438 | ;;;*** |
| 4430 | 4439 | ||
| 4431 | ;;;### (autoloads nil "dired-x" "dired-x.el" "8dae922d1549647835460b6cb70af4df") | 4440 | ;;;### (autoloads nil "dired-x" "dired-x.el" "f00ad5ec7383d017263855ad8add60a3") |
| 4432 | ;;; Generated autoloads from dired-x.el | 4441 | ;;; Generated autoloads from dired-x.el |
| 4433 | 4442 | ||
| 4434 | (autoload 'dired-jump "dired-x" "\ | 4443 | (autoload 'dired-jump "dired-x" "\ |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9d912c3f6d9..223565cedb6 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -626,7 +626,7 @@ at the bottom edge of the page moves to the next page." | |||
| 626 | (image-bob) | 626 | (image-bob) |
| 627 | (image-bol 1)) | 627 | (image-bol 1)) |
| 628 | (set-window-hscroll (selected-window) hscroll))) | 628 | (set-window-hscroll (selected-window) hscroll))) |
| 629 | (image-next-line 1))) | 629 | (image-next-line arg))) |
| 630 | 630 | ||
| 631 | (defun doc-view-previous-line-or-previous-page (&optional arg) | 631 | (defun doc-view-previous-line-or-previous-page (&optional arg) |
| 632 | "Scroll downward by ARG lines if possible, else goto previous page. | 632 | "Scroll downward by ARG lines if possible, else goto previous page. |
diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el index ac063d4896a..f1ab82ecc4a 100644 --- a/lisp/emacs-lisp/cursor-sensor.el +++ b/lisp/emacs-lisp/cursor-sensor.el | |||
| @@ -113,7 +113,7 @@ | |||
| 113 | ;; non-sticky on both ends, but that means get-pos-property might | 113 | ;; non-sticky on both ends, but that means get-pos-property might |
| 114 | ;; never see it. | 114 | ;; never see it. |
| 115 | (new (or (get-char-property point 'cursor-sensor-functions) | 115 | (new (or (get-char-property point 'cursor-sensor-functions) |
| 116 | (unless (= point 1) | 116 | (unless (bobp) |
| 117 | (get-char-property (1- point) 'cursor-sensor-functions)))) | 117 | (get-char-property (1- point) 'cursor-sensor-functions)))) |
| 118 | (old (window-parameter window 'cursor-sensor--last-state)) | 118 | (old (window-parameter window 'cursor-sensor--last-state)) |
| 119 | (oldposmark (car old)) | 119 | (oldposmark (car old)) |
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index ec8d3d79d9f..ba15a65f5e1 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el | |||
| @@ -123,33 +123,26 @@ MAP can be a list, hash-table or array." | |||
| 123 | default))) | 123 | default))) |
| 124 | 124 | ||
| 125 | (defmacro map-put (map key value) | 125 | (defmacro map-put (map key value) |
| 126 | "Associate KEY with VALUE in MAP and return MAP. | 126 | "Associate KEY with VALUE in MAP and return VALUE. |
| 127 | If KEY is already present in MAP, replace the associated value | 127 | If KEY is already present in MAP, replace the associated value |
| 128 | with VALUE. | 128 | with VALUE. |
| 129 | 129 | ||
| 130 | MAP can be a list, hash-table or array." | 130 | MAP can be a list, hash-table or array." |
| 131 | (macroexp-let2 nil map map | 131 | `(setf (map-elt ,map ,key) ,value)) |
| 132 | `(progn | ||
| 133 | (setf (map-elt ,map ,key) ,value) | ||
| 134 | ,map))) | ||
| 135 | 132 | ||
| 136 | (defmacro map-delete (map key) | 133 | (defun map-delete (map key) |
| 137 | "Delete KEY from MAP and return MAP. | 134 | "Delete KEY from MAP and return MAP. |
| 138 | No error is signaled if KEY is not a key of MAP. If MAP is an | 135 | No error is signaled if KEY is not a key of MAP. If MAP is an |
| 139 | array, store nil at the index KEY. | 136 | array, store nil at the index KEY. |
| 140 | 137 | ||
| 141 | MAP can be a list, hash-table or array." | 138 | MAP can be a list, hash-table or array." |
| 142 | (declare (debug t)) | 139 | (map--dispatch map |
| 143 | (gv-letplace (mgetter msetter) `(gv-delay-error ,map) | 140 | :list (setf (alist-get key map nil t) nil) |
| 144 | (macroexp-let2 nil key key | 141 | :hash-table (remhash key map) |
| 145 | `(if (not (listp ,mgetter)) | 142 | :array (and (>= key 0) |
| 146 | (map--delete ,mgetter ,key) | 143 | (<= key (seq-length map)) |
| 147 | ;; The alist case is special, since it can't be handled by the | 144 | (aset map key nil))) |
| 148 | ;; map--delete function. | 145 | map) |
| 149 | (setf (alist-get ,key (gv-synthetic-place ,mgetter ,msetter) | ||
| 150 | nil t) | ||
| 151 | nil) | ||
| 152 | ,mgetter)))) | ||
| 153 | 146 | ||
| 154 | (defun map-nested-elt (map keys &optional default) | 147 | (defun map-nested-elt (map keys &optional default) |
| 155 | "Traverse MAP using KEYS and return the looked up value or DEFAULT if nil. | 148 | "Traverse MAP using KEYS and return the looked up value or DEFAULT if nil. |
| @@ -337,15 +330,6 @@ MAP can be a list, hash-table or array." | |||
| 337 | (cdr pair))) | 330 | (cdr pair))) |
| 338 | map)) | 331 | map)) |
| 339 | 332 | ||
| 340 | (defun map--delete (map key) | ||
| 341 | (map--dispatch map | ||
| 342 | :list (error "No place to remove the mapping for %S" key) | ||
| 343 | :hash-table (remhash key map) | ||
| 344 | :array (and (>= key 0) | ||
| 345 | (<= key (seq-length map)) | ||
| 346 | (aset map key nil))) | ||
| 347 | map) | ||
| 348 | |||
| 349 | (defun map--apply-hash-table (function map) | 333 | (defun map--apply-hash-table (function map) |
| 350 | "Private function used to apply FUNCTION over MAP, MAP being a hash-table." | 334 | "Private function used to apply FUNCTION over MAP, MAP being a hash-table." |
| 351 | (let (result) | 335 | (let (result) |
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 495ba7cb859..1d8f0cb8f5d 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el | |||
| @@ -1493,7 +1493,10 @@ should not be computed on the basis of the following token." | |||
| 1493 | (let ((endpos (point))) | 1493 | (let ((endpos (point))) |
| 1494 | (goto-char pos) | 1494 | (goto-char pos) |
| 1495 | (forward-line 1) | 1495 | (forward-line 1) |
| 1496 | (and (equal res (smie-indent-forward-token)) | 1496 | ;; As seen in bug#22960, pos may be inside |
| 1497 | ;; a string, and forward-token may then stumble. | ||
| 1498 | (and (ignore-errors | ||
| 1499 | (equal res (smie-indent-forward-token))) | ||
| 1497 | (eq (point) endpos))))) | 1500 | (eq (point) endpos))))) |
| 1498 | nil | 1501 | nil |
| 1499 | (goto-char pos) | 1502 | (goto-char pos) |
diff --git a/lisp/forms.el b/lisp/forms.el index c0b48fd3b63..b068352e6eb 100644 --- a/lisp/forms.el +++ b/lisp/forms.el | |||
| @@ -593,7 +593,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 593 | ;; set-visited-file-name from calling set-auto-mode, which | 593 | ;; set-visited-file-name from calling set-auto-mode, which |
| 594 | ;; might kill all local variables and set forms-file nil, | 594 | ;; might kill all local variables and set forms-file nil, |
| 595 | ;; which will then barf in find-file-noselect below. This can | 595 | ;; which will then barf in find-file-noselect below. This can |
| 596 | ;; hapen when the user sets the default major mode that is | 596 | ;; happen when the user sets the default major mode that is |
| 597 | ;; different from the Fundamental mode. | 597 | ;; different from the Fundamental mode. |
| 598 | (let (change-major-mode-with-file-name) | 598 | (let (change-major-mode-with-file-name) |
| 599 | (set-visited-file-name nil)) | 599 | (set-visited-file-name nil)) |
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index f70877dc63a..3ea63c74034 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | (autoload 'gnus-map-function "gnus-util") | 30 | (autoload 'gnus-map-function "gnus-util") |
| 31 | (autoload 'gnus-replace-in-string "gnus-util") | 31 | (autoload 'gnus-replace-in-string "gnus-util") |
| 32 | (autoload 'gnus-read-shell-command "gnus-util") | 32 | (autoload 'gnus-read-shell-command "gnus-util") |
| 33 | (autoload 'gnus-format-message "gnus-util") | ||
| 33 | 34 | ||
| 34 | (autoload 'mm-inline-partial "mm-partial") | 35 | (autoload 'mm-inline-partial "mm-partial") |
| 35 | (autoload 'mm-inline-external-body "mm-extern") | 36 | (autoload 'mm-inline-external-body "mm-extern") |
diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index 3ac3da0127d..254c427299e 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el | |||
| @@ -27,6 +27,8 @@ | |||
| 27 | 27 | ||
| 28 | (require 'gnus-util) | 28 | (require 'gnus-util) |
| 29 | (require 'epg) | 29 | (require 'epg) |
| 30 | (require 'password-cache) | ||
| 31 | (require 'mm-encode) | ||
| 30 | 32 | ||
| 31 | (autoload 'mail-strip-quoted-names "mail-utils") | 33 | (autoload 'mail-strip-quoted-names "mail-utils") |
| 32 | (autoload 'mml2015-sign "mml2015") | 34 | (autoload 'mml2015-sign "mml2015") |
| @@ -35,6 +37,7 @@ | |||
| 35 | (autoload 'mml1991-encrypt "mml1991") | 37 | (autoload 'mml1991-encrypt "mml1991") |
| 36 | (autoload 'message-fetch-field "message") | 38 | (autoload 'message-fetch-field "message") |
| 37 | (autoload 'message-goto-body "message") | 39 | (autoload 'message-goto-body "message") |
| 40 | (autoload 'message-options-get "message") | ||
| 38 | (autoload 'mml-insert-tag "mml") | 41 | (autoload 'mml-insert-tag "mml") |
| 39 | (autoload 'mml-smime-sign "mml-smime") | 42 | (autoload 'mml-smime-sign "mml-smime") |
| 40 | (autoload 'mml-smime-encrypt "mml-smime") | 43 | (autoload 'mml-smime-encrypt "mml-smime") |
| @@ -44,6 +47,8 @@ | |||
| 44 | (autoload 'mml-smime-verify-test "mml-smime") | 47 | (autoload 'mml-smime-verify-test "mml-smime") |
| 45 | (autoload 'epa--select-keys "epa") | 48 | (autoload 'epa--select-keys "epa") |
| 46 | 49 | ||
| 50 | (declare-function message-options-set "message" (symbol value)) | ||
| 51 | |||
| 47 | (defvar mml-sign-alist | 52 | (defvar mml-sign-alist |
| 48 | '(("smime" mml-smime-sign-buffer mml-smime-sign-query) | 53 | '(("smime" mml-smime-sign-buffer mml-smime-sign-query) |
| 49 | ("pgp" mml-pgp-sign-buffer list) | 54 | ("pgp" mml-pgp-sign-buffer list) |
| @@ -110,20 +115,15 @@ details." | |||
| 110 | :group 'message | 115 | :group 'message |
| 111 | :type 'boolean) | 116 | :type 'boolean) |
| 112 | 117 | ||
| 113 | (defcustom mml-secure-cache-passphrase | 118 | ;; FIXME If it's "NOT recommended", why is it the default? |
| 114 | (if (boundp 'password-cache) | 119 | (defcustom mml-secure-cache-passphrase password-cache |
| 115 | password-cache | ||
| 116 | t) | ||
| 117 | "If t, cache OpenPGP or S/MIME passphrases inside Emacs. | 120 | "If t, cache OpenPGP or S/MIME passphrases inside Emacs. |
| 118 | Passphrase caching in Emacs is NOT recommended. Use gpg-agent instead. | 121 | Passphrase caching in Emacs is NOT recommended. Use gpg-agent instead. |
| 119 | See Info node `(message) Security'." | 122 | See Info node `(message) Security'." |
| 120 | :group 'message | 123 | :group 'message |
| 121 | :type 'boolean) | 124 | :type 'boolean) |
| 122 | 125 | ||
| 123 | (defcustom mml-secure-passphrase-cache-expiry | 126 | (defcustom mml-secure-passphrase-cache-expiry password-cache-expiry |
| 124 | (if (boundp 'password-cache-expiry) | ||
| 125 | password-cache-expiry | ||
| 126 | 16) | ||
| 127 | "How many seconds the passphrase is cached. | 127 | "How many seconds the passphrase is cached. |
| 128 | Whether the passphrase is cached at all is controlled by | 128 | Whether the passphrase is cached at all is controlled by |
| 129 | `mml-secure-cache-passphrase'." | 129 | `mml-secure-cache-passphrase'." |
diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 248e63682c8..502c65b2463 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el | |||
| @@ -356,10 +356,6 @@ Whether the passphrase is cached at all is controlled by | |||
| 356 | 356 | ||
| 357 | (autoload 'mml-compute-boundary "mml") | 357 | (autoload 'mml-compute-boundary "mml") |
| 358 | 358 | ||
| 359 | ;; We require mm-decode, which requires mm-bodies, which autoloads | ||
| 360 | ;; message-options-get (!). | ||
| 361 | (declare-function message-options-set "message" (symbol value)) | ||
| 362 | |||
| 363 | (defun mml-smime-epg-sign (cont) | 359 | (defun mml-smime-epg-sign (cont) |
| 364 | (let ((inhibit-redisplay t) | 360 | (let ((inhibit-redisplay t) |
| 365 | (boundary (mml-compute-boundary cont))) | 361 | (boundary (mml-compute-boundary cont))) |
diff --git a/lisp/gnus/mml1991.el b/lisp/gnus/mml1991.el index bb5c940f173..568dc564d91 100644 --- a/lisp/gnus/mml1991.el +++ b/lisp/gnus/mml1991.el | |||
| @@ -25,11 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | ;;; Code: | 26 | ;;; Code: |
| 27 | 27 | ||
| 28 | (eval-and-compile | ||
| 29 | (if (locate-library "password-cache") | ||
| 30 | (require 'password-cache) | ||
| 31 | (require 'password))) | ||
| 32 | |||
| 33 | (eval-when-compile | 28 | (eval-when-compile |
| 34 | (require 'cl) | 29 | (require 'cl) |
| 35 | (require 'mm-util)) | 30 | (require 'mm-util)) |
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index e2e99771801..61ca53624d3 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el | |||
| @@ -27,11 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (eval-and-compile | ||
| 31 | (if (locate-library "password-cache") | ||
| 32 | (require 'password-cache) | ||
| 33 | (require 'password))) | ||
| 34 | |||
| 35 | (eval-when-compile (require 'cl)) | 30 | (eval-when-compile (require 'cl)) |
| 36 | (require 'mm-decode) | 31 | (require 'mm-decode) |
| 37 | (require 'mm-util) | 32 | (require 'mm-util) |
diff --git a/lisp/isearch.el b/lisp/isearch.el index b8ada2c766a..48354d39d48 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -2574,16 +2574,30 @@ the word mode." | |||
| 2574 | (when (eq regexp-function t) | 2574 | (when (eq regexp-function t) |
| 2575 | (setq regexp-function #'word-search-regexp)) | 2575 | (setq regexp-function #'word-search-regexp)) |
| 2576 | (let ((description | 2576 | (let ((description |
| 2577 | ;; Don't use a description on the default search mode. | 2577 | (cond |
| 2578 | (cond ((equal regexp-function search-default-mode) "") | 2578 | ;; 1. Do not use a description on the default search mode, |
| 2579 | (regexp-function | 2579 | ;; but only if the default search mode is non-nil. |
| 2580 | (and (symbolp regexp-function) | 2580 | ((or (and search-default-mode |
| 2581 | (or (get regexp-function 'isearch-message-prefix) | 2581 | (equal search-default-mode regexp-function)) |
| 2582 | ""))) | 2582 | ;; Special case where `search-default-mode' is t |
| 2583 | (isearch-regexp "regexp ") | 2583 | ;; (defaults to regexp searches). |
| 2584 | ;; We're in literal mode. If the default mode is not | 2584 | (and (eq search-default-mode t) |
| 2585 | ;; literal, then describe it. | 2585 | (eq search-default-mode isearch-regexp))) "") |
| 2586 | ((functionp search-default-mode) "literal ")))) | 2586 | ;; 2. Use the `isearch-message-prefix' set for |
| 2587 | ;; `regexp-function' if available. | ||
| 2588 | (regexp-function | ||
| 2589 | (and (symbolp regexp-function) | ||
| 2590 | (or (get regexp-function 'isearch-message-prefix) | ||
| 2591 | ""))) | ||
| 2592 | ;; 3. Else if `isearch-regexp' is non-nil, set description | ||
| 2593 | ;; to "regexp ". | ||
| 2594 | (isearch-regexp "regexp ") | ||
| 2595 | ;; 4. Else if we're in literal mode (and if the default | ||
| 2596 | ;; mode is also not literal), describe it. | ||
| 2597 | ((functionp search-default-mode) "literal ") | ||
| 2598 | ;; 5. And finally, if none of the above is true, set the | ||
| 2599 | ;; description to an empty string. | ||
| 2600 | (t "")))) | ||
| 2587 | (if space-before | 2601 | (if space-before |
| 2588 | ;; Move space from the end to the beginning. | 2602 | ;; Move space from the end to the beginning. |
| 2589 | (replace-regexp-in-string "\\(.*\\) \\'" " \\1" description) | 2603 | (replace-regexp-in-string "\\(.*\\) \\'" " \\1" description) |
diff --git a/lisp/loadup.el b/lisp/loadup.el index bd47bed3160..21c64a8c3b4 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -117,6 +117,10 @@ | |||
| 117 | (load "format") | 117 | (load "format") |
| 118 | (load "bindings") | 118 | (load "bindings") |
| 119 | (load "window") ; Needed here for `replace-buffer-in-windows'. | 119 | (load "window") ; Needed here for `replace-buffer-in-windows'. |
| 120 | ;; We are now capable of resizing the mini-windows, so give the | ||
| 121 | ;; variable its advertised default value (it starts as nil, see | ||
| 122 | ;; xdisp.c). | ||
| 123 | (setq resize-mini-windows 'grow-only) | ||
| 120 | (setq load-source-file-function 'load-with-code-conversion) | 124 | (setq load-source-file-function 'load-with-code-conversion) |
| 121 | (load "files") | 125 | (load "files") |
| 122 | 126 | ||
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 70b0f232ce6..10ba5b38031 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -4582,6 +4582,8 @@ Argument MIME is non-nil if this is a mime message." | |||
| 4582 | (list armor-start (- (point-max) after-end) mime | 4582 | (list armor-start (- (point-max) after-end) mime |
| 4583 | armor-end-regexp))) | 4583 | armor-end-regexp))) |
| 4584 | 4584 | ||
| 4585 | (declare-function rmail-mime-entity-truncated "rmailmm" (entity)) | ||
| 4586 | |||
| 4585 | ;; Should this have a key-binding, or be in a menu? | 4587 | ;; Should this have a key-binding, or be in a menu? |
| 4586 | ;; There doesn't really seem to be an appropriate menu. | 4588 | ;; There doesn't really seem to be an appropriate menu. |
| 4587 | ;; Eg the edit command is not in a menu either. | 4589 | ;; Eg the edit command is not in a menu either. |
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 0557214fe24..6281d7e5453 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -192,7 +192,7 @@ | |||
| 192 | :enable (menu-bar-non-minibuffer-window-p) | 192 | :enable (menu-bar-non-minibuffer-window-p) |
| 193 | :help "Read an existing file into an Emacs buffer")) | 193 | :help "Read an existing file into an Emacs buffer")) |
| 194 | (bindings--define-key menu [new-file] | 194 | (bindings--define-key menu [new-file] |
| 195 | '(menu-item "New File..." find-file | 195 | '(menu-item "Visit New File..." find-file |
| 196 | :enable (menu-bar-non-minibuffer-window-p) | 196 | :enable (menu-bar-non-minibuffer-window-p) |
| 197 | :help "Specify a new file's name, to edit the file")) | 197 | :help "Specify a new file's name, to edit the file")) |
| 198 | 198 | ||
diff --git a/lisp/midnight.el b/lisp/midnight.el index 0e68eb923cd..878c5a7f71f 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el | |||
| @@ -53,8 +53,12 @@ the time when it is run.") | |||
| 53 | "Non-nil means run `midnight-hook' at midnight." | 53 | "Non-nil means run `midnight-hook' at midnight." |
| 54 | :global t | 54 | :global t |
| 55 | :initialize #'custom-initialize-default | 55 | :initialize #'custom-initialize-default |
| 56 | (if midnight-mode (timer-activate midnight-timer) | 56 | ;; Disable first, since the ':initialize' function above already |
| 57 | (cancel-timer midnight-timer))) | 57 | ;; starts the timer when the mode is turned on for the first time, |
| 58 | ;; via setting 'midnight-delay', which calls 'midnight-delay-set', | ||
| 59 | ;; which starts the timer. | ||
| 60 | (when (timerp midnight-timer) (cancel-timer midnight-timer)) | ||
| 61 | (if midnight-mode (timer-activate midnight-timer))) | ||
| 58 | 62 | ||
| 59 | ;;; time conversion | 63 | ;;; time conversion |
| 60 | 64 | ||
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ecac0aeb135..6540059b965 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -1835,7 +1835,7 @@ variables.") | |||
| 1835 | 'display-buffer-below-selected)) | 1835 | 'display-buffer-below-selected)) |
| 1836 | ,(if temp-buffer-resize-mode | 1836 | ,(if temp-buffer-resize-mode |
| 1837 | '(window-height . resize-temp-buffer-window) | 1837 | '(window-height . resize-temp-buffer-window) |
| 1838 | '(window-height . shrink-window-if-larger-than-buffer)) | 1838 | '(window-height . fit-window-to-buffer)) |
| 1839 | ,(when temp-buffer-resize-mode | 1839 | ,(when temp-buffer-resize-mode |
| 1840 | '(preserve-size . (nil . t)))) | 1840 | '(preserve-size . (nil . t)))) |
| 1841 | nil | 1841 | nil |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index e9431325333..2c8ff79763f 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -783,8 +783,13 @@ size, and full-buffer size." | |||
| 783 | (url-expand-file-name url (concat (car base) (cadr base)))))) | 783 | (url-expand-file-name url (concat (car base) (cadr base)))))) |
| 784 | 784 | ||
| 785 | (defun shr-ensure-newline () | 785 | (defun shr-ensure-newline () |
| 786 | (unless (zerop (current-column)) | 786 | (unless (bobp) |
| 787 | (insert "\n"))) | 787 | (let ((prefix (get-text-property (line-beginning-position) |
| 788 | 'shr-prefix-length))) | ||
| 789 | (unless (or (zerop (current-column)) | ||
| 790 | (and prefix | ||
| 791 | (= prefix (- (point) (line-beginning-position))))) | ||
| 792 | (insert "\n"))))) | ||
| 788 | 793 | ||
| 789 | (defun shr-ensure-paragraph () | 794 | (defun shr-ensure-paragraph () |
| 790 | (unless (bobp) | 795 | (unless (bobp) |
| @@ -812,6 +817,10 @@ size, and full-buffer size." | |||
| 812 | (line-end-position)) | 817 | (line-end-position)) |
| 813 | (line-end-position))))) | 818 | (line-end-position))))) |
| 814 | (delete-region (match-beginning 0) (match-end 0))) | 819 | (delete-region (match-beginning 0) (match-end 0))) |
| 820 | ;; We have a single blank line. | ||
| 821 | ((and (eolp) (bolp)) | ||
| 822 | (insert "\n")) | ||
| 823 | ;; Insert new paragraph. | ||
| 815 | (t | 824 | (t |
| 816 | (insert "\n\n")))))) | 825 | (insert "\n\n")))))) |
| 817 | 826 | ||
| @@ -915,7 +924,8 @@ If EXTERNAL, browse the URL using `shr-external-browser'." | |||
| 915 | (let ((param (match-string 4 data)) | 924 | (let ((param (match-string 4 data)) |
| 916 | (payload (url-unhex-string (match-string 5 data)))) | 925 | (payload (url-unhex-string (match-string 5 data)))) |
| 917 | (when (string-match "^.*\\(;[ \t]*base64\\)$" param) | 926 | (when (string-match "^.*\\(;[ \t]*base64\\)$" param) |
| 918 | (setq payload (base64-decode-string payload))) | 927 | (setq payload (ignore-errors |
| 928 | (base64-decode-string payload)))) | ||
| 919 | payload))) | 929 | payload))) |
| 920 | 930 | ||
| 921 | ;; Behind display-graphic-p test. | 931 | ;; Behind display-graphic-p test. |
| @@ -1206,7 +1216,7 @@ ones, in case fg and bg are nil." | |||
| 1206 | (shr-ensure-paragraph)) | 1216 | (shr-ensure-paragraph)) |
| 1207 | 1217 | ||
| 1208 | (defun shr-tag-div (dom) | 1218 | (defun shr-tag-div (dom) |
| 1209 | (shr-ensure-paragraph) | 1219 | (shr-ensure-newline) |
| 1210 | (shr-generic dom) | 1220 | (shr-generic dom) |
| 1211 | (shr-ensure-newline)) | 1221 | (shr-ensure-newline)) |
| 1212 | 1222 | ||
| @@ -1470,6 +1480,10 @@ The preference is a float determined from `shr-prefer-media-type'." | |||
| 1470 | (shr-ensure-paragraph) | 1480 | (shr-ensure-paragraph) |
| 1471 | (let ((shr-list-mode 'ul)) | 1481 | (let ((shr-list-mode 'ul)) |
| 1472 | (shr-generic dom)) | 1482 | (shr-generic dom)) |
| 1483 | ;; If we end on an empty <li>, then make sure we really end on a new | ||
| 1484 | ;; paragraph. | ||
| 1485 | (unless (bolp) | ||
| 1486 | (insert "\n")) | ||
| 1473 | (shr-ensure-paragraph)) | 1487 | (shr-ensure-paragraph)) |
| 1474 | 1488 | ||
| 1475 | (defun shr-tag-ol (dom) | 1489 | (defun shr-tag-ol (dom) |
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 74024644966..12c9f419555 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el | |||
| @@ -538,7 +538,7 @@ This is a specialization of `soap-encode-value' for | |||
| 538 | (base64Binary | 538 | (base64Binary |
| 539 | (unless (stringp value) | 539 | (unless (stringp value) |
| 540 | (error "Not a string value for base64Binary")) | 540 | (error "Not a string value for base64Binary")) |
| 541 | (base64-encode-string (encode-coding-string value 'utf-8))) | 541 | (base64-encode-string value)) |
| 542 | 542 | ||
| 543 | (otherwise | 543 | (otherwise |
| 544 | (error "Don't know how to encode %s for type %s" | 544 | (error "Don't know how to encode %s for type %s" |
| @@ -682,7 +682,7 @@ This is a specialization of `soap-decode-type' for | |||
| 682 | decimal byte float double duration) | 682 | decimal byte float double duration) |
| 683 | (string-to-number (car contents))) | 683 | (string-to-number (car contents))) |
| 684 | (boolean (string= (downcase (car contents)) "true")) | 684 | (boolean (string= (downcase (car contents)) "true")) |
| 685 | (base64Binary (decode-coding-string (base64-decode-string (car contents)) 'utf-8)) | 685 | (base64Binary (base64-decode-string (car contents))) |
| 686 | (anyType (soap-decode-any-type node)) | 686 | (anyType (soap-decode-any-type node)) |
| 687 | (Array (soap-decode-array node)))))) | 687 | (Array (soap-decode-array node)))))) |
| 688 | 688 | ||
| @@ -3096,7 +3096,11 @@ the SOAP request. | |||
| 3096 | NOTE: The SOAP service provider should document the available | 3096 | NOTE: The SOAP service provider should document the available |
| 3097 | operations and their parameters for the service. You can also | 3097 | operations and their parameters for the service. You can also |
| 3098 | use the `soap-inspect' function to browse the available | 3098 | use the `soap-inspect' function to browse the available |
| 3099 | operations in a WSDL document." | 3099 | operations in a WSDL document. |
| 3100 | |||
| 3101 | NOTE: `soap-invoke' base64-decodes xsd:base64Binary return values | ||
| 3102 | into unibyte strings; these byte-strings require further | ||
| 3103 | interpretation by the caller." | ||
| 3100 | (apply #'soap-invoke-internal nil nil wsdl service operation-name parameters)) | 3104 | (apply #'soap-invoke-internal nil nil wsdl service operation-name parameters)) |
| 3101 | 3105 | ||
| 3102 | (defun soap-invoke-async (callback cbargs wsdl service operation-name | 3106 | (defun soap-invoke-async (callback cbargs wsdl service operation-name |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 1f43747c094..9fa46109a5a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -520,6 +520,7 @@ as given in your `~/.profile'." | |||
| 520 | (defcustom tramp-remote-process-environment | 520 | (defcustom tramp-remote-process-environment |
| 521 | `("TMOUT=0" "LC_CTYPE=''" | 521 | `("TMOUT=0" "LC_CTYPE=''" |
| 522 | ,(format "TERM=%s" tramp-terminal-type) | 522 | ,(format "TERM=%s" tramp-terminal-type) |
| 523 | "EMACS=t" ;; Deprecated; remove this line once Bash 4.4-or-later is common. | ||
| 523 | ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) | 524 | ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) |
| 524 | "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" | 525 | "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" |
| 525 | "autocorrect=" "correct=") | 526 | "autocorrect=" "correct=") |
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 3b9f44e55a0..f458904c87a 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -1407,7 +1407,7 @@ been put there by c-put-char-property. POINT remains unchanged." | |||
| 1407 | (c-state-cache-good-pos c-state-cache-good-pos) | 1407 | (c-state-cache-good-pos c-state-cache-good-pos) |
| 1408 | ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache)) | 1408 | ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache)) |
| 1409 | ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit) | 1409 | ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit) |
| 1410 | ;(c-state-semi-nonlit-pos-cache (copy-treec c-state-semi-nonlit-pos-cache)) | 1410 | ;(c-state-semi-nonlit-pos-cache (copy-tree c-state-semi-nonlit-pos-cache)) |
| 1411 | ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache) | 1411 | ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache) |
| 1412 | (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert)) | 1412 | (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert)) |
| 1413 | (c-state-point-min c-state-point-min) | 1413 | (c-state-point-min c-state-point-min) |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index b7ab408f744..0b15a283090 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1702,6 +1702,14 @@ Returns the compilation buffer created." | |||
| 1702 | (list "TERM=emacs" | 1702 | (list "TERM=emacs" |
| 1703 | (format "TERMCAP=emacs:co#%d:tc=unknown:" | 1703 | (format "TERMCAP=emacs:co#%d:tc=unknown:" |
| 1704 | (window-width)))) | 1704 | (window-width)))) |
| 1705 | |||
| 1706 | ;; Set the EMACS variable, but | ||
| 1707 | ;; don't override users' setting of $EMACS. | ||
| 1708 | ;; Remove this hack once Bash 4.4-or-later is common, | ||
| 1709 | ;; since it can break 'configure'. | ||
| 1710 | (unless (getenv "EMACS") | ||
| 1711 | (list "EMACS=t")) | ||
| 1712 | |||
| 1705 | (list (format "INSIDE_EMACS=%s,compile" emacs-version)) | 1713 | (list (format "INSIDE_EMACS=%s,compile" emacs-version)) |
| 1706 | (copy-sequence process-environment)))) | 1714 | (copy-sequence process-environment)))) |
| 1707 | (set (make-local-variable 'compilation-arguments) | 1715 | (set (make-local-variable 'compilation-arguments) |
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 9e175a20e22..fc4501d0cbe 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -575,7 +575,7 @@ It can be quoted, or be inside a quoted form." | |||
| 575 | " " (cadr table-etc))) | 575 | " " (cadr table-etc))) |
| 576 | (cddr table-etc))))))))) | 576 | (cddr table-etc))))))))) |
| 577 | 577 | ||
| 578 | (defun lisp-completion-at-point (_predicate) | 578 | (defun lisp-completion-at-point (&optional _predicate) |
| 579 | (declare (obsolete elisp-completion-at-point "25.1")) | 579 | (declare (obsolete elisp-completion-at-point "25.1")) |
| 580 | (elisp-completion-at-point)) | 580 | (elisp-completion-at-point)) |
| 581 | 581 | ||
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el index 0e0714e27ed..d857bfd88c3 100644 --- a/lisp/progmodes/idlw-toolbar.el +++ b/lisp/progmodes/idlw-toolbar.el | |||
| @@ -439,7 +439,7 @@ static char * file[] = { | |||
| 439 | \" \", | 439 | \" \", |
| 440 | \" \", | 440 | \" \", |
| 441 | \" \"};") | 441 | \" \"};") |
| 442 | "The Cont icon.") | 442 | "The Cont icon.") |
| 443 | 443 | ||
| 444 | (defvar idlwave-toolbar-to-here-icon | 444 | (defvar idlwave-toolbar-to-here-icon |
| 445 | (idlwave-toolbar-make-button | 445 | (idlwave-toolbar-make-button |
| @@ -918,7 +918,7 @@ static char * file[] = { | |||
| 918 | (help (aref x 3)) | 918 | (help (aref x 3)) |
| 919 | (key (vector 'tool-bar func)) | 919 | (key (vector 'tool-bar func)) |
| 920 | (def (list 'menu-item | 920 | (def (list 'menu-item |
| 921 | "a" | 921 | "" |
| 922 | func | 922 | func |
| 923 | :image (symbol-value icon) | 923 | :image (symbol-value icon) |
| 924 | :visible show | 924 | :visible show |
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 718b33932ed..3f25a0c0647 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el | |||
| @@ -49,53 +49,6 @@ | |||
| 49 | map) | 49 | map) |
| 50 | "Keymap used for programming modes.") | 50 | "Keymap used for programming modes.") |
| 51 | 51 | ||
| 52 | (defvar prog-indentation-context nil | ||
| 53 | "When non-nil, provides context for indenting embedded code chunks. | ||
| 54 | |||
| 55 | There are languages where part of the code is actually written in | ||
| 56 | a sub language, e.g., a Yacc/Bison or ANTLR grammar also consists | ||
| 57 | of plain C code. This variable enables the major mode of the | ||
| 58 | main language to use the indentation engine of the sub-mode for | ||
| 59 | lines in code chunks written in the sub-mode's language. | ||
| 60 | |||
| 61 | When a major mode of such a main language decides to delegate the | ||
| 62 | indentation of a line/region to the indentation engine of the sub | ||
| 63 | mode, it should bind this variable to non-nil around the call. | ||
| 64 | |||
| 65 | The non-nil value should be a list of the form: | ||
| 66 | |||
| 67 | (FIRST-COLUMN (START . END) PREVIOUS-CHUNKS) | ||
| 68 | |||
| 69 | FIRST-COLUMN is the column the indentation engine of the sub-mode | ||
| 70 | should use for top-level language constructs inside the code | ||
| 71 | chunk (instead of 0). | ||
| 72 | |||
| 73 | START and END specify the region of the code chunk. END can be | ||
| 74 | nil, which stands for the value of `point-max'. The function | ||
| 75 | `prog-widen' uses this to restore restrictions imposed by the | ||
| 76 | sub-mode's indentation engine. | ||
| 77 | |||
| 78 | PREVIOUS-CHUNKS, if non-nil, provides the indentation engine of | ||
| 79 | the sub-mode with the virtual context of the code chunk. Valid | ||
| 80 | values are: | ||
| 81 | |||
| 82 | - A string containing text which the indentation engine can | ||
| 83 | consider as standing in front of the code chunk. To cache the | ||
| 84 | string's calculated syntactic information for repeated calls | ||
| 85 | with the same string, the sub-mode can add text-properties to | ||
| 86 | the string. | ||
| 87 | |||
| 88 | A typical use case is for grammars with code chunks which are | ||
| 89 | to be indented like function bodies -- the string would contain | ||
| 90 | the corresponding function preamble. | ||
| 91 | |||
| 92 | - A function, to be called with the start position of the current | ||
| 93 | chunk. It should return either the region of the previous chunk | ||
| 94 | as (PREV-START . PREV-END), or nil if there is no previous chunk. | ||
| 95 | |||
| 96 | A typical use case are literate programming sources -- the | ||
| 97 | function would successively return the previous code chunks.") | ||
| 98 | |||
| 99 | (defun prog-indent-sexp (&optional defun) | 52 | (defun prog-indent-sexp (&optional defun) |
| 100 | "Indent the expression after point. | 53 | "Indent the expression after point. |
| 101 | When interactively called with prefix, indent the enclosing defun | 54 | When interactively called with prefix, indent the enclosing defun |
| @@ -109,27 +62,6 @@ instead." | |||
| 109 | (end (progn (forward-sexp 1) (point)))) | 62 | (end (progn (forward-sexp 1) (point)))) |
| 110 | (indent-region start end nil)))) | 63 | (indent-region start end nil)))) |
| 111 | 64 | ||
| 112 | (defun prog-first-column () | ||
| 113 | "Return the indentation column normally used for top-level constructs." | ||
| 114 | (or (car prog-indentation-context) 0)) | ||
| 115 | |||
| 116 | (defun prog-widen () | ||
| 117 | "Remove restrictions (narrowing) from current code chunk or buffer. | ||
| 118 | This function should be used instead of `widen' in any function used | ||
| 119 | by the indentation engine to make it respect the value of | ||
| 120 | `prog-indentation-context'. | ||
| 121 | |||
| 122 | This function (like `widen') is useful inside a | ||
| 123 | `save-restriction' to make the indentation correctly work when | ||
| 124 | narrowing is in effect." | ||
| 125 | (let ((chunk (cadr prog-indentation-context))) | ||
| 126 | (if chunk | ||
| 127 | ;; No call to `widen' is necessary here, as narrow-to-region | ||
| 128 | ;; changes (not just narrows) the existing restrictions | ||
| 129 | (narrow-to-region (car chunk) (or (cdr chunk) (point-max))) | ||
| 130 | (widen)))) | ||
| 131 | |||
| 132 | |||
| 133 | (defvar-local prettify-symbols-alist nil | 65 | (defvar-local prettify-symbols-alist nil |
| 134 | "Alist of symbol prettifications. | 66 | "Alist of symbol prettifications. |
| 135 | Each element looks like (SYMBOL . CHARACTER), where the symbol | 67 | Each element looks like (SYMBOL . CHARACTER), where the symbol |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5aeefe47a54..90097df7ef1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -283,18 +283,6 @@ | |||
| 283 | :version "24.3" | 283 | :version "24.3" |
| 284 | :link '(emacs-commentary-link "python")) | 284 | :link '(emacs-commentary-link "python")) |
| 285 | 285 | ||
| 286 | |||
| 287 | ;;; 24.x Compat | ||
| 288 | |||
| 289 | |||
| 290 | (unless (fboundp 'prog-widen) | ||
| 291 | (defun prog-widen () | ||
| 292 | (widen))) | ||
| 293 | |||
| 294 | (unless (fboundp 'prog-first-column) | ||
| 295 | (defun prog-first-column () | ||
| 296 | 0)) | ||
| 297 | |||
| 298 | 286 | ||
| 299 | ;;; Bindings | 287 | ;;; Bindings |
| 300 | 288 | ||
| @@ -761,7 +749,7 @@ work on `python-indent-calculate-indentation' instead." | |||
| 761 | (interactive) | 749 | (interactive) |
| 762 | (save-excursion | 750 | (save-excursion |
| 763 | (save-restriction | 751 | (save-restriction |
| 764 | (prog-widen) | 752 | (widen) |
| 765 | (goto-char (point-min)) | 753 | (goto-char (point-min)) |
| 766 | (let ((block-end)) | 754 | (let ((block-end)) |
| 767 | (while (and (not block-end) | 755 | (while (and (not block-end) |
| @@ -860,7 +848,7 @@ keyword | |||
| 860 | - Point is on a line starting a dedenter block. | 848 | - Point is on a line starting a dedenter block. |
| 861 | - START is the position where the dedenter block starts." | 849 | - START is the position where the dedenter block starts." |
| 862 | (save-restriction | 850 | (save-restriction |
| 863 | (prog-widen) | 851 | (widen) |
| 864 | (let ((ppss (save-excursion | 852 | (let ((ppss (save-excursion |
| 865 | (beginning-of-line) | 853 | (beginning-of-line) |
| 866 | (syntax-ppss)))) | 854 | (syntax-ppss)))) |
| @@ -1007,10 +995,10 @@ current context or a list of integers. The latter case is only | |||
| 1007 | happening for :at-dedenter-block-start context since the | 995 | happening for :at-dedenter-block-start context since the |
| 1008 | possibilities can be narrowed to specific indentation points." | 996 | possibilities can be narrowed to specific indentation points." |
| 1009 | (save-restriction | 997 | (save-restriction |
| 1010 | (prog-widen) | 998 | (widen) |
| 1011 | (save-excursion | 999 | (save-excursion |
| 1012 | (pcase (python-indent-context) | 1000 | (pcase (python-indent-context) |
| 1013 | (`(:no-indent . ,_) (prog-first-column)) ; usually 0 | 1001 | (`(:no-indent . ,_) 0) |
| 1014 | (`(,(or :after-line | 1002 | (`(,(or :after-line |
| 1015 | :after-comment | 1003 | :after-comment |
| 1016 | :inside-string | 1004 | :inside-string |
| @@ -1048,7 +1036,7 @@ possibilities can be narrowed to specific indentation points." | |||
| 1048 | (let ((opening-block-start-points | 1036 | (let ((opening-block-start-points |
| 1049 | (python-info-dedenter-opening-block-positions))) | 1037 | (python-info-dedenter-opening-block-positions))) |
| 1050 | (if (not opening-block-start-points) | 1038 | (if (not opening-block-start-points) |
| 1051 | (prog-first-column) ; if not found default to first column | 1039 | 0 ; if not found default to first column |
| 1052 | (mapcar (lambda (pos) | 1040 | (mapcar (lambda (pos) |
| 1053 | (save-excursion | 1041 | (save-excursion |
| 1054 | (goto-char pos) | 1042 | (goto-char pos) |
| @@ -1066,7 +1054,7 @@ integers. Levels are returned in ascending order, and in the | |||
| 1066 | case INDENTATION is a list, this order is enforced." | 1054 | case INDENTATION is a list, this order is enforced." |
| 1067 | (if (listp indentation) | 1055 | (if (listp indentation) |
| 1068 | (sort (copy-sequence indentation) #'<) | 1056 | (sort (copy-sequence indentation) #'<) |
| 1069 | (nconc (number-sequence (prog-first-column) (1- indentation) | 1057 | (nconc (number-sequence 0 (1- indentation) |
| 1070 | python-indent-offset) | 1058 | python-indent-offset) |
| 1071 | (list indentation)))) | 1059 | (list indentation)))) |
| 1072 | 1060 | ||
| @@ -1091,7 +1079,7 @@ minimum." | |||
| 1091 | (python-indent--previous-level levels (current-indentation)) | 1079 | (python-indent--previous-level levels (current-indentation)) |
| 1092 | (if levels | 1080 | (if levels |
| 1093 | (apply #'max levels) | 1081 | (apply #'max levels) |
| 1094 | (prog-first-column))))) | 1082 | 0)))) |
| 1095 | 1083 | ||
| 1096 | (defun python-indent-line (&optional previous) | 1084 | (defun python-indent-line (&optional previous) |
| 1097 | "Internal implementation of `python-indent-line-function'. | 1085 | "Internal implementation of `python-indent-line-function'. |
| @@ -4479,7 +4467,7 @@ Optional argument INCLUDE-TYPE indicates to include the type of the defun. | |||
| 4479 | This function can be used as the value of `add-log-current-defun-function' | 4467 | This function can be used as the value of `add-log-current-defun-function' |
| 4480 | since it returns nil if point is not inside a defun." | 4468 | since it returns nil if point is not inside a defun." |
| 4481 | (save-restriction | 4469 | (save-restriction |
| 4482 | (prog-widen) | 4470 | (widen) |
| 4483 | (save-excursion | 4471 | (save-excursion |
| 4484 | (end-of-line 1) | 4472 | (end-of-line 1) |
| 4485 | (let ((names) | 4473 | (let ((names) |
| @@ -4662,7 +4650,7 @@ likely an invalid python file." | |||
| 4662 | (let ((point (python-info-dedenter-opening-block-position))) | 4650 | (let ((point (python-info-dedenter-opening-block-position))) |
| 4663 | (when point | 4651 | (when point |
| 4664 | (save-restriction | 4652 | (save-restriction |
| 4665 | (prog-widen) | 4653 | (widen) |
| 4666 | (message "Closes %s" (save-excursion | 4654 | (message "Closes %s" (save-excursion |
| 4667 | (goto-char point) | 4655 | (goto-char point) |
| 4668 | (buffer-substring | 4656 | (buffer-substring |
| @@ -4683,7 +4671,7 @@ statement." | |||
| 4683 | With optional argument LINE-NUMBER, check that line instead." | 4671 | With optional argument LINE-NUMBER, check that line instead." |
| 4684 | (save-excursion | 4672 | (save-excursion |
| 4685 | (save-restriction | 4673 | (save-restriction |
| 4686 | (prog-widen) | 4674 | (widen) |
| 4687 | (when line-number | 4675 | (when line-number |
| 4688 | (python-util-goto-line line-number)) | 4676 | (python-util-goto-line line-number)) |
| 4689 | (while (and (not (eobp)) | 4677 | (while (and (not (eobp)) |
| @@ -4699,7 +4687,7 @@ With optional argument LINE-NUMBER, check that line instead." | |||
| 4699 | Optional argument LINE-NUMBER forces the line number to check against." | 4687 | Optional argument LINE-NUMBER forces the line number to check against." |
| 4700 | (save-excursion | 4688 | (save-excursion |
| 4701 | (save-restriction | 4689 | (save-restriction |
| 4702 | (prog-widen) | 4690 | (widen) |
| 4703 | (when line-number | 4691 | (when line-number |
| 4704 | (python-util-goto-line line-number)) | 4692 | (python-util-goto-line line-number)) |
| 4705 | (when (python-info-line-ends-backslash-p) | 4693 | (when (python-info-line-ends-backslash-p) |
| @@ -4716,7 +4704,7 @@ When current line is continuation of another return the point | |||
| 4716 | where the continued line ends." | 4704 | where the continued line ends." |
| 4717 | (save-excursion | 4705 | (save-excursion |
| 4718 | (save-restriction | 4706 | (save-restriction |
| 4719 | (prog-widen) | 4707 | (widen) |
| 4720 | (let* ((context-type (progn | 4708 | (let* ((context-type (progn |
| 4721 | (back-to-indentation) | 4709 | (back-to-indentation) |
| 4722 | (python-syntax-context-type))) | 4710 | (python-syntax-context-type))) |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 36c1aed529e..972bf99145e 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -368,7 +368,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 368 | (exp (exp1) (exp "," exp) (exp "=" exp) | 368 | (exp (exp1) (exp "," exp) (exp "=" exp) |
| 369 | (id " @ " exp)) | 369 | (id " @ " exp)) |
| 370 | (exp1 (exp2) (exp2 "?" exp1 ":" exp1)) | 370 | (exp1 (exp2) (exp2 "?" exp1 ":" exp1)) |
| 371 | (exp2 (exp3) (exp3 "." exp2)) | 371 | (exp2 (exp3) (exp3 "." exp3)) |
| 372 | (exp3 ("def" insts "end") | 372 | (exp3 ("def" insts "end") |
| 373 | ("begin" insts-rescue-insts "end") | 373 | ("begin" insts-rescue-insts "end") |
| 374 | ("do" insts "end") | 374 | ("do" insts "end") |
| @@ -388,7 +388,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 388 | (cases (exp "then" insts) | 388 | (cases (exp "then" insts) |
| 389 | (cases "when" cases) (insts "else" insts)) | 389 | (cases "when" cases) (insts "else" insts)) |
| 390 | (expseq (exp) );;(expseq "," expseq) | 390 | (expseq (exp) );;(expseq "," expseq) |
| 391 | (hashvals (id "=>" exp1) (hashvals "," hashvals)) | 391 | (hashvals (exp1 "=>" exp1) (hashvals "," hashvals)) |
| 392 | (insts-rescue-insts (insts) | 392 | (insts-rescue-insts (insts) |
| 393 | (insts-rescue-insts "rescue" insts-rescue-insts) | 393 | (insts-rescue-insts "rescue" insts-rescue-insts) |
| 394 | (insts-rescue-insts "ensure" insts-rescue-insts)) | 394 | (insts-rescue-insts "ensure" insts-rescue-insts)) |
| @@ -406,17 +406,18 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 406 | '((right "=") | 406 | '((right "=") |
| 407 | (right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" | 407 | (right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" |
| 408 | "<<=" ">>=" "&&=" "||=") | 408 | "<<=" ">>=" "&&=" "||=") |
| 409 | (left ".." "...") | 409 | (nonassoc ".." "...") |
| 410 | (left "+" "-") | ||
| 411 | (left "*" "/" "%" "**") | ||
| 412 | (left "&&" "||") | 410 | (left "&&" "||") |
| 413 | (left "^" "&" "|") | ||
| 414 | (nonassoc "<=>") | 411 | (nonassoc "<=>") |
| 415 | (nonassoc ">" ">=" "<" "<=") | ||
| 416 | (nonassoc "==" "===" "!=") | 412 | (nonassoc "==" "===" "!=") |
| 417 | (nonassoc "=~" "!~") | 413 | (nonassoc "=~" "!~") |
| 414 | (nonassoc ">" ">=" "<" "<=") | ||
| 415 | (left "^" "&" "|") | ||
| 418 | (left "<<" ">>") | 416 | (left "<<" ">>") |
| 419 | (right ".")))))) | 417 | (left "+" "-") |
| 418 | (left "*" "/" "%") | ||
| 419 | (left "**") | ||
| 420 | (assoc ".")))))) | ||
| 420 | 421 | ||
| 421 | (defun ruby-smie--bosp () | 422 | (defun ruby-smie--bosp () |
| 422 | (save-excursion (skip-chars-backward " \t") | 423 | (save-excursion (skip-chars-backward " \t") |
| @@ -443,7 +444,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 443 | (member (save-excursion (ruby-smie--backward-token)) | 444 | (member (save-excursion (ruby-smie--backward-token)) |
| 444 | '("iuwu-mod" "and" "or"))) | 445 | '("iuwu-mod" "and" "or"))) |
| 445 | (save-excursion | 446 | (save-excursion |
| 446 | (forward-comment 1) | 447 | (forward-comment (point-max)) |
| 447 | (looking-at "&?\\.")))))) | 448 | (looking-at "&?\\.")))))) |
| 448 | 449 | ||
| 449 | (defun ruby-smie--redundant-do-p (&optional skip) | 450 | (defun ruby-smie--redundant-do-p (&optional skip) |
| @@ -629,19 +630,13 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 629 | ;; because when `.' is inside the line, the | 630 | ;; because when `.' is inside the line, the |
| 630 | ;; additional indentation from it looks out of place. | 631 | ;; additional indentation from it looks out of place. |
| 631 | ((smie-rule-parent-p ".") | 632 | ((smie-rule-parent-p ".") |
| 632 | (let (smie--parent) | 633 | ;; Traverse up the call chain until the parent is not `.', |
| 633 | (save-excursion | 634 | ;; or `.' at indentation, or at eol. |
| 634 | ;; Traverse up the parents until the parent is "." at | 635 | (while (and (not (ruby-smie--bosp)) |
| 635 | ;; indentation, or any other token. | 636 | (equal (nth 2 (smie-backward-sexp ".")) ".") |
| 636 | (while (and (let ((parent (smie-indent--parent))) | 637 | (not (ruby-smie--bosp))) |
| 637 | (goto-char (cadr parent)) | 638 | (forward-char -1)) |
| 638 | (save-excursion | 639 | (smie-indent-virtual)) |
| 639 | (unless (integerp (car parent)) (forward-char -1)) | ||
| 640 | (not (ruby-smie--bosp)))) | ||
| 641 | (progn | ||
| 642 | (setq smie--parent nil) | ||
| 643 | (smie-rule-parent-p ".")))) | ||
| 644 | (smie-rule-parent)))) | ||
| 645 | (t (smie-rule-parent)))))) | 640 | (t (smie-rule-parent)))))) |
| 646 | (`(:after . ,(or `"(" "[" "{")) | 641 | (`(:after . ,(or `"(" "[" "{")) |
| 647 | ;; FIXME: Shouldn't this be the default behavior of | 642 | ;; FIXME: Shouldn't this be the default behavior of |
| @@ -661,7 +656,9 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 661 | (`(:before . ".") | 656 | (`(:before . ".") |
| 662 | (if (smie-rule-sibling-p) | 657 | (if (smie-rule-sibling-p) |
| 663 | (and ruby-align-chained-calls 0) | 658 | (and ruby-align-chained-calls 0) |
| 664 | ruby-indent-level)) | 659 | (smie-backward-sexp ".") |
| 660 | (cons 'column (+ (current-column) | ||
| 661 | ruby-indent-level)))) | ||
| 665 | (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure")) | 662 | (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure")) |
| 666 | (smie-rule-parent)) | 663 | (smie-rule-parent)) |
| 667 | (`(:before . "when") | 664 | (`(:before . "when") |
| @@ -1377,7 +1374,7 @@ delimiter." | |||
| 1377 | (goto-char ruby-indent-point) | 1374 | (goto-char ruby-indent-point) |
| 1378 | (beginning-of-line) | 1375 | (beginning-of-line) |
| 1379 | (skip-syntax-forward " ") | 1376 | (skip-syntax-forward " ") |
| 1380 | (if (looking-at "\\.[^.]") | 1377 | (if (looking-at "\\.[^.]\\|&\\.") |
| 1381 | (+ indent ruby-indent-level) | 1378 | (+ indent ruby-indent-level) |
| 1382 | indent)))) | 1379 | indent)))) |
| 1383 | 1380 | ||
| @@ -2176,7 +2173,7 @@ See `font-lock-syntax-table'.") | |||
| 2176 | 'font-lock-string-face))) | 2173 | 'font-lock-string-face))) |
| 2177 | ;; Perl-ish keywords. | 2174 | ;; Perl-ish keywords. |
| 2178 | "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$" | 2175 | "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$" |
| 2179 | ;; Variables. | 2176 | ;; Singleton objects. |
| 2180 | (,(concat ruby-font-lock-keyword-beg-re | 2177 | (,(concat ruby-font-lock-keyword-beg-re |
| 2181 | "\\_<\\(nil\\|true\\|false\\)\\_>") | 2178 | "\\_<\\(nil\\|true\\|false\\)\\_>") |
| 2182 | 1 font-lock-constant-face) | 2179 | 1 font-lock-constant-face) |
| @@ -2184,7 +2181,7 @@ See `font-lock-syntax-table'.") | |||
| 2184 | ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" | 2181 | ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" |
| 2185 | (0 font-lock-builtin-face)) | 2182 | (0 font-lock-builtin-face)) |
| 2186 | ;; Symbols. | 2183 | ;; Symbols. |
| 2187 | ("\\(^\\|[^:]\\)\\(:@?\\(?:\\w\\|_\\)+\\)\\([!?=]\\)?" | 2184 | ("\\(^\\|[^:]\\)\\(:@\\{0,2\\}\\(?:\\sw\\|\\s_\\)+\\)" |
| 2188 | (2 font-lock-constant-face) | 2185 | (2 font-lock-constant-face) |
| 2189 | (3 (unless (and (eq (char-before (match-end 3)) ?=) | 2186 | (3 (unless (and (eq (char-before (match-end 3)) ?=) |
| 2190 | (eq (char-after (match-end 3)) ?>)) | 2187 | (eq (char-after (match-end 3)) ?>)) |
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 69e6a154ae5..feed0fb36d9 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -436,6 +436,8 @@ If SELECT is non-nil, select the target window." | |||
| 436 | ;;; XREF buffer (part of the UI) | 436 | ;;; XREF buffer (part of the UI) |
| 437 | 437 | ||
| 438 | ;; The xref buffer is used to display a set of xrefs. | 438 | ;; The xref buffer is used to display a set of xrefs. |
| 439 | (defconst xref-buffer-name "*xref*" | ||
| 440 | "The name of the buffer to show xrefs.") | ||
| 439 | 441 | ||
| 440 | (defmacro xref--with-dedicated-window (&rest body) | 442 | (defmacro xref--with-dedicated-window (&rest body) |
| 441 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) | 443 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) |
| @@ -470,6 +472,9 @@ If SELECT is non-nil, select the target window." | |||
| 470 | (xref--show-pos-in-buf marker buf select)) | 472 | (xref--show-pos-in-buf marker buf select)) |
| 471 | (user-error (message (error-message-string err))))) | 473 | (user-error (message (error-message-string err))))) |
| 472 | 474 | ||
| 475 | (defvar-local xref--window nil | ||
| 476 | "The original window this xref buffer was created from.") | ||
| 477 | |||
| 473 | (defun xref-show-location-at-point () | 478 | (defun xref-show-location-at-point () |
| 474 | "Display the source of xref at point in the appropriate window, if any." | 479 | "Display the source of xref at point in the appropriate window, if any." |
| 475 | (interactive) | 480 | (interactive) |
| @@ -500,9 +505,6 @@ If SELECT is non-nil, select the target window." | |||
| 500 | (back-to-indentation) | 505 | (back-to-indentation) |
| 501 | (get-text-property (point) 'xref-item))) | 506 | (get-text-property (point) 'xref-item))) |
| 502 | 507 | ||
| 503 | (defvar-local xref--window nil | ||
| 504 | "The original window this xref buffer was created from.") | ||
| 505 | |||
| 506 | (defun xref-goto-xref () | 508 | (defun xref-goto-xref () |
| 507 | "Jump to the xref on the current line and select its window." | 509 | "Jump to the xref on the current line and select its window." |
| 508 | (interactive) | 510 | (interactive) |
| @@ -624,9 +626,6 @@ references displayed in the current *xref* buffer." | |||
| 624 | (t | 626 | (t |
| 625 | (error "No %s xref" (if backward "previous" "next")))))) | 627 | (error "No %s xref" (if backward "previous" "next")))))) |
| 626 | 628 | ||
| 627 | (defconst xref-buffer-name "*xref*" | ||
| 628 | "The name of the buffer to show xrefs.") | ||
| 629 | |||
| 630 | (defvar xref--button-map | 629 | (defvar xref--button-map |
| 631 | (let ((map (make-sparse-keymap))) | 630 | (let ((map (make-sparse-keymap))) |
| 632 | (define-key map [(control ?m)] #'xref-goto-xref) | 631 | (define-key map [(control ?m)] #'xref-goto-xref) |
diff --git a/lisp/replace.el b/lisp/replace.el index 2c3aa9b0885..a2344d9f7e7 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -167,8 +167,6 @@ wants to replace FROM with TO." | |||
| 167 | ;; unavailable while preparing to dump. | 167 | ;; unavailable while preparing to dump. |
| 168 | (custom-reevaluate-setting 'query-replace-from-to-separator) | 168 | (custom-reevaluate-setting 'query-replace-from-to-separator) |
| 169 | (let* ((history-add-new-input nil) | 169 | (let* ((history-add-new-input nil) |
| 170 | (text-property-default-nonsticky | ||
| 171 | (cons '(separator . t) text-property-default-nonsticky)) | ||
| 172 | (separator | 170 | (separator |
| 173 | (when query-replace-from-to-separator | 171 | (when query-replace-from-to-separator |
| 174 | (propertize "\0" | 172 | (propertize "\0" |
| @@ -193,11 +191,18 @@ wants to replace FROM with TO." | |||
| 193 | ;; a region in order to specify the minibuffer input. | 191 | ;; a region in order to specify the minibuffer input. |
| 194 | ;; That should not clobber the region for the query-replace itself. | 192 | ;; That should not clobber the region for the query-replace itself. |
| 195 | (save-excursion | 193 | (save-excursion |
| 196 | (if regexp-flag | 194 | ;; The `with-current-buffer' ensures that the binding |
| 197 | (read-regexp prompt nil 'query-replace-from-to-history) | 195 | ;; for `text-property-default-nonsticky' isn't a buffer |
| 198 | (read-from-minibuffer | 196 | ;; local binding in the current buffer, which |
| 199 | prompt nil nil nil 'query-replace-from-to-history | 197 | ;; `read-from-minibuffer' wouldn't see. |
| 200 | (car (if regexp-flag regexp-search-ring search-ring)) t)))) | 198 | (with-current-buffer (window-buffer (minibuffer-window)) |
| 199 | (let ((text-property-default-nonsticky | ||
| 200 | (cons '(separator . t) text-property-default-nonsticky))) | ||
| 201 | (if regexp-flag | ||
| 202 | (read-regexp prompt nil 'query-replace-from-to-history) | ||
| 203 | (read-from-minibuffer | ||
| 204 | prompt nil nil nil 'query-replace-from-to-history | ||
| 205 | (car (if regexp-flag regexp-search-ring search-ring)) t)))))) | ||
| 201 | (to)) | 206 | (to)) |
| 202 | (if (and (zerop (length from)) query-replace-defaults) | 207 | (if (and (zerop (length from)) query-replace-defaults) |
| 203 | (cons (caar query-replace-defaults) | 208 | (cons (caar query-replace-defaults) |
| @@ -293,7 +298,8 @@ As each match is found, the user must type a character saying | |||
| 293 | what to do with it. For directions, type \\[help-command] at that time. | 298 | what to do with it. For directions, type \\[help-command] at that time. |
| 294 | 299 | ||
| 295 | In Transient Mark mode, if the mark is active, operate on the contents | 300 | In Transient Mark mode, if the mark is active, operate on the contents |
| 296 | of the region. Otherwise, operate from point to the end of the buffer. | 301 | of the region. Otherwise, operate from point to the end of the buffer's |
| 302 | accessible portion. | ||
| 297 | 303 | ||
| 298 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 304 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 299 | to pull the last incremental search string to the minibuffer | 305 | to pull the last incremental search string to the minibuffer |
| @@ -355,7 +361,8 @@ As each match is found, the user must type a character saying | |||
| 355 | what to do with it. For directions, type \\[help-command] at that time. | 361 | what to do with it. For directions, type \\[help-command] at that time. |
| 356 | 362 | ||
| 357 | In Transient Mark mode, if the mark is active, operate on the contents | 363 | In Transient Mark mode, if the mark is active, operate on the contents |
| 358 | of the region. Otherwise, operate from point to the end of the buffer. | 364 | of the region. Otherwise, operate from point to the end of the buffer's |
| 365 | accessible portion. | ||
| 359 | 366 | ||
| 360 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 367 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 361 | to pull the last incremental search regexp to the minibuffer | 368 | to pull the last incremental search regexp to the minibuffer |
| @@ -452,7 +459,8 @@ Use `\\#&' or `\\#N' if you want a number instead of a string. | |||
| 452 | In interactive use, `\\#' in itself stands for `replace-count'. | 459 | In interactive use, `\\#' in itself stands for `replace-count'. |
| 453 | 460 | ||
| 454 | In Transient Mark mode, if the mark is active, operate on the contents | 461 | In Transient Mark mode, if the mark is active, operate on the contents |
| 455 | of the region. Otherwise, operate from point to the end of the buffer. | 462 | of the region. Otherwise, operate from point to the end of the buffer's |
| 463 | accessible portion. | ||
| 456 | 464 | ||
| 457 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 465 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 458 | to pull the last incremental search regexp to the minibuffer | 466 | to pull the last incremental search regexp to the minibuffer |
| @@ -507,7 +515,8 @@ each successive replacement uses the next successive replacement string, | |||
| 507 | wrapping around from the last such string to the first. | 515 | wrapping around from the last such string to the first. |
| 508 | 516 | ||
| 509 | In Transient Mark mode, if the mark is active, operate on the contents | 517 | In Transient Mark mode, if the mark is active, operate on the contents |
| 510 | of the region. Otherwise, operate from point to the end of the buffer. | 518 | of the region. Otherwise, operate from point to the end of the buffer's |
| 519 | accessible portion. | ||
| 511 | 520 | ||
| 512 | Non-interactively, TO-STRINGS may be a list of replacement strings. | 521 | Non-interactively, TO-STRINGS may be a list of replacement strings. |
| 513 | 522 | ||
| @@ -573,7 +582,7 @@ replace backward. | |||
| 573 | Operates on the region between START and END (if both are nil, from point | 582 | Operates on the region between START and END (if both are nil, from point |
| 574 | to the end of the buffer). Interactively, if Transient Mark mode is | 583 | to the end of the buffer). Interactively, if Transient Mark mode is |
| 575 | enabled and the mark is active, operates on the contents of the region; | 584 | enabled and the mark is active, operates on the contents of the region; |
| 576 | otherwise from point to the end of the buffer. | 585 | otherwise from point to the end of the buffer's accessible portion. |
| 577 | 586 | ||
| 578 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 587 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 579 | to pull the last incremental search string to the minibuffer | 588 | to pull the last incremental search string to the minibuffer |
| @@ -620,7 +629,8 @@ regexp in `search-whitespace-regexp'. | |||
| 620 | This function is not affected by `replace-character-fold' | 629 | This function is not affected by `replace-character-fold' |
| 621 | 630 | ||
| 622 | In Transient Mark mode, if the mark is active, operate on the contents | 631 | In Transient Mark mode, if the mark is active, operate on the contents |
| 623 | of the region. Otherwise, operate from point to the end of the buffer. | 632 | of the region. Otherwise, operate from point to the end of the buffer's |
| 633 | accessible portion. | ||
| 624 | 634 | ||
| 625 | Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace | 635 | Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace |
| 626 | only matches surrounded by word boundaries. A negative prefix arg means | 636 | only matches surrounded by word boundaries. A negative prefix arg means |
diff --git a/lisp/simple.el b/lisp/simple.el index 84a1919bc01..2a81ee745cb 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -408,15 +408,19 @@ A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'." | |||
| 408 | (last-command-event ?\n) | 408 | (last-command-event ?\n) |
| 409 | ;; Don't auto-fill if we have a numeric argument. | 409 | ;; Don't auto-fill if we have a numeric argument. |
| 410 | (auto-fill-function (if arg nil auto-fill-function)) | 410 | (auto-fill-function (if arg nil auto-fill-function)) |
| 411 | (arg (prefix-numeric-value arg)) | ||
| 411 | (postproc | 412 | (postproc |
| 412 | ;; Do the rest in post-self-insert-hook, because we want to do it | 413 | ;; Do the rest in post-self-insert-hook, because we want to do it |
| 413 | ;; *before* other functions on that hook. | 414 | ;; *before* other functions on that hook. |
| 414 | (lambda () | 415 | (lambda () |
| 415 | (cl-assert (eq ?\n (char-before))) | 416 | ;; We are not going to insert any newlines if arg is |
| 417 | ;; non-positive. | ||
| 418 | (or (and (numberp arg) (<= arg 0)) | ||
| 419 | (cl-assert (eq ?\n (char-before)))) | ||
| 416 | ;; Mark the newline(s) `hard'. | 420 | ;; Mark the newline(s) `hard'. |
| 417 | (if use-hard-newlines | 421 | (if use-hard-newlines |
| 418 | (set-hard-newline-properties | 422 | (set-hard-newline-properties |
| 419 | (- (point) (prefix-numeric-value arg)) (point))) | 423 | (- (point) arg) (point))) |
| 420 | ;; If the newline leaves the previous line blank, and we | 424 | ;; If the newline leaves the previous line blank, and we |
| 421 | ;; have a left margin, delete that from the blank line. | 425 | ;; have a left margin, delete that from the blank line. |
| 422 | (save-excursion | 426 | (save-excursion |
| @@ -433,19 +437,21 @@ A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'." | |||
| 433 | (move-to-left-margin nil t))))) | 437 | (move-to-left-margin nil t))))) |
| 434 | (unwind-protect | 438 | (unwind-protect |
| 435 | (if (not interactive) | 439 | (if (not interactive) |
| 436 | ;; FIXME: For non-interactive uses, many calls actually just want | 440 | ;; FIXME: For non-interactive uses, many calls actually |
| 437 | ;; (insert "\n"), so maybe we should do just that, so as to avoid | 441 | ;; just want (insert "\n"), so maybe we should do just |
| 438 | ;; the risk of filling or running abbrevs unexpectedly. | 442 | ;; that, so as to avoid the risk of filling or running |
| 439 | (let ((post-self-insert-hook (list postproc))) | 443 | ;; abbrevs unexpectedly. |
| 440 | (self-insert-command (prefix-numeric-value arg))) | 444 | (let ((post-self-insert-hook (list postproc))) |
| 441 | (unwind-protect | 445 | (self-insert-command arg)) |
| 442 | (progn | 446 | (unwind-protect |
| 443 | (add-hook 'post-self-insert-hook postproc nil t) | 447 | (progn |
| 444 | (self-insert-command (prefix-numeric-value arg))) | 448 | (add-hook 'post-self-insert-hook postproc nil t) |
| 445 | ;; We first used let-binding to protect the hook, but that was naive | 449 | (self-insert-command arg)) |
| 446 | ;; since add-hook affects the symbol-default value of the variable, | 450 | ;; We first used let-binding to protect the hook, but that |
| 447 | ;; whereas the let-binding might only protect the buffer-local value. | 451 | ;; was naive since add-hook affects the symbol-default |
| 448 | (remove-hook 'post-self-insert-hook postproc t))) | 452 | ;; value of the variable, whereas the let-binding might |
| 453 | ;; only protect the buffer-local value. | ||
| 454 | (remove-hook 'post-self-insert-hook postproc t))) | ||
| 449 | (cl-assert (not (member postproc post-self-insert-hook))) | 455 | (cl-assert (not (member postproc post-self-insert-hook))) |
| 450 | (cl-assert (not (member postproc (default-value 'post-self-insert-hook)))))) | 456 | (cl-assert (not (member postproc (default-value 'post-self-insert-hook)))))) |
| 451 | nil) | 457 | nil) |
diff --git a/lisp/startup.el b/lisp/startup.el index a411891d1f6..536289c3891 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -1890,10 +1890,12 @@ we put it on this frame." | |||
| 1890 | (when frame | 1890 | (when frame |
| 1891 | (let* ((img (create-image (fancy-splash-image-file))) | 1891 | (let* ((img (create-image (fancy-splash-image-file))) |
| 1892 | (image-height (and img (cdr (image-size img nil frame)))) | 1892 | (image-height (and img (cdr (image-size img nil frame)))) |
| 1893 | ;; We test frame-height so that, if the frame is split | 1893 | ;; We test frame-height and not window-height so that, |
| 1894 | ;; by displaying a warning, that doesn't cause the normal | 1894 | ;; if the frame is split by displaying a warning, that |
| 1895 | ;; splash screen to be used. | 1895 | ;; doesn't cause the normal splash screen to be used. |
| 1896 | (frame-height (1- (frame-height frame)))) | 1896 | ;; We subtract 2 from frame-height to account for the |
| 1897 | ;; echo area and the mode line. | ||
| 1898 | (frame-height (- (frame-height frame) 2))) | ||
| 1897 | (> frame-height (+ image-height 19))))))) | 1899 | (> frame-height (+ image-height 19))))))) |
| 1898 | 1900 | ||
| 1899 | 1901 | ||
| @@ -1998,7 +2000,7 @@ To quit a partially entered command, type Control-g.\n") | |||
| 1998 | (insert " How to order printed manuals from the FSF\n") | 2000 | (insert " How to order printed manuals from the FSF\n") |
| 1999 | 2001 | ||
| 2000 | (insert "\nUseful tasks:\n") | 2002 | (insert "\nUseful tasks:\n") |
| 2001 | (insert-button "New File" | 2003 | (insert-button "Visit New File" |
| 2002 | 'action (lambda (_button) (call-interactively 'find-file)) | 2004 | 'action (lambda (_button) (call-interactively 'find-file)) |
| 2003 | 'follow-link t) | 2005 | 'follow-link t) |
| 2004 | (insert (substitute-command-keys | 2006 | (insert (substitute-command-keys |
| @@ -2075,7 +2077,7 @@ If you have no Meta key, you may instead type ESC followed by the character.)")) | |||
| 2075 | ;; Insert links to useful tasks | 2077 | ;; Insert links to useful tasks |
| 2076 | (insert "\nUseful tasks:\n") | 2078 | (insert "\nUseful tasks:\n") |
| 2077 | 2079 | ||
| 2078 | (insert-button "New File" | 2080 | (insert-button "Visit New File" |
| 2079 | 'action (lambda (_button) (call-interactively 'find-file)) | 2081 | 'action (lambda (_button) (call-interactively 'find-file)) |
| 2080 | 'follow-link t) | 2082 | 'follow-link t) |
| 2081 | (insert "\t\t\t") | 2083 | (insert "\t\t\t") |
diff --git a/lisp/term.el b/lisp/term.el index a2e01ed4a29..6fd3a5e6261 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -1454,6 +1454,13 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.") | |||
| 1454 | (format "TERMINFO=%s" data-directory) | 1454 | (format "TERMINFO=%s" data-directory) |
| 1455 | (format term-termcap-format "TERMCAP=" | 1455 | (format term-termcap-format "TERMCAP=" |
| 1456 | term-term-name term-height term-width) | 1456 | term-term-name term-height term-width) |
| 1457 | |||
| 1458 | ;; This is for backwards compatibility with Bash 4.3 and earlier. | ||
| 1459 | ;; Remove this hack once Bash 4.4-or-later is common, because | ||
| 1460 | ;; it breaks './configure' of some packages that expect it to | ||
| 1461 | ;; say where to find EMACS. | ||
| 1462 | (format "EMACS=%s (term:%s)" emacs-version term-protocol-version) | ||
| 1463 | |||
| 1457 | (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version) | 1464 | (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version) |
| 1458 | (format "LINES=%d" term-height) | 1465 | (format "LINES=%d" term-height) |
| 1459 | (format "COLUMNS=%d" term-width)) | 1466 | (format "COLUMNS=%d" term-width)) |
diff --git a/lisp/xml.el b/lisp/xml.el index 1802d04dfaf..414300cb402 100644 --- a/lisp/xml.el +++ b/lisp/xml.el | |||
| @@ -580,7 +580,7 @@ Return one of: | |||
| 580 | ;; However, if we're parsing incrementally, then we need to deal | 580 | ;; However, if we're parsing incrementally, then we need to deal |
| 581 | ;; with stray CDATA. | 581 | ;; with stray CDATA. |
| 582 | (let ((s (xml-parse-string))) | 582 | (let ((s (xml-parse-string))) |
| 583 | (when (string-empty-p s) | 583 | (when (zerop (length s)) |
| 584 | ;; We haven't consumed any input! We must throw an error in | 584 | ;; We haven't consumed any input! We must throw an error in |
| 585 | ;; order to prevent looping forever. | 585 | ;; order to prevent looping forever. |
| 586 | (error "XML: (Not Well-Formed) Could not parse: %s" | 586 | (error "XML: (Not Well-Formed) Could not parse: %s" |
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 5975e60272f..e52095789ba 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el | |||
| @@ -134,23 +134,35 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)." | |||
| 134 | (fdiff (- f (* 1.0 maxwrap dbig)))) | 134 | (fdiff (- f (* 1.0 maxwrap dbig)))) |
| 135 | (+ (truncate fdiff) (* maxwrap dbig)))))) | 135 | (+ (truncate fdiff) (* maxwrap dbig)))))) |
| 136 | 136 | ||
| 137 | (defun xterm-mouse--read-utf8-char (&optional prompt seconds) | 137 | (defcustom xterm-mouse-utf-8 nil |
| 138 | "Read an utf-8 encoded character from the current terminal. | 138 | "Non-nil if UTF-8 coordinates should be used to read mouse coordinates. |
| 139 | This function reads and returns an utf-8 encoded character of | 139 | Set this to non-nil if you are sure that your terminal |
| 140 | command input. If the user generates an event which is not a | 140 | understands UTF-8 coordinates, but not SGR coordinates." |
| 141 | character (i.e., a mouse click or function key event), read-char | 141 | :version "25.1" |
| 142 | signals an error. | 142 | :type 'boolean |
| 143 | 143 | :risky t | |
| 144 | The returned event may come directly from the user, or from a | 144 | :group 'xterm) |
| 145 | keyboard macro. It is not decoded by the keyboard's input coding | 145 | |
| 146 | system and always treated with an utf-8 input encoding. | 146 | (defun xterm-mouse--read-coordinate () |
| 147 | 147 | "Read a mouse coordinate from the current terminal. | |
| 148 | The optional arguments PROMPT and SECONDS work like in | 148 | If `xterm-mouse-utf-8' was non-nil when |
| 149 | `read-event'." | 149 | `turn-on-xterm-mouse-tracking-on-terminal' was called, reads the |
| 150 | (let ((tmp (keyboard-coding-system))) | 150 | coordinate as an UTF-8 code unit sequence; otherwise, reads a |
| 151 | (set-keyboard-coding-system 'utf-8) | 151 | single byte." |
| 152 | (prog1 (read-event prompt t seconds) | 152 | (let ((previous-keyboard-coding-system (keyboard-coding-system))) |
| 153 | (set-keyboard-coding-system tmp)))) | 153 | (unwind-protect |
| 154 | (progn | ||
| 155 | (set-keyboard-coding-system | ||
| 156 | (if (terminal-parameter nil 'xterm-mouse-utf-8) | ||
| 157 | 'utf-8-unix | ||
| 158 | ;; Use Latin-1 instead of no-conversion to avoid flicker | ||
| 159 | ;; due to `set-keyboard-coding-system' changing the meta | ||
| 160 | ;; mode. | ||
| 161 | 'latin-1)) | ||
| 162 | ;; Wait only a little; we assume that the entire escape sequence | ||
| 163 | ;; has already been sent when this function is called. | ||
| 164 | (read-char nil nil 0.1)) | ||
| 165 | (set-keyboard-coding-system previous-keyboard-coding-system)))) | ||
| 154 | 166 | ||
| 155 | ;; In default mode, each numeric parameter of XTerm's mouse report is | 167 | ;; In default mode, each numeric parameter of XTerm's mouse report is |
| 156 | ;; a single char, possibly encoded as utf-8. The actual numeric | 168 | ;; a single char, possibly encoded as utf-8. The actual numeric |
| @@ -170,7 +182,7 @@ The optional arguments PROMPT and SECONDS work like in | |||
| 170 | (<= ?0 c ?9)) | 182 | (<= ?0 c ?9)) |
| 171 | (setq n (+ (* 10 n) c (- ?0)))) | 183 | (setq n (+ (* 10 n) c (- ?0)))) |
| 172 | (cons n c)) | 184 | (cons n c)) |
| 173 | (cons (- (setq c (xterm-mouse--read-utf8-char)) 32) c)))) | 185 | (cons (- (setq c (xterm-mouse--read-coordinate)) 32) c)))) |
| 174 | 186 | ||
| 175 | ;; XTerm reports mouse events as | 187 | ;; XTerm reports mouse events as |
| 176 | ;; <EVENT-CODE> <X> <Y> in default mode, and | 188 | ;; <EVENT-CODE> <X> <Y> in default mode, and |
| @@ -314,6 +326,38 @@ down the SHIFT key while pressing the mouse button." | |||
| 314 | (mapc #'turn-off-xterm-mouse-tracking-on-terminal (terminal-list)) | 326 | (mapc #'turn-off-xterm-mouse-tracking-on-terminal (terminal-list)) |
| 315 | (setq mouse-position-function nil))) | 327 | (setq mouse-position-function nil))) |
| 316 | 328 | ||
| 329 | (defun xterm-mouse-tracking-enable-sequence () | ||
| 330 | "Return a control sequence to enable XTerm mouse tracking. | ||
| 331 | The returned control sequence enables basic mouse tracking, mouse | ||
| 332 | motion events and finally extended tracking on terminals that | ||
| 333 | support it. The following escape sequences are understood by | ||
| 334 | modern xterms: | ||
| 335 | |||
| 336 | \"\\e[?1000h\" \"Basic mouse mode\": Enables reports for mouse | ||
| 337 | clicks. There is a limit to the maximum row/column | ||
| 338 | position (<= 223), which can be reported in this | ||
| 339 | basic mode. | ||
| 340 | |||
| 341 | \"\\e[?1002h\" \"Mouse motion mode\": Enables reports for mouse | ||
| 342 | motion events during dragging operations. | ||
| 343 | |||
| 344 | \"\\e[?1005h\" \"UTF-8 coordinate extension\": Enables an | ||
| 345 | extension to the basic mouse mode, which uses UTF-8 | ||
| 346 | characters to overcome the 223 row/column limit. | ||
| 347 | This extension may conflict with non UTF-8 | ||
| 348 | applications or non UTF-8 locales. It is only | ||
| 349 | enabled when the option `xterm-mouse-utf-8' is | ||
| 350 | non-nil. | ||
| 351 | |||
| 352 | \"\\e[?1006h\" \"SGR coordinate extension\": Enables a newer | ||
| 353 | alternative extension to the basic mouse mode, which | ||
| 354 | overcomes the 223 row/column limit without the | ||
| 355 | drawbacks of the UTF-8 coordinate extension. | ||
| 356 | |||
| 357 | The two extension modes are mutually exclusive, where the last | ||
| 358 | given escape sequence takes precedence over the former." | ||
| 359 | (apply #'concat (xterm-mouse--tracking-sequence ?h))) | ||
| 360 | |||
| 317 | (defconst xterm-mouse-tracking-enable-sequence | 361 | (defconst xterm-mouse-tracking-enable-sequence |
| 318 | "\e[?1000h\e[?1002h\e[?1005h\e[?1006h" | 362 | "\e[?1000h\e[?1002h\e[?1005h\e[?1006h" |
| 319 | "Control sequence to enable xterm mouse tracking. | 363 | "Control sequence to enable xterm mouse tracking. |
| @@ -343,10 +387,34 @@ escape sequences are understood by modern xterms: | |||
| 343 | The two extension modes are mutually exclusive, where the last | 387 | The two extension modes are mutually exclusive, where the last |
| 344 | given escape sequence takes precedence over the former.") | 388 | given escape sequence takes precedence over the former.") |
| 345 | 389 | ||
| 390 | (make-obsolete-variable | ||
| 391 | 'xterm-mouse-tracking-enable-sequence | ||
| 392 | "use the function `xterm-mouse-tracking-enable-sequence' instead." | ||
| 393 | "25.1") | ||
| 394 | |||
| 395 | (defun xterm-mouse-tracking-disable-sequence () | ||
| 396 | "Return a control sequence to disable XTerm mouse tracking. | ||
| 397 | The control sequence resets the modes set by | ||
| 398 | `xterm-mouse-tracking-enable-sequence'." | ||
| 399 | (apply #'concat (nreverse (xterm-mouse--tracking-sequence ?l)))) | ||
| 400 | |||
| 346 | (defconst xterm-mouse-tracking-disable-sequence | 401 | (defconst xterm-mouse-tracking-disable-sequence |
| 347 | "\e[?1006l\e[?1005l\e[?1002l\e[?1000l" | 402 | "\e[?1006l\e[?1005l\e[?1002l\e[?1000l" |
| 348 | "Reset the modes set by `xterm-mouse-tracking-enable-sequence'.") | 403 | "Reset the modes set by `xterm-mouse-tracking-enable-sequence'.") |
| 349 | 404 | ||
| 405 | (make-obsolete-variable | ||
| 406 | 'xterm-mouse-tracking-disable-sequence | ||
| 407 | "use the function `xterm-mouse-tracking-disable-sequence' instead." | ||
| 408 | "25.1") | ||
| 409 | |||
| 410 | (defun xterm-mouse--tracking-sequence (suffix) | ||
| 411 | "Return a control sequence to enable or disable mouse tracking. | ||
| 412 | SUFFIX is the last character of each escape sequence (?h to | ||
| 413 | enable, ?l to disable)." | ||
| 414 | (mapcar | ||
| 415 | (lambda (code) (format "\e[?%d%c" code suffix)) | ||
| 416 | `(1000 1002 ,@(when xterm-mouse-utf-8 '(1005)) 1006))) | ||
| 417 | |||
| 350 | (defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal) | 418 | (defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal) |
| 351 | "Enable xterm mouse tracking on TERMINAL." | 419 | "Enable xterm mouse tracking on TERMINAL." |
| 352 | (when (and xterm-mouse-mode (eq t (terminal-live-p terminal)) | 420 | (when (and xterm-mouse-mode (eq t (terminal-live-p terminal)) |
| @@ -360,18 +428,19 @@ given escape sequence takes precedence over the former.") | |||
| 360 | (with-selected-frame (car (frames-on-display-list terminal)) | 428 | (with-selected-frame (car (frames-on-display-list terminal)) |
| 361 | (define-key input-decode-map "\e[M" 'xterm-mouse-translate) | 429 | (define-key input-decode-map "\e[M" 'xterm-mouse-translate) |
| 362 | (define-key input-decode-map "\e[<" 'xterm-mouse-translate-extended)) | 430 | (define-key input-decode-map "\e[<" 'xterm-mouse-translate-extended)) |
| 363 | (condition-case err | 431 | (let ((enable (xterm-mouse-tracking-enable-sequence)) |
| 364 | (send-string-to-terminal xterm-mouse-tracking-enable-sequence | 432 | (disable (xterm-mouse-tracking-disable-sequence))) |
| 365 | terminal) | 433 | (condition-case err |
| 366 | ;; FIXME: This should use a dedicated error signal. | 434 | (send-string-to-terminal enable terminal) |
| 367 | (error (if (equal (cadr err) "Terminal is currently suspended") | 435 | ;; FIXME: This should use a dedicated error signal. |
| 368 | nil ;The sequence will be sent upon resume. | 436 | (error (if (equal (cadr err) "Terminal is currently suspended") |
| 369 | (signal (car err) (cdr err))))) | 437 | nil ; The sequence will be sent upon resume. |
| 370 | (push xterm-mouse-tracking-enable-sequence | 438 | (signal (car err) (cdr err))))) |
| 371 | (terminal-parameter nil 'tty-mode-set-strings)) | 439 | (push enable (terminal-parameter nil 'tty-mode-set-strings)) |
| 372 | (push xterm-mouse-tracking-disable-sequence | 440 | (push disable (terminal-parameter nil 'tty-mode-reset-strings)) |
| 373 | (terminal-parameter nil 'tty-mode-reset-strings)) | 441 | (set-terminal-parameter terminal 'xterm-mouse-mode t) |
| 374 | (set-terminal-parameter terminal 'xterm-mouse-mode t)))) | 442 | (set-terminal-parameter terminal 'xterm-mouse-utf-8 |
| 443 | xterm-mouse-utf-8))))) | ||
| 375 | 444 | ||
| 376 | (defun turn-off-xterm-mouse-tracking-on-terminal (terminal) | 445 | (defun turn-off-xterm-mouse-tracking-on-terminal (terminal) |
| 377 | "Disable xterm mouse tracking on TERMINAL." | 446 | "Disable xterm mouse tracking on TERMINAL." |