aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/apropos.el42
-rw-r--r--lisp/auth-source.el36
-rw-r--r--lisp/calendar/todo-mode.el8
-rw-r--r--lisp/cedet/semantic/symref/grep.el33
-rw-r--r--lisp/cus-start.el8
-rw-r--r--lisp/dired-aux.el4
-rw-r--r--lisp/dired-x.el9
-rw-r--r--lisp/dired.el78
-rw-r--r--lisp/display-line-numbers.el106
-rw-r--r--lisp/emacs-lisp/cl-generic.el71
-rw-r--r--lisp/emacs-lisp/edebug.el4
-rw-r--r--lisp/emacs-lisp/eieio-compat.el3
-rw-r--r--lisp/emacs-lisp/eldoc.el49
-rw-r--r--lisp/emacs-lisp/elp.el5
-rw-r--r--lisp/emacs-lisp/ert.el13
-rw-r--r--lisp/emacs-lisp/pcase.el5
-rw-r--r--lisp/emacs-lisp/rx.el56
-rw-r--r--lisp/eshell/em-ls.el53
-rw-r--r--lisp/faces.el4
-rw-r--r--lisp/files.el159
-rw-r--r--lisp/find-dired.el2
-rw-r--r--lisp/find-lisp.el2
-rw-r--r--lisp/frame.el4
-rw-r--r--lisp/ido.el2
-rw-r--r--lisp/kmacro.el13
-rw-r--r--lisp/loadhist.el105
-rw-r--r--lisp/ls-lisp.el42
-rw-r--r--lisp/menu-bar.el71
-rw-r--r--lisp/net/shr.el3
-rw-r--r--lisp/password-cache.el30
-rw-r--r--lisp/progmodes/cc-engine.el28
-rw-r--r--lisp/progmodes/cc-fonts.el26
-rw-r--r--lisp/progmodes/cc-mode.el27
-rw-r--r--lisp/progmodes/cperl-mode.el4
-rw-r--r--lisp/progmodes/ld-script.el9
-rw-r--r--lisp/progmodes/perl-mode.el43
-rw-r--r--lisp/progmodes/sh-script.el1
-rw-r--r--lisp/register.el4
-rw-r--r--lisp/replace.el5
-rw-r--r--lisp/ruler-mode.el4
-rw-r--r--lisp/startup.el1
-rw-r--r--lisp/subr.el79
-rw-r--r--lisp/textmodes/artist.el2
-rw-r--r--lisp/textmodes/css-mode.el2
-rw-r--r--lisp/url/url-cookie.el41
-rw-r--r--lisp/vc/smerge-mode.el66
-rw-r--r--lisp/whitespace.el2
47 files changed, 927 insertions, 437 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el
index cbd9c71d3e3..86d9b514290 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -514,6 +514,19 @@ options only, i.e. behave like `apropos-user-option'."
514 (let ((apropos-do-all (if do-not-all nil t))) 514 (let ((apropos-do-all (if do-not-all nil t)))
515 (apropos-user-option pattern))) 515 (apropos-user-option pattern)))
516 516
517;;;###autoload
518(defun apropos-local-variable (pattern &optional buffer)
519 "Show buffer-local variables that match PATTERN.
520Optional arg BUFFER (default: current buffer) is the buffer to check.
521
522The output includes variables that are not yet set in BUFFER, but that
523will be buffer-local when set."
524 (interactive (list (apropos-read-pattern "buffer-local variable")))
525 (unless buffer (setq buffer (current-buffer)))
526 (apropos-command pattern nil (lambda (symbol)
527 (and (local-variable-if-set-p symbol)
528 (get symbol 'variable-documentation)))))
529
517;; For auld lang syne: 530;; For auld lang syne:
518;;;###autoload 531;;;###autoload
519(defalias 'command-apropos 'apropos-command) 532(defalias 'command-apropos 'apropos-command)
@@ -795,6 +808,35 @@ Returns list of symbols and values found."
795 (let ((apropos-multi-type do-all)) 808 (let ((apropos-multi-type do-all))
796 (apropos-print nil "\n----------------\n"))) 809 (apropos-print nil "\n----------------\n")))
797 810
811;;;###autoload
812(defun apropos-local-value (pattern &optional buffer)
813 "Show buffer-local variables whose values match PATTERN.
814This is like `apropos-value', but only for buffer-local variables.
815Optional arg BUFFER (default: current buffer) is the buffer to check."
816 (interactive (list (apropos-read-pattern "value of buffer-local variable")))
817 (unless buffer (setq buffer (current-buffer)))
818 (apropos-parse-pattern pattern)
819 (setq apropos-accumulator ())
820 (let ((var nil))
821 (mapatoms
822 (lambda (symb)
823 (unless (memq symb '(apropos-regexp apropos-pattern apropos-all-words-regexp
824 apropos-words apropos-all-words apropos-accumulator symb var))
825 (setq var (apropos-value-internal 'local-variable-if-set-p symb 'symbol-value)))
826 (when (and (fboundp 'apropos-false-hit-str) (apropos-false-hit-str var))
827 (setq var nil))
828 (when var
829 (setq apropos-accumulator (cons (list symb (apropos-score-str var) nil var)
830 apropos-accumulator))))))
831 (let ((apropos-multi-type nil))
832 (if (> emacs-major-version 20)
833 (apropos-print
834 nil "\n----------------\n"
835 (format "Buffer `%s' has the following local variables\nmatching %s`%s':"
836 (buffer-name buffer)
837 (if (consp pattern) "keywords " "")
838 pattern))
839 (apropos-print nil "\n----------------\n"))))
798 840
799;;;###autoload 841;;;###autoload
800(defun apropos-documentation (pattern &optional do-all) 842(defun apropos-documentation (pattern &optional do-all)
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index d1747bda3da..d4b44a59529 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -200,8 +200,6 @@ Note that if EPA/EPG is not available, this should NOT be used."
200 (const :tag "Save GPG-encrypted password tokens" gpg) 200 (const :tag "Save GPG-encrypted password tokens" gpg)
201 (const :tag "Don't encrypt tokens" never)))))) 201 (const :tag "Don't encrypt tokens" never))))))
202 202
203(defvar auth-source-magic "auth-source-magic ")
204
205(defcustom auth-source-do-cache t 203(defcustom auth-source-do-cache t
206 "Whether auth-source should cache information with `password-cache'." 204 "Whether auth-source should cache information with `password-cache'."
207 :group 'auth-source 205 :group 'auth-source
@@ -782,16 +780,16 @@ Returns the deleted entries."
782(defun auth-source-forget-all-cached () 780(defun auth-source-forget-all-cached ()
783 "Forget all cached auth-source data." 781 "Forget all cached auth-source data."
784 (interactive) 782 (interactive)
785 (cl-do-symbols (sym password-data) 783 (maphash (lambda (key _password)
786 ;; when the symbol name starts with auth-source-magic 784 (when (eq 'auth-source (car-safe key))
787 (when (string-match (concat "^" auth-source-magic) (symbol-name sym)) 785 ;; remove that key
788 ;; remove that key 786 (password-cache-remove key)))
789 (password-cache-remove (symbol-name sym)))) 787 password-data)
790 (setq auth-source-netrc-cache nil)) 788 (setq auth-source-netrc-cache nil))
791 789
792(defun auth-source-format-cache-entry (spec) 790(defun auth-source-format-cache-entry (spec)
793 "Format SPEC entry to put it in the password cache." 791 "Format SPEC entry to put it in the password cache."
794 (concat auth-source-magic (format "%S" spec))) 792 `(auth-source . ,spec))
795 793
796(defun auth-source-remember (spec found) 794(defun auth-source-remember (spec found)
797 "Remember FOUND search results for SPEC." 795 "Remember FOUND search results for SPEC."
@@ -822,18 +820,16 @@ This is not a full `auth-source-search' spec but works similarly.
822For instance, \(:host \"myhost\" \"yourhost\") would find all the 820For instance, \(:host \"myhost\" \"yourhost\") would find all the
823cached data that was found with a search for those two hosts, 821cached data that was found with a search for those two hosts,
824while \(:host t) would find all host entries." 822while \(:host t) would find all host entries."
825 (let ((count 0) 823 (let ((count 0))
826 sname) 824 (maphash
827 (cl-do-symbols (sym password-data) 825 (lambda (key _password)
828 ;; when the symbol name matches with auth-source-magic 826 (when (and (eq 'auth-source (car-safe key))
829 (when (and (setq sname (symbol-name sym)) 827 ;; and the spec matches what was stored in the cache
830 (string-match (concat "^" auth-source-magic "\\(.+\\)") 828 (auth-source-specmatchp spec (cdr key)))
831 sname) 829 ;; remove that key
832 ;; and the spec matches what was stored in the cache 830 (password-cache-remove key)
833 (auth-source-specmatchp spec (read (match-string 1 sname)))) 831 (cl-incf count)))
834 ;; remove that key 832 password-data)
835 (password-cache-remove sname)
836 (cl-incf count)))
837 count)) 833 count))
838 834
839(defun auth-source-specmatchp (spec stored) 835(defun auth-source-specmatchp (spec stored)
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index b89c1c2bbd5..1cb01e1ed9e 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -4527,11 +4527,9 @@ If the file already exists, overwrite it only on confirmation."
4527 4527
4528(defcustom todo-print-buffer-function #'ps-print-buffer-with-faces 4528(defcustom todo-print-buffer-function #'ps-print-buffer-with-faces
4529 "Function called by `todo-print-buffer' to print Todo mode buffers. 4529 "Function called by `todo-print-buffer' to print Todo mode buffers.
4530The function should take an optional argument whose non-nil value 4530Called with one argument which can either be:
4531is a string naming a file to save the print image to; calling 4531- a string, naming a file to save the print image to.
4532`todo-print-buffer-to-file' prompts for the file name, which is 4532- nil, to send the image to the printer."
4533passed to this function. Calling this function with no or a nil
4534argument sends the image to the printer."
4535 :type 'symbol 4533 :type 'symbol
4536 :group 'todo) 4534 :group 'todo)
4537 4535
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 42dc40cce04..df71508da7c 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -189,26 +189,25 @@ This shell should support pipe redirect syntax."
189 ;; Return the answer 189 ;; Return the answer
190 ans)) 190 ans))
191 191
192(defconst semantic-symref-grep--line-re
193 "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):")
194
195(cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-grep)) 192(cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-grep))
196 "Parse one line of grep output, and return it as a match list. 193 "Parse one line of grep output, and return it as a match list.
197Moves cursor to end of the match." 194Moves cursor to end of the match."
198 (cond ((eq (oref tool :resulttype) 'file) 195 (pcase-let
199 ;; Search for files 196 ((`(,grep-re ,file-group ,line-group . ,_) (car (grep-regexp-alist))))
200 (when (re-search-forward "^\\([^\n]+\\)$" nil t) 197 (cond ((eq (oref tool :resulttype) 'file)
201 (match-string 1))) 198 ;; Search for files
202 ((eq (oref tool :resulttype) 'line-and-text) 199 (when (re-search-forward "^\\([^\n]+\\)$" nil t)
203 (when (re-search-forward semantic-symref-grep--line-re nil t) 200 (match-string 1)))
204 (list (string-to-number (match-string 2)) 201 ((eq (oref tool :resulttype) 'line-and-text)
205 (match-string 1) 202 (when (re-search-forward grep-re nil t)
206 (buffer-substring-no-properties (point) (line-end-position))))) 203 (list (string-to-number (match-string line-group))
207 (t 204 (match-string file-group)
208 (when (re-search-forward semantic-symref-grep--line-re nil t) 205 (buffer-substring-no-properties (point) (line-end-position)))))
209 (cons (string-to-number (match-string 2)) 206 (t
210 (match-string 1)) 207 (when (re-search-forward grep-re nil t)
211 )))) 208 (cons (string-to-number (match-string line-group))
209 (match-string file-group))
210 )))))
212 211
213(provide 'semantic/symref/grep) 212(provide 'semantic/symref/grep)
214 213
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index ed913e32688..c28b8a147fc 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -584,7 +584,7 @@ since it could result in memory overflow and make Emacs crash."
584 (const :tag "Grow only" :value grow-only)) 584 (const :tag "Grow only" :value grow-only))
585 "25.1") 585 "25.1")
586 (display-raw-bytes-as-hex display boolean "26.1") 586 (display-raw-bytes-as-hex display boolean "26.1")
587 (display-line-numbers display 587 (display-line-numbers display-line-numbers
588 (choice 588 (choice
589 (const :tag "Off (nil)" :value nil) 589 (const :tag "Off (nil)" :value nil)
590 (const :tag "Absolute line numbers" 590 (const :tag "Absolute line numbers"
@@ -594,7 +594,7 @@ since it could result in memory overflow and make Emacs crash."
594 (const :tag "Visually relative line numbers" 594 (const :tag "Visually relative line numbers"
595 :value visual)) 595 :value visual))
596 "26.1") 596 "26.1")
597 (display-line-numbers-width display 597 (display-line-numbers-width display-line-numbers
598 (choice 598 (choice
599 (const :tag "Dynamically computed" 599 (const :tag "Dynamically computed"
600 :value nil) 600 :value nil)
@@ -602,14 +602,14 @@ since it could result in memory overflow and make Emacs crash."
602 :value 2 602 :value 2
603 :format "%v")) 603 :format "%v"))
604 "26.1") 604 "26.1")
605 (display-line-numbers-current-absolute display 605 (display-line-numbers-current-absolute display-line-numbers
606 (choice 606 (choice
607 (const :tag "Display actual number of current line" 607 (const :tag "Display actual number of current line"
608 :value t) 608 :value t)
609 (const :tag "Display zero as number of current line" 609 (const :tag "Display zero as number of current line"
610 :value nil)) 610 :value nil))
611 "26.1") 611 "26.1")
612 (display-line-numbers-widen display 612 (display-line-numbers-widen display-line-numbers
613 (choice 613 (choice
614 (const :tag "Disregard narrowing when calculating line numbers" 614 (const :tag "Disregard narrowing when calculating line numbers"
615 :value t) 615 :value t)
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 17dae6085df..0a8ec26f7ca 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1,4 +1,4 @@
1;;; dired-aux.el --- less commonly used parts of dired 1;;; dired-aux.el --- less commonly used parts of dired -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2017 Free Software 3;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2017 Free Software
4;; Foundation, Inc. 4;; Foundation, Inc.
@@ -742,8 +742,6 @@ can be produced by `dired-get-marked-files', for example."
742 (string-match regexp res)))) 742 (string-match regexp res))))
743 (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep))) 743 (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
744 (no-subst (not (dired--star-or-qmark-p command "?" 'keep))) 744 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
745 (star (string-match "\\*" command))
746 (qmark (string-match "\\?" command))
747 ;; Get confirmation for wildcards that may have been meant 745 ;; Get confirmation for wildcards that may have been meant
748 ;; to control substitution of a file name or the file name list. 746 ;; to control substitution of a file name or the file name list.
749 (ok (cond ((not (or on-each no-subst)) 747 (ok (cond ((not (or on-each no-subst))
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 915550991d0..1425278bdc9 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -1629,10 +1629,11 @@ Binding direction based on `dired-x-hands-off-my-keys'."
1629 (if (called-interactively-p 'interactive) 1629 (if (called-interactively-p 'interactive)
1630 (setq dired-x-hands-off-my-keys 1630 (setq dired-x-hands-off-my-keys
1631 (not (y-or-n-p "Bind dired-x-find-file over find-file? ")))) 1631 (not (y-or-n-p "Bind dired-x-find-file over find-file? "))))
1632 (define-key (current-global-map) [remap find-file] 1632 (unless dired-x-hands-off-my-keys
1633 (if (not dired-x-hands-off-my-keys) 'dired-x-find-file)) 1633 (define-key (current-global-map) [remap find-file]
1634 (define-key (current-global-map) [remap find-file-other-window] 1634 'dired-x-find-file)
1635 (if (not dired-x-hands-off-my-keys) 'dired-x-find-file-other-window))) 1635 (define-key (current-global-map) [remap find-file-other-window]
1636 'dired-x-find-file-other-window)))
1636 1637
1637;; Now call it so binding is correct. This could go in the :initialize 1638;; Now call it so binding is correct. This could go in the :initialize
1638;; slot, but then dired-x-bind-find-file has to be defined before the 1639;; slot, but then dired-x-bind-find-file has to be defined before the
diff --git a/lisp/dired.el b/lisp/dired.el
index 9d500a9f52d..a056ad679fa 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -920,11 +920,12 @@ periodically reverts at specified time intervals."
920 "Directory has changed on disk; type \\[revert-buffer] to update Dired"))))) 920 "Directory has changed on disk; type \\[revert-buffer] to update Dired")))))
921 ;; Else a new buffer 921 ;; Else a new buffer
922 (setq default-directory 922 (setq default-directory
923 ;; We can do this unconditionally 923 (or (car-safe (insert-directory-wildcard-in-dir-p dirname))
924 ;; because dired-noselect ensures that the name 924 ;; We can do this unconditionally
925 ;; is passed in directory name syntax 925 ;; because dired-noselect ensures that the name
926 ;; if it was the name of a directory at all. 926 ;; is passed in directory name syntax
927 (file-name-directory dirname)) 927 ;; if it was the name of a directory at all.
928 (file-name-directory dirname)))
928 (or switches (setq switches dired-listing-switches)) 929 (or switches (setq switches dired-listing-switches))
929 (if mode (funcall mode) 930 (if mode (funcall mode)
930 (dired-mode dir-or-list switches)) 931 (dired-mode dir-or-list switches))
@@ -1056,13 +1057,14 @@ wildcards, erases the buffer, and builds the subdir-alist anew
1056 (not file-list)) 1057 (not file-list))
1057 ;; If we are reading a whole single directory... 1058 ;; If we are reading a whole single directory...
1058 (dired-insert-directory dir dired-actual-switches nil nil t) 1059 (dired-insert-directory dir dired-actual-switches nil nil t)
1059 (if (not (file-readable-p 1060 (if (and (not (insert-directory-wildcard-in-dir-p dir))
1060 (directory-file-name (file-name-directory dir)))) 1061 (not (file-readable-p
1061 (error "Directory %s inaccessible or nonexistent" dir) 1062 (directory-file-name (file-name-directory dir)))))
1062 ;; Else treat it as a wildcard spec 1063 (error "Directory %s inaccessible or nonexistent" dir))
1063 ;; unless we have an explicit list of files. 1064 ;; Else treat it as a wildcard spec
1064 (dired-insert-directory dir dired-actual-switches 1065 ;; unless we have an explicit list of files.
1065 file-list (not file-list) t))))) 1066 (dired-insert-directory dir dired-actual-switches
1067 file-list (not file-list) t))))
1066 1068
1067(defun dired-align-file (beg end) 1069(defun dired-align-file (beg end)
1068 "Align the fields of a file to the ones of surrounding lines. 1070 "Align the fields of a file to the ones of surrounding lines.
@@ -1207,29 +1209,46 @@ If HDR is non-nil, insert a header line with the directory name."
1207 ;; as indicated by `ls-lisp-use-insert-directory-program'. 1209 ;; as indicated by `ls-lisp-use-insert-directory-program'.
1208 (not (and (featurep 'ls-lisp) 1210 (not (and (featurep 'ls-lisp)
1209 (null ls-lisp-use-insert-directory-program))) 1211 (null ls-lisp-use-insert-directory-program)))
1210 (or (if (eq dired-use-ls-dired 'unspecified) 1212 (not (and (featurep 'eshell)
1213 (bound-and-true-p eshell-ls-use-in-dired)))
1214 (or (file-remote-p dir)
1215 (if (eq dired-use-ls-dired 'unspecified)
1211 ;; Check whether "ls --dired" gives exit code 0, and 1216 ;; Check whether "ls --dired" gives exit code 0, and
1212 ;; save the answer in `dired-use-ls-dired'. 1217 ;; save the answer in `dired-use-ls-dired'.
1213 (or (setq dired-use-ls-dired 1218 (or (setq dired-use-ls-dired
1214 (eq 0 (call-process insert-directory-program 1219 (eq 0 (call-process insert-directory-program
1215 nil nil nil "--dired"))) 1220 nil nil nil "--dired")))
1216 (progn 1221 (progn
1217 (message "ls does not support --dired; \ 1222 (message "ls does not support --dired; \
1218see `dired-use-ls-dired' for more details.") 1223see `dired-use-ls-dired' for more details.")
1219 nil)) 1224 nil))
1220 dired-use-ls-dired) 1225 dired-use-ls-dired)))
1221 (file-remote-p dir)))
1222 (setq switches (concat "--dired " switches))) 1226 (setq switches (concat "--dired " switches)))
1223 ;; We used to specify the C locale here, to force English month names; 1227 ;; Expand directory wildcards and fill file-list.
1224 ;; but this should not be necessary any more, 1228 (let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir)))
1225 ;; with the new value of `directory-listing-before-filename-regexp'. 1229 (cond (dir-wildcard
1226 (if file-list 1230 (setq switches (concat "-d " switches))
1227 (dolist (f file-list) 1231 (let ((default-directory (car dir-wildcard))
1228 (let ((beg (point))) 1232 (script (format "ls %s %s" switches (cdr dir-wildcard))))
1229 (insert-directory f switches nil nil) 1233 (unless
1230 ;; Re-align fields, if necessary. 1234 (zerop
1231 (dired-align-file beg (point)))) 1235 (process-file
1232 (insert-directory dir switches wildcard (not wildcard))) 1236 "/bin/sh" nil (current-buffer) nil "-c" script))
1237 (user-error
1238 "%s: No files matching wildcard" (cdr dir-wildcard)))
1239 (insert-directory-clean (point) switches)))
1240 (t
1241 ;; We used to specify the C locale here, to force English
1242 ;; month names; but this should not be necessary any
1243 ;; more, with the new value of
1244 ;; `directory-listing-before-filename-regexp'.
1245 (if file-list
1246 (dolist (f file-list)
1247 (let ((beg (point)))
1248 (insert-directory f switches nil nil)
1249 ;; Re-align fields, if necessary.
1250 (dired-align-file beg (point))))
1251 (insert-directory dir switches wildcard (not wildcard))))))
1233 ;; Quote certain characters, unless ls quoted them for us. 1252 ;; Quote certain characters, unless ls quoted them for us.
1234 (if (not (dired-switches-escape-p dired-actual-switches)) 1253 (if (not (dired-switches-escape-p dired-actual-switches))
1235 (save-excursion 1254 (save-excursion
@@ -1279,11 +1298,14 @@ see `dired-use-ls-dired' for more details.")
1279 ;; Note that dired-build-subdir-alist will replace the name 1298 ;; Note that dired-build-subdir-alist will replace the name
1280 ;; by its expansion, so it does not matter whether what we insert 1299 ;; by its expansion, so it does not matter whether what we insert
1281 ;; here is fully expanded, but it should be absolute. 1300 ;; here is fully expanded, but it should be absolute.
1282 (insert " " (directory-file-name (file-name-directory dir)) ":\n") 1301 (insert " " (or (car-safe (insert-directory-wildcard-in-dir-p dir))
1302 (directory-file-name (file-name-directory dir))) ":\n")
1283 (setq content-point (point))) 1303 (setq content-point (point)))
1284 (when wildcard 1304 (when wildcard
1285 ;; Insert "wildcard" line where "total" line would be for a full dir. 1305 ;; Insert "wildcard" line where "total" line would be for a full dir.
1286 (insert " wildcard " (file-name-nondirectory dir) "\n"))) 1306 (insert " wildcard " (or (cdr-safe (insert-directory-wildcard-in-dir-p dir))
1307 (file-name-nondirectory dir))
1308 "\n")))
1287 (dired-insert-set-properties content-point (point))))) 1309 (dired-insert-set-properties content-point (point)))))
1288 1310
1289(defun dired-insert-set-properties (beg end) 1311(defun dired-insert-set-properties (beg end)
diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
new file mode 100644
index 00000000000..a99474547bf
--- /dev/null
+++ b/lisp/display-line-numbers.el
@@ -0,0 +1,106 @@
1;;; display-line-numbers.el --- interface for display-line-numbers -*- lexical-binding: t -*-
2
3;; Copyright (C) 2017 Free Software Foundation, Inc.
4
5;; Maintainer: emacs-devel@gnu.org
6;; Keywords: convenience
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;; Provides a minor mode interface for `display-line-numbers'.
26;;
27;; Toggle display of line numbers with M-x display-line-numbers-mode.
28;; To enable line numbering in all buffers, use M-x
29;; global-display-line-numbers-mode. To change the default type of
30;; line numbers displayed, customize display-line-numbers-type.
31
32;; NOTE: Customization variables for `display-line-numbers' itself are
33;; defined in cus-start.el.
34
35;;; Code:
36
37(defgroup display-line-numbers nil
38 "Display line numbers in the buffer."
39 :group 'display)
40
41;;;###autoload
42(defcustom display-line-numbers-type t
43 "The default type of line numbers to use in `display-line-numbers-mode'.
44See `display-line-numbers' for value options."
45 :group 'display-line-numbers
46 :type '(choice (const :tag "Relative line numbers" relative)
47 (const :tag "Relative visual line numbers" visual)
48 (other :tag "Absolute line numbers" t))
49 :version "26.1")
50
51(defcustom display-line-numbers-grow-only nil
52 "If non-nil, do not shrink line number width."
53 :group 'display-line-numbers
54 :type 'boolean
55 :version "26.1")
56
57(defcustom display-line-numbers-width-start nil
58 "If non-nil, count number of lines to use for line number width.
59When `display-line-numbers-mode' is turned on,
60`display-line-numbers-width' is set to the minimum width necessary
61to display all line numbers in the buffer."
62 :group 'display-line-numbers
63 :type 'boolean
64 :version "26.1")
65
66(defun display-line-numbers-update-width ()
67 "Prevent the line number width from shrinking."
68 (let ((width (line-number-display-width)))
69 (when (> width (or display-line-numbers-width 1))
70 (setq display-line-numbers-width width))))
71
72;;;###autoload
73(define-minor-mode display-line-numbers-mode
74 "Toggle display of line numbers in the buffer.
75This uses `display-line-numbers' internally.
76
77To change the type of line numbers displayed by default,
78customize `display-line-numbers-type'. To change the type while
79the mode is on, set `display-line-numbers' directly."
80 :lighter nil
81 (if display-line-numbers-mode
82 (progn
83 (when display-line-numbers-width-start
84 (setq display-line-numbers-width
85 (length (number-to-string
86 (count-lines (point-min) (point-max))))))
87 (when display-line-numbers-grow-only
88 (add-hook 'pre-command-hook #'display-line-numbers-update-width nil t))
89 (setq display-line-numbers display-line-numbers-type))
90 (remove-hook 'pre-command-hook #'display-line-numbers-update-width t)
91 (setq display-line-numbers nil)))
92
93(defun display-line-numbers--turn-on ()
94 "Turn on `display-line-numbers-mode'."
95 (unless (or (minibufferp)
96 ;; taken from linum.el
97 (and (daemonp) (null (frame-parameter nil 'client))))
98 (display-line-numbers-mode)))
99
100;;;###autoload
101(define-globalized-minor-mode global-display-line-numbers-mode
102 display-line-numbers-mode display-line-numbers--turn-on)
103
104(provide 'display-line-numbers)
105
106;;; display-line-numbers.el ends here
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index c64376b940f..1a3f8e1f4d5 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -166,6 +166,10 @@ SPECIALIZERS-FUNCTION takes as first argument a tag value TAG
166(defmacro cl--generic (name) 166(defmacro cl--generic (name)
167 `(get ,name 'cl--generic)) 167 `(get ,name 'cl--generic))
168 168
169(defun cl-generic-p (f)
170 "Return non-nil if F is a generic function."
171 (and (symbolp f) (cl--generic f)))
172
169(defun cl-generic-ensure-function (name &optional noerror) 173(defun cl-generic-ensure-function (name &optional noerror)
170 (let (generic 174 (let (generic
171 (origname name)) 175 (origname name))
@@ -182,8 +186,7 @@ SPECIALIZERS-FUNCTION takes as first argument a tag value TAG
182 origname)) 186 origname))
183 (if generic 187 (if generic
184 (cl-assert (eq name (cl--generic-name generic))) 188 (cl-assert (eq name (cl--generic-name generic)))
185 (setf (cl--generic name) (setq generic (cl--generic-make name))) 189 (setf (cl--generic name) (setq generic (cl--generic-make name))))
186 (defalias name (cl--generic-make-function generic)))
187 generic)) 190 generic))
188 191
189;;;###autoload 192;;;###autoload
@@ -410,7 +413,7 @@ The set of acceptable TYPEs (also called \"specializers\") is defined
410\(and can be extended) by the various methods of `cl-generic-generalizers'. 413\(and can be extended) by the various methods of `cl-generic-generalizers'.
411 414
412\(fn NAME [QUALIFIER] ARGS &rest [DOCSTRING] BODY)" 415\(fn NAME [QUALIFIER] ARGS &rest [DOCSTRING] BODY)"
413 (declare (doc-string 3) (indent 2) 416 (declare (doc-string 3) (indent defun)
414 (debug 417 (debug
415 (&define ; this means we are defining something 418 (&define ; this means we are defining something
416 [&or name ("setf" name :name setf)] 419 [&or name ("setf" name :name setf)]
@@ -501,25 +504,26 @@ The set of acceptable TYPEs (also called \"specializers\") is defined
501 (cons method mt) 504 (cons method mt)
502 ;; Keep the ordering; important for methods with :extra qualifiers. 505 ;; Keep the ordering; important for methods with :extra qualifiers.
503 (mapcar (lambda (x) (if (eq x (car me)) method x)) mt))) 506 (mapcar (lambda (x) (if (eq x (car me)) method x)) mt)))
504 (cl-pushnew `(cl-defmethod . ,(cl--generic-load-hist-format 507 (let ((sym (cl--generic-name generic))) ; Actual name (for aliases).
505 (cl--generic-name generic) 508 (unless (symbol-function sym)
506 qualifiers specializers)) 509 (defalias sym 'dummy)) ;Record definition into load-history.
507 current-load-list :test #'equal) 510 (cl-pushnew `(cl-defmethod . ,(cl--generic-load-hist-format
508 ;; FIXME: Try to avoid re-constructing a new function if the old one 511 (cl--generic-name generic)
509 ;; is still valid (e.g. still empty method cache)? 512 qualifiers specializers))
510 (let ((gfun (cl--generic-make-function generic)) 513 current-load-list :test #'equal)
511 ;; Prevent `defalias' from recording this as the definition site of 514 ;; FIXME: Try to avoid re-constructing a new function if the old one
512 ;; the generic function. 515 ;; is still valid (e.g. still empty method cache)?
513 current-load-list) 516 (let ((gfun (cl--generic-make-function generic))
514 ;; For aliases, cl--generic-name gives us the actual name. 517 ;; Prevent `defalias' from recording this as the definition site of
515 (let ((purify-flag 518 ;; the generic function.
516 ;; BEWARE! Don't purify this function definition, since that leads 519 current-load-list
517 ;; to memory corruption if the hash-tables it holds are modified 520 ;; BEWARE! Don't purify this function definition, since that leads
518 ;; (the GC doesn't trace those pointers). 521 ;; to memory corruption if the hash-tables it holds are modified
519 nil)) 522 ;; (the GC doesn't trace those pointers).
523 (purify-flag nil))
520 ;; But do use `defalias', so that it interacts properly with nadvice, 524 ;; But do use `defalias', so that it interacts properly with nadvice,
521 ;; e.g. for tracing/debug-on-entry. 525 ;; e.g. for tracing/debug-on-entry.
522 (defalias (cl--generic-name generic) gfun))))) 526 (defalias sym gfun)))))
523 527
524(defmacro cl--generic-with-memoization (place &rest code) 528(defmacro cl--generic-with-memoization (place &rest code)
525 (declare (indent 1) (debug t)) 529 (declare (indent 1) (debug t))
@@ -1023,6 +1027,20 @@ The value returned is a list of elements of the form
1023 (push (cl--generic-method-info method) docs)))) 1027 (push (cl--generic-method-info method) docs))))
1024 docs)) 1028 docs))
1025 1029
1030(defun cl--generic-method-files (method)
1031 "Return a list of files where METHOD is defined by `cl-defmethod'.
1032The list will have entries of the form (FILE . (METHOD ...))
1033where (METHOD ...) contains the qualifiers and specializers of
1034the method and is a suitable argument for
1035`find-function-search-for-symbol'. Filenames are absolute."
1036 (let (result)
1037 (pcase-dolist (`(,file . ,defs) load-history)
1038 (dolist (def defs)
1039 (when (and (eq (car-safe def) 'cl-defmethod)
1040 (eq (cadr def) method))
1041 (push (cons file (cdr def)) result))))
1042 result))
1043
1026;;; Support for (head <val>) specializers. 1044;;; Support for (head <val>) specializers.
1027 1045
1028;; For both the `eql' and the `head' specializers, the dispatch 1046;; For both the `eql' and the `head' specializers, the dispatch
@@ -1210,5 +1228,18 @@ Used internally for the (major-mode MODE) context specializers."
1210 (progn (cl-assert (null modes)) mode) 1228 (progn (cl-assert (null modes)) mode)
1211 `(derived-mode ,mode . ,modes)))) 1229 `(derived-mode ,mode . ,modes))))
1212 1230
1231;;; Support for unloading.
1232
1233(cl-defmethod loadhist-unload-element ((x (head cl-defmethod)))
1234 (pcase-let*
1235 ((`(,name ,qualifiers . ,specializers) (cdr x))
1236 (generic (cl-generic-ensure-function name 'noerror)))
1237 (when generic
1238 (let* ((mt (cl--generic-method-table generic))
1239 (me (cl--generic-member-method specializers qualifiers mt)))
1240 (when me
1241 (setf (cl--generic-method-table generic) (delq (car me) mt)))))))
1242
1243
1213(provide 'cl-generic) 1244(provide 'cl-generic)
1214;;; cl-generic.el ends here 1245;;; cl-generic.el ends here
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 1494ed1d9c3..c6ef8d7a99c 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -3213,8 +3213,8 @@ instrument cannot be found, signal an error."
3213 ((consp func-marker) 3213 ((consp func-marker)
3214 (message "%s is already instrumented." func) 3214 (message "%s is already instrumented." func)
3215 (list func)) 3215 (list func))
3216 ((get func 'cl--generic) 3216 ((cl-generic-p func)
3217 (let ((method-defs (method-files func)) 3217 (let ((method-defs (cl--generic-method-files func))
3218 symbols) 3218 symbols)
3219 (unless method-defs 3219 (unless method-defs
3220 (error "Could not find any method definitions for %s" func)) 3220 (error "Could not find any method definitions for %s" func))
diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el
index e6e6d118709..8403a8a655f 100644
--- a/lisp/emacs-lisp/eieio-compat.el
+++ b/lisp/emacs-lisp/eieio-compat.el
@@ -165,7 +165,8 @@ Summary:
165 (if (memq method '(no-next-method no-applicable-method)) 165 (if (memq method '(no-next-method no-applicable-method))
166 (symbol-function method) 166 (symbol-function method)
167 (let ((generic (cl-generic-ensure-function method))) 167 (let ((generic (cl-generic-ensure-function method)))
168 (symbol-function (cl--generic-name generic))))) 168 (or (symbol-function (cl--generic-name generic))
169 (cl--generic-make-function generic)))))
169 170
170;;;###autoload 171;;;###autoload
171(defun eieio--defmethod (method kind argclass code) 172(defun eieio--defmethod (method kind argclass code)
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index a05bd7cc4d4..bca40ab87da 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -160,6 +160,10 @@ This is used to determine if `eldoc-idle-delay' is changed by the user.")
160It should receive the same arguments as `message'.") 160It should receive the same arguments as `message'.")
161 161
162(defun eldoc-edit-message-commands () 162(defun eldoc-edit-message-commands ()
163 "Return an obarray containing common editing commands.
164
165When `eldoc-print-after-edit' is non-nil, ElDoc messages are only
166printed after commands contained in this obarray."
163 (let ((cmds (make-vector 31 0)) 167 (let ((cmds (make-vector 31 0))
164 (re (regexp-opt '("delete" "insert" "edit" "electric" "newline")))) 168 (re (regexp-opt '("delete" "insert" "edit" "electric" "newline"))))
165 (mapatoms (lambda (s) 169 (mapatoms (lambda (s)
@@ -211,16 +215,21 @@ expression point is on."
211 215
212;;;###autoload 216;;;###autoload
213(defun turn-on-eldoc-mode () 217(defun turn-on-eldoc-mode ()
214 "Turn on `eldoc-mode' if the buffer has eldoc support enabled. 218 "Turn on `eldoc-mode' if the buffer has ElDoc support enabled.
215See `eldoc-documentation-function' for more detail." 219See `eldoc-documentation-function' for more detail."
216 (when (eldoc--supported-p) 220 (when (eldoc--supported-p)
217 (eldoc-mode 1))) 221 (eldoc-mode 1)))
218 222
219(defun eldoc--supported-p () 223(defun eldoc--supported-p ()
224 "Non-nil if an ElDoc function is set for this buffer."
220 (not (memq eldoc-documentation-function '(nil ignore)))) 225 (not (memq eldoc-documentation-function '(nil ignore))))
221 226
222 227
223(defun eldoc-schedule-timer () 228(defun eldoc-schedule-timer ()
229 "Ensure `eldoc-timer' is running.
230
231If the user has changed `eldoc-idle-delay', update the timer to
232reflect the change."
224 (or (and eldoc-timer 233 (or (and eldoc-timer
225 (memq eldoc-timer timer-idle-list)) ;FIXME: Why? 234 (memq eldoc-timer timer-idle-list)) ;FIXME: Why?
226 (setq eldoc-timer 235 (setq eldoc-timer
@@ -229,8 +238,7 @@ See `eldoc-documentation-function' for more detail."
229 (lambda () 238 (lambda ()
230 (when (or eldoc-mode 239 (when (or eldoc-mode
231 (and global-eldoc-mode 240 (and global-eldoc-mode
232 (not (memq eldoc-documentation-function 241 (eldoc--supported-p)))
233 '(nil ignore)))))
234 (eldoc-print-current-symbol-info)))))) 242 (eldoc-print-current-symbol-info))))))
235 243
236 ;; If user has changed the idle delay, update the timer. 244 ;; If user has changed the idle delay, update the timer.
@@ -268,16 +276,19 @@ Otherwise work like `message'."
268 (force-mode-line-update))) 276 (force-mode-line-update)))
269 (apply 'message format-string args))) 277 (apply 'message format-string args)))
270 278
271(defun eldoc-message (&rest args) 279(defun eldoc-message (&optional format-string &rest args)
280 "Display FORMAT-STRING formatted with ARGS as an ElDoc message.
281
282Store the message (if any) in `eldoc-last-message', and return it."
272 (let ((omessage eldoc-last-message)) 283 (let ((omessage eldoc-last-message))
273 (setq eldoc-last-message 284 (setq eldoc-last-message
274 (cond ((eq (car args) eldoc-last-message) eldoc-last-message) 285 (cond ((eq format-string eldoc-last-message) eldoc-last-message)
275 ((null (car args)) nil) 286 ((null format-string) nil)
276 ;; If only one arg, no formatting to do, so put it in 287 ;; If only one arg, no formatting to do, so put it in
277 ;; eldoc-last-message so eq test above might succeed on 288 ;; eldoc-last-message so eq test above might succeed on
278 ;; subsequent calls. 289 ;; subsequent calls.
279 ((null (cdr args)) (car args)) 290 ((null args) format-string)
280 (t (apply #'format-message args)))) 291 (t (apply #'format-message format-string args))))
281 ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages 292 ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages
282 ;; are recorded in a log. Do not put eldoc messages in that log since 293 ;; are recorded in a log. Do not put eldoc messages in that log since
283 ;; they are Legion. 294 ;; they are Legion.
@@ -289,6 +300,7 @@ Otherwise work like `message'."
289 eldoc-last-message) 300 eldoc-last-message)
290 301
291(defun eldoc--message-command-p (command) 302(defun eldoc--message-command-p (command)
303 "Return non-nil if COMMAND is in `eldoc-message-commands'."
292 (and (symbolp command) 304 (and (symbolp command)
293 (intern-soft (symbol-name command) eldoc-message-commands))) 305 (intern-soft (symbol-name command) eldoc-message-commands)))
294 306
@@ -299,6 +311,7 @@ Otherwise work like `message'."
299;; before the next command executes, which does away with the flicker. 311;; before the next command executes, which does away with the flicker.
300;; This doesn't seem to be required for Emacs 19.28 and earlier. 312;; This doesn't seem to be required for Emacs 19.28 and earlier.
301(defun eldoc-pre-command-refresh-echo-area () 313(defun eldoc-pre-command-refresh-echo-area ()
314 "Reprint `eldoc-last-message' in the echo area."
302 (and eldoc-last-message 315 (and eldoc-last-message
303 (not (minibufferp)) ;We don't use the echo area when in minibuffer. 316 (not (minibufferp)) ;We don't use the echo area when in minibuffer.
304 (if (and (eldoc-display-message-no-interference-p) 317 (if (and (eldoc-display-message-no-interference-p)
@@ -310,6 +323,7 @@ Otherwise work like `message'."
310 323
311;; Decide whether now is a good time to display a message. 324;; Decide whether now is a good time to display a message.
312(defun eldoc-display-message-p () 325(defun eldoc-display-message-p ()
326 "Return non-nil when it is appropriate to display an ElDoc message."
313 (and (eldoc-display-message-no-interference-p) 327 (and (eldoc-display-message-no-interference-p)
314 ;; If this-command is non-nil while running via an idle 328 ;; If this-command is non-nil while running via an idle
315 ;; timer, we're still in the middle of executing a command, 329 ;; timer, we're still in the middle of executing a command,
@@ -322,6 +336,7 @@ Otherwise work like `message'."
322;; Check various conditions about the current environment that might make 336;; Check various conditions about the current environment that might make
323;; it undesirable to print eldoc messages right this instant. 337;; it undesirable to print eldoc messages right this instant.
324(defun eldoc-display-message-no-interference-p () 338(defun eldoc-display-message-no-interference-p ()
339 "Return nil if displaying a message would cause interference."
325 (not (or executing-kbd-macro (bound-and-true-p edebug-active)))) 340 (not (or executing-kbd-macro (bound-and-true-p edebug-active))))
326 341
327 342
@@ -347,6 +362,7 @@ variable) is taken into account if the major mode specific function does not
347return any documentation.") 362return any documentation.")
348 363
349(defun eldoc-print-current-symbol-info () 364(defun eldoc-print-current-symbol-info ()
365 "Print the text produced by `eldoc-documentation-function'."
350 ;; This is run from post-command-hook or some idle timer thing, 366 ;; This is run from post-command-hook or some idle timer thing,
351 ;; so we need to be careful that errors aren't ignored. 367 ;; so we need to be careful that errors aren't ignored.
352 (with-demoted-errors "eldoc error: %s" 368 (with-demoted-errors "eldoc error: %s"
@@ -361,6 +377,13 @@ return any documentation.")
361;; truncated or eliminated entirely from the output to make room for the 377;; truncated or eliminated entirely from the output to make room for the
362;; description. 378;; description.
363(defun eldoc-docstring-format-sym-doc (prefix doc &optional face) 379(defun eldoc-docstring-format-sym-doc (prefix doc &optional face)
380 "Combine PREFIX and DOC, and shorten the result to fit in the echo area.
381
382When PREFIX is a symbol, propertize its symbol name with FACE
383before combining it with DOC. If FACE is not provided, just
384apply the nil face.
385
386See also: `eldoc-echo-area-use-multiline-p'."
364 (when (symbolp prefix) 387 (when (symbolp prefix)
365 (setq prefix (concat (propertize (symbol-name prefix) 'face face) ": "))) 388 (setq prefix (concat (propertize (symbol-name prefix) 'face face) ": ")))
366 (let* ((ea-multi eldoc-echo-area-use-multiline-p) 389 (let* ((ea-multi eldoc-echo-area-use-multiline-p)
@@ -390,22 +413,26 @@ return any documentation.")
390;; These functions do display-command table management. 413;; These functions do display-command table management.
391 414
392(defun eldoc-add-command (&rest cmds) 415(defun eldoc-add-command (&rest cmds)
416 "Add each of CMDS to the obarray `eldoc-message-commands'."
393 (dolist (name cmds) 417 (dolist (name cmds)
394 (and (symbolp name) 418 (and (symbolp name)
395 (setq name (symbol-name name))) 419 (setq name (symbol-name name)))
396 (set (intern name eldoc-message-commands) t))) 420 (set (intern name eldoc-message-commands) t)))
397 421
398(defun eldoc-add-command-completions (&rest names) 422(defun eldoc-add-command-completions (&rest names)
423 "Pass every prefix completion of NAMES to `eldoc-add-command'."
399 (dolist (name names) 424 (dolist (name names)
400 (apply #'eldoc-add-command (all-completions name obarray 'commandp)))) 425 (apply #'eldoc-add-command (all-completions name obarray 'commandp))))
401 426
402(defun eldoc-remove-command (&rest cmds) 427(defun eldoc-remove-command (&rest cmds)
428 "Remove each of CMDS from the obarray `eldoc-message-commands'."
403 (dolist (name cmds) 429 (dolist (name cmds)
404 (and (symbolp name) 430 (and (symbolp name)
405 (setq name (symbol-name name))) 431 (setq name (symbol-name name)))
406 (unintern name eldoc-message-commands))) 432 (unintern name eldoc-message-commands)))
407 433
408(defun eldoc-remove-command-completions (&rest names) 434(defun eldoc-remove-command-completions (&rest names)
435 "Pass every prefix completion of NAMES to `eldoc-remove-command'."
409 (dolist (name names) 436 (dolist (name names)
410 (apply #'eldoc-remove-command 437 (apply #'eldoc-remove-command
411 (all-completions name eldoc-message-commands)))) 438 (all-completions name eldoc-message-commands))))
@@ -418,9 +445,9 @@ return any documentation.")
418 "down-list" "end-of-" "exchange-point-and-mark" "forward-" "goto-" 445 "down-list" "end-of-" "exchange-point-and-mark" "forward-" "goto-"
419 "handle-select-window" "indent-for-tab-command" "left-" "mark-page" 446 "handle-select-window" "indent-for-tab-command" "left-" "mark-page"
420 "mark-paragraph" "mouse-set-point" "move-" "move-beginning-of-" 447 "mark-paragraph" "mouse-set-point" "move-" "move-beginning-of-"
421 "move-end-of-" "newline" "next-" "other-window" "pop-global-mark" "previous-" 448 "move-end-of-" "newline" "next-" "other-window" "pop-global-mark"
422 "recenter" "right-" "scroll-" "self-insert-command" "split-window-" 449 "previous-" "recenter" "right-" "scroll-" "self-insert-command"
423 "up-list") 450 "split-window-" "up-list")
424 451
425(provide 'eldoc) 452(provide 'eldoc)
426 453
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index d4500f131a2..7bdd749d5ab 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -583,6 +583,11 @@ displayed."
583 (elp-restore-all) 583 (elp-restore-all)
584 ;; continue standard unloading 584 ;; continue standard unloading
585 nil) 585 nil)
586
587(cl-defmethod loadhist-unload-element :before :extra "elp" ((x (head defun)))
588 "Un-instrument before unloading a function."
589 (elp-restore-function (cdr x)))
590
586 591
587(provide 'elp) 592(provide 'elp)
588 593
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index cee225cc8e0..d7bd331c11b 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -135,7 +135,7 @@ Emacs bug 6581 at URL `http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6581'."
135 ;; Note that nil is still a valid value for the `name' slot in 135 ;; Note that nil is still a valid value for the `name' slot in
136 ;; ert-test objects. It designates an anonymous test. 136 ;; ert-test objects. It designates an anonymous test.
137 (error "Attempt to define a test named nil")) 137 (error "Attempt to define a test named nil"))
138 (put symbol 'ert--test definition) 138 (define-symbol-prop symbol 'ert--test definition)
139 definition) 139 definition)
140 140
141(defun ert-make-test-unbound (symbol) 141(defun ert-make-test-unbound (symbol)
@@ -214,12 +214,6 @@ description of valid values for RESULT-TYPE.
214 ,@(when tags-supplied-p 214 ,@(when tags-supplied-p
215 `(:tags ,tags)) 215 `(:tags ,tags))
216 :body (lambda () ,@body))) 216 :body (lambda () ,@body)))
217 ;; This hack allows `symbol-file' to associate `ert-deftest'
218 ;; forms with files, and therefore enables `find-function' to
219 ;; work with tests. However, it leads to warnings in
220 ;; `unload-feature', which doesn't know how to undefine tests
221 ;; and has no mechanism for extension.
222 (push '(ert-deftest . ,name) current-load-list)
223 ',name)))) 217 ',name))))
224 218
225;; We use these `put' forms in addition to the (declare (indent)) in 219;; We use these `put' forms in addition to the (declare (indent)) in
@@ -2405,8 +2399,7 @@ To be used in the ERT results buffer."
2405 (buffer-disable-undo) 2399 (buffer-disable-undo)
2406 (erase-buffer) 2400 (erase-buffer)
2407 (ert-simple-view-mode) 2401 (ert-simple-view-mode)
2408 ;; Use unibyte because `debugger-setup-buffer' also does so. 2402 (set-buffer-multibyte t) ; mimic debugger-setup-buffer
2409 (set-buffer-multibyte nil)
2410 (setq truncate-lines t) 2403 (setq truncate-lines t)
2411 (ert--print-backtrace backtrace t) 2404 (ert--print-backtrace backtrace t)
2412 (goto-char (point-min)) 2405 (goto-char (point-min))
@@ -2539,7 +2532,7 @@ To be used in the ERT results buffer."
2539 (insert (if test-name (format "%S" test-name) "<anonymous test>")) 2532 (insert (if test-name (format "%S" test-name) "<anonymous test>"))
2540 (insert " is a test") 2533 (insert " is a test")
2541 (let ((file-name (and test-name 2534 (let ((file-name (and test-name
2542 (symbol-file test-name 'ert-deftest)))) 2535 (symbol-file test-name 'ert--test))))
2543 (when file-name 2536 (when file-name
2544 (insert (format-message " defined in `%s'" 2537 (insert (format-message " defined in `%s'"
2545 (file-name-nondirectory file-name))) 2538 (file-name-nondirectory file-name)))
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 4a06ab25d3e..253b60e7534 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -418,8 +418,8 @@ to this macro."
418 (when decl (setq body (remove decl body))) 418 (when decl (setq body (remove decl body)))
419 `(progn 419 `(progn
420 (defun ,fsym ,args ,@body) 420 (defun ,fsym ,args ,@body)
421 (put ',fsym 'edebug-form-spec ',(cadr (assq 'debug decl))) 421 (define-symbol-prop ',fsym 'edebug-form-spec ',(cadr (assq 'debug decl)))
422 (put ',name 'pcase-macroexpander #',fsym)))) 422 (define-symbol-prop ',name 'pcase-macroexpander #',fsym))))
423 423
424(defun pcase--match (val upat) 424(defun pcase--match (val upat)
425 "Build a MATCH structure, hoisting all `or's and `and's outside." 425 "Build a MATCH structure, hoisting all `or's and `and's outside."
@@ -930,6 +930,5 @@ QPAT can take the following forms:
930 ((or (stringp qpat) (integerp qpat) (symbolp qpat)) `',qpat) 930 ((or (stringp qpat) (integerp qpat) (symbolp qpat)) `',qpat)
931 (t (error "Unknown QPAT: %S" qpat)))) 931 (t (error "Unknown QPAT: %S" qpat))))
932 932
933
934(provide 'pcase) 933(provide 'pcase)
935;;; pcase.el ends here 934;;; pcase.el ends here
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 386232c6eef..b66f2c6d512 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1169,6 +1169,62 @@ enclosed in `(and ...)'.
1169 (rx-to-string `(and ,@regexps) t)) 1169 (rx-to-string `(and ,@regexps) t))
1170 (t 1170 (t
1171 (rx-to-string (car regexps) t)))) 1171 (rx-to-string (car regexps) t))))
1172
1173
1174(pcase-defmacro rx (&rest regexps)
1175 "Build a `pcase' pattern matching `rx' regexps.
1176The REGEXPS are interpreted as by `rx'. The pattern matches if
1177the regular expression so constructed matches the object, as if
1178by `string-match'.
1179
1180In addition to the usual `rx' constructs, REGEXPS can contain the
1181following constructs:
1182
1183 (let VAR FORM...) creates a new explicitly numbered submatch
1184 that matches FORM and binds the match to
1185 VAR.
1186 (backref VAR) creates a backreference to the submatch
1187 introduced by a previous (let VAR ...)
1188 construct.
1189
1190The VARs are associated with explicitly numbered submatches
1191starting from 1. Multiple occurrences of the same VAR refer to
1192the same submatch.
1193
1194If a case matches, the match data is modified as usual so you can
1195use it in the case body, but you still have to pass the correct
1196string as argument to `match-string'."
1197 (let* ((vars ())
1198 (rx-constituents
1199 `((let
1200 ,(lambda (form)
1201 (rx-check form)
1202 (let ((var (cadr form)))
1203 (cl-check-type var symbol)
1204 (let ((i (or (cl-position var vars :test #'eq)
1205 (prog1 (length vars)
1206 (setq vars `(,@vars ,var))))))
1207 (rx-form `(submatch-n ,(1+ i) ,@(cddr form))))))
1208 1 nil)
1209 (backref
1210 ,(lambda (form)
1211 (rx-check form)
1212 (rx-backref
1213 `(backref ,(let ((var (cadr form)))
1214 (if (integerp var) var
1215 (1+ (cl-position var vars :test #'eq)))))))
1216 1 1
1217 ,(lambda (var)
1218 (cond ((integerp var) (rx-check-backref var))
1219 ((memq var vars) t)
1220 (t (error "rx `backref' variable must be one of %s: %s"
1221 vars var)))))
1222 ,@rx-constituents))
1223 (regexp (rx-to-string `(seq ,@regexps) :no-group)))
1224 `(and (pred (string-match ,regexp))
1225 ,@(cl-loop for i from 1
1226 for var in vars
1227 collect `(app (match-string ,i) ,var)))))
1172 1228
1173;; ;; sregex.el replacement 1229;; ;; sregex.el replacement
1174 1230
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 79799db30bc..4a5adc48f2b 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -65,17 +65,19 @@ This is useful for enabling human-readable format (-h), for example."
65 "If non-nil, use `eshell-ls' to read directories in Dired. 65 "If non-nil, use `eshell-ls' to read directories in Dired.
66Changing this without using customize has no effect." 66Changing this without using customize has no effect."
67 :set (lambda (symbol value) 67 :set (lambda (symbol value)
68 (if value 68 (cond (value
69 (advice-add 'insert-directory :around 69 (require 'dired)
70 #'eshell-ls--insert-directory) 70 (advice-add 'insert-directory :around
71 (advice-remove 'insert-directory 71 #'eshell-ls--insert-directory)
72 #'eshell-ls--insert-directory)) 72 (advice-add 'dired :around #'eshell-ls--dired))
73 (t
74 (advice-remove 'insert-directory
75 #'eshell-ls--insert-directory)
76 (advice-remove 'dired #'eshell-ls--dired)))
73 (set symbol value)) 77 (set symbol value))
74 :type 'boolean 78 :type 'boolean
75 :require 'em-ls) 79 :require 'em-ls)
76(add-hook 'eshell-ls-unload-hook 80(add-hook 'eshell-ls-unload-hook #'eshell-ls-unload-function)
77 (lambda () (advice-remove 'insert-directory
78 #'eshell-ls--insert-directory)))
79 81
80 82
81(defcustom eshell-ls-default-blocksize 1024 83(defcustom eshell-ls-default-blocksize 1024
@@ -279,6 +281,36 @@ instead."
279 eshell-ls-dired-initial-args) 281 eshell-ls-dired-initial-args)
280 (eshell-do-ls (append switches (list file))))))))) 282 (eshell-do-ls (append switches (list file)))))))))
281 283
284(declare-function eshell-extended-glob "em-glob" (glob))
285(declare-function dired-read-dir-and-switches "dired" (str))
286(declare-function dired-goto-next-file "dired" ())
287
288(defun eshell-ls--dired (orig-fun dir-or-list &optional switches)
289 (interactive (dired-read-dir-and-switches ""))
290 (require 'em-glob)
291 (if (consp dir-or-list)
292 (funcall orig-fun dir-or-list switches)
293 (let ((dir-wildcard (insert-directory-wildcard-in-dir-p
294 (expand-file-name dir-or-list))))
295 (if (not dir-wildcard)
296 (funcall orig-fun dir-or-list switches)
297 (let* ((default-directory (car dir-wildcard))
298 (files (eshell-extended-glob (cdr dir-wildcard)))
299 (dir (car dir-wildcard)))
300 (if files
301 (let ((inhibit-read-only t)
302 (buf
303 (apply orig-fun
304 (nconc (list dir) files)
305 (and switches (list switches)))))
306 (with-current-buffer buf
307 (save-excursion
308 (goto-char (point-min))
309 (dired-goto-next-file)
310 (forward-line 0)
311 (insert " wildcard " (cdr dir-wildcard) "\n"))))
312 (user-error "No files matching regexp")))))))
313
282(defsubst eshell/ls (&rest args) 314(defsubst eshell/ls (&rest args)
283 "An alias version of `eshell-do-ls'." 315 "An alias version of `eshell-do-ls'."
284 (let ((insert-func 'eshell-buffered-print) 316 (let ((insert-func 'eshell-buffered-print)
@@ -909,6 +941,11 @@ to use, and each member of which is the width of that column
909 (car file))))) 941 (car file)))))
910 (car file)) 942 (car file))
911 943
944(defun eshell-ls-unload-function ()
945 (advice-remove 'insert-directory #'eshell-ls--insert-directory)
946 (advice-remove 'dired #'eshell-ls--dired)
947 nil)
948
912(provide 'em-ls) 949(provide 'em-ls)
913 950
914;; Local Variables: 951;; Local Variables:
diff --git a/lisp/faces.el b/lisp/faces.el
index 97c32165b9c..c0c1c7b59f0 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -104,7 +104,9 @@ a font height that isn't optimal."
104 ;; when combined with Monospaced and with other standard fonts. 104 ;; when combined with Monospaced and with other standard fonts.
105 ;; One of its uses is for 'tex-verbatim' and 'Info-quoted' faces, 105 ;; One of its uses is for 'tex-verbatim' and 'Info-quoted' faces,
106 ;; so the result must be different from the default face's font, 106 ;; so the result must be different from the default face's font,
107 ;; and must be monospaced. 107 ;; and must be monospaced. For 'tex-verbatim', it is desirable
108 ;; that the font really is a Serif font, so as to look like
109 ;; TeX's 'verbatim'.
108 ("Monospace Serif" 110 ("Monospace Serif"
109 111
110 ;; This looks good on GNU/Linux. 112 ;; This looks good on GNU/Linux.
diff --git a/lisp/files.el b/lisp/files.el
index 2f3efa33c28..96647fb2626 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -978,12 +978,15 @@ or mount points potentially requiring authentication as a different user.")
978;; nil))) 978;; nil)))
979 979
980(defun locate-dominating-file (file name) 980(defun locate-dominating-file (file name)
981 "Look up the directory hierarchy from FILE for a directory containing NAME. 981 "Starting from FILE, look up directory hierarchy for directory containing NAME.
982FILE can be a file or a directory. If it's a file, its directory will
983serve as the starting point for searching the hierarchy of directories.
982Stop at the first parent directory containing a file NAME, 984Stop at the first parent directory containing a file NAME,
983and return the directory. Return nil if not found. 985and return the directory. Return nil if not found.
984Instead of a string, NAME can also be a predicate taking one argument 986Instead of a string, NAME can also be a predicate taking one argument
985\(a directory) and returning a non-nil value if that directory is the one for 987\(a directory) and returning a non-nil value if that directory is the one for
986which we're looking." 988which we're looking. The predicate will be called with every file/directory
989the function needs to examine, starting with FILE."
987 ;; We used to use the above locate-dominating-files code, but the 990 ;; We used to use the above locate-dominating-files code, but the
988 ;; directory-files call is very costly, so we're much better off doing 991 ;; directory-files call is very costly, so we're much better off doing
989 ;; multiple calls using the code in here. 992 ;; multiple calls using the code in here.
@@ -1596,8 +1599,8 @@ automatically choosing a major mode, use \\[find-file-literally]."
1596 (confirm-nonexistent-file-or-buffer))) 1599 (confirm-nonexistent-file-or-buffer)))
1597 (let ((value (find-file-noselect filename nil nil wildcards))) 1600 (let ((value (find-file-noselect filename nil nil wildcards)))
1598 (if (listp value) 1601 (if (listp value)
1599 (mapcar 'switch-to-buffer (nreverse value)) 1602 (mapcar 'pop-to-buffer-same-window (nreverse value))
1600 (switch-to-buffer value)))) 1603 (pop-to-buffer-same-window value))))
1601 1604
1602(defun find-file-other-window (filename &optional wildcards) 1605(defun find-file-other-window (filename &optional wildcards)
1603 "Edit file FILENAME, in another window. 1606 "Edit file FILENAME, in another window.
@@ -2543,7 +2546,7 @@ since only a single case-insensitive search through the alist is made."
2543 ("\\.[ckz]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode) 2546 ("\\.[ckz]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
2544 ("\\.bash\\'" . sh-mode) 2547 ("\\.bash\\'" . sh-mode)
2545 ("\\(/\\|\\`\\)\\.\\(bash_\\(profile\\|history\\|log\\(in\\|out\\)\\)\\|z?log\\(in\\|out\\)\\)\\'" . sh-mode) 2548 ("\\(/\\|\\`\\)\\.\\(bash_\\(profile\\|history\\|log\\(in\\|out\\)\\)\\|z?log\\(in\\|out\\)\\)\\'" . sh-mode)
2546 ("\\(/\\|\\`\\)\\.\\(shrc\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode) 2549 ("\\(/\\|\\`\\)\\.\\(shrc\\|zshrc\\|m?kshrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode)
2547 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode) 2550 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode)
2548 ("\\.m?spec\\'" . sh-mode) 2551 ("\\.m?spec\\'" . sh-mode)
2549 ("\\.m[mes]\\'" . nroff-mode) 2552 ("\\.m[mes]\\'" . nroff-mode)
@@ -6552,6 +6555,75 @@ regardless of the language.")
6552 6555
6553(defvar insert-directory-ls-version 'unknown) 6556(defvar insert-directory-ls-version 'unknown)
6554 6557
6558(defun insert-directory-wildcard-in-dir-p (dir)
6559 "Return non-nil if DIR contents a shell wildcard in the directory part.
6560The return value is a cons (DIR . WILDCARDS); DIR is the
6561`default-directory' in the Dired buffer, and WILDCARDS are the wildcards.
6562
6563Valid wildcards are '*', '?', '[abc]' and '[a-z]'."
6564 (let ((wildcards "[?*"))
6565 (when (and (or (not (featurep 'ls-lisp))
6566 ls-lisp-support-shell-wildcards)
6567 (string-match (concat "[" wildcards "]") (file-name-directory dir))
6568 (not (file-exists-p dir))) ; Prefer an existing file to wildcards.
6569 (let ((regexp (format "\\`\\([^%s]+/\\)\\([^%s]*[%s].*\\)"
6570 wildcards wildcards wildcards)))
6571 (string-match regexp dir)
6572 (cons (match-string 1 dir) (match-string 2 dir))))))
6573
6574(defun insert-directory-clean (beg switches)
6575 (when (if (stringp switches)
6576 (string-match "--dired\\>" switches)
6577 (member "--dired" switches))
6578 ;; The following overshoots by one line for an empty
6579 ;; directory listed with "--dired", but without "-a"
6580 ;; switch, where the ls output contains a
6581 ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
6582 ;; We take care of that case later.
6583 (forward-line -2)
6584 (when (looking-at "//SUBDIRED//")
6585 (delete-region (point) (progn (forward-line 1) (point)))
6586 (forward-line -1))
6587 (if (looking-at "//DIRED//")
6588 (let ((end (line-end-position))
6589 (linebeg (point))
6590 error-lines)
6591 ;; Find all the lines that are error messages,
6592 ;; and record the bounds of each one.
6593 (goto-char beg)
6594 (while (< (point) linebeg)
6595 (or (eql (following-char) ?\s)
6596 (push (list (point) (line-end-position)) error-lines))
6597 (forward-line 1))
6598 (setq error-lines (nreverse error-lines))
6599 ;; Now read the numeric positions of file names.
6600 (goto-char linebeg)
6601 (forward-word-strictly 1)
6602 (forward-char 3)
6603 (while (< (point) end)
6604 (let ((start (insert-directory-adj-pos
6605 (+ beg (read (current-buffer)))
6606 error-lines))
6607 (end (insert-directory-adj-pos
6608 (+ beg (read (current-buffer)))
6609 error-lines)))
6610 (if (memq (char-after end) '(?\n ?\s))
6611 ;; End is followed by \n or by " -> ".
6612 (put-text-property start end 'dired-filename t)
6613 ;; It seems that we can't trust ls's output as to
6614 ;; byte positions of filenames.
6615 (put-text-property beg (point) 'dired-filename nil)
6616 (end-of-line))))
6617 (goto-char end)
6618 (beginning-of-line)
6619 (delete-region (point) (progn (forward-line 1) (point))))
6620 ;; Take care of the case where the ls output contains a
6621 ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line
6622 ;; and we went one line too far back (see above).
6623 (forward-line 1))
6624 (if (looking-at "//DIRED-OPTIONS//")
6625 (delete-region (point) (progn (forward-line 1) (point))))))
6626
6555;; insert-directory 6627;; insert-directory
6556;; - must insert _exactly_one_line_ describing FILE if WILDCARD and 6628;; - must insert _exactly_one_line_ describing FILE if WILDCARD and
6557;; FULL-DIRECTORY-P is nil. 6629;; FULL-DIRECTORY-P is nil.
@@ -6611,13 +6683,19 @@ normally equivalent short `-D' option is just passed on to
6611 default-file-name-coding-system)))) 6683 default-file-name-coding-system))))
6612 (setq result 6684 (setq result
6613 (if wildcard 6685 (if wildcard
6614 ;; Run ls in the directory part of the file pattern 6686 ;; If the wildcard is just in the file part, then run ls in
6615 ;; using the last component as argument. 6687 ;; the directory part of the file pattern using the last
6616 (let ((default-directory 6688 ;; component as argument. Otherwise, run ls in the longest
6617 (if (file-name-absolute-p file) 6689 ;; subdirectory of the directory part free of wildcards; use
6618 (file-name-directory file) 6690 ;; the remaining of the file pattern as argument.
6619 (file-name-directory (expand-file-name file)))) 6691 (let* ((dir-wildcard (insert-directory-wildcard-in-dir-p file))
6620 (pattern (file-name-nondirectory file))) 6692 (default-directory
6693 (cond (dir-wildcard (car dir-wildcard))
6694 (t
6695 (if (file-name-absolute-p file)
6696 (file-name-directory file)
6697 (file-name-directory (expand-file-name file))))))
6698 (pattern (if dir-wildcard (cdr dir-wildcard) (file-name-nondirectory file))))
6621 ;; NB since switches is passed to the shell, be 6699 ;; NB since switches is passed to the shell, be
6622 ;; careful of malicious values, eg "-l;reboot". 6700 ;; careful of malicious values, eg "-l;reboot".
6623 ;; See eg dired-safe-switches-p. 6701 ;; See eg dired-safe-switches-p.
@@ -6665,7 +6743,8 @@ normally equivalent short `-D' option is just passed on to
6665 (setq file (expand-file-name file))) 6743 (setq file (expand-file-name file)))
6666 (list 6744 (list
6667 (if full-directory-p 6745 (if full-directory-p
6668 (concat (file-name-as-directory file) ".") 6746 ;; (concat (file-name-as-directory file) ".")
6747 file
6669 file)))))))) 6748 file))))))))
6670 6749
6671 ;; If we got "//DIRED//" in the output, it means we got a real 6750 ;; If we got "//DIRED//" in the output, it means we got a real
@@ -6736,59 +6815,7 @@ normally equivalent short `-D' option is just passed on to
6736 ;; Unix. Access the file to get a suitable error. 6815 ;; Unix. Access the file to get a suitable error.
6737 (access-file file "Reading directory") 6816 (access-file file "Reading directory")
6738 (error "Listing directory failed but `access-file' worked"))) 6817 (error "Listing directory failed but `access-file' worked")))
6739 6818 (insert-directory-clean beg switches)
6740 (when (if (stringp switches)
6741 (string-match "--dired\\>" switches)
6742 (member "--dired" switches))
6743 ;; The following overshoots by one line for an empty
6744 ;; directory listed with "--dired", but without "-a"
6745 ;; switch, where the ls output contains a
6746 ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
6747 ;; We take care of that case later.
6748 (forward-line -2)
6749 (when (looking-at "//SUBDIRED//")
6750 (delete-region (point) (progn (forward-line 1) (point)))
6751 (forward-line -1))
6752 (if (looking-at "//DIRED//")
6753 (let ((end (line-end-position))
6754 (linebeg (point))
6755 error-lines)
6756 ;; Find all the lines that are error messages,
6757 ;; and record the bounds of each one.
6758 (goto-char beg)
6759 (while (< (point) linebeg)
6760 (or (eql (following-char) ?\s)
6761 (push (list (point) (line-end-position)) error-lines))
6762 (forward-line 1))
6763 (setq error-lines (nreverse error-lines))
6764 ;; Now read the numeric positions of file names.
6765 (goto-char linebeg)
6766 (forward-word-strictly 1)
6767 (forward-char 3)
6768 (while (< (point) end)
6769 (let ((start (insert-directory-adj-pos
6770 (+ beg (read (current-buffer)))
6771 error-lines))
6772 (end (insert-directory-adj-pos
6773 (+ beg (read (current-buffer)))
6774 error-lines)))
6775 (if (memq (char-after end) '(?\n ?\s))
6776 ;; End is followed by \n or by " -> ".
6777 (put-text-property start end 'dired-filename t)
6778 ;; It seems that we can't trust ls's output as to
6779 ;; byte positions of filenames.
6780 (put-text-property beg (point) 'dired-filename nil)
6781 (end-of-line))))
6782 (goto-char end)
6783 (beginning-of-line)
6784 (delete-region (point) (progn (forward-line 1) (point))))
6785 ;; Take care of the case where the ls output contains a
6786 ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line
6787 ;; and we went one line too far back (see above).
6788 (forward-line 1))
6789 (if (looking-at "//DIRED-OPTIONS//")
6790 (delete-region (point) (progn (forward-line 1) (point)))))
6791
6792 ;; Now decode what read if necessary. 6819 ;; Now decode what read if necessary.
6793 (let ((coding (or coding-system-for-read 6820 (let ((coding (or coding-system-for-read
6794 file-name-coding-system 6821 file-name-coding-system
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index a92d477e1e0..2292b5f32d4 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -1,4 +1,4 @@
1;;; find-dired.el --- run a `find' command and dired the output 1;;; find-dired.el --- run a `find' command and dired the output -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1992, 1994-1995, 2000-2017 Free Software Foundation, 3;; Copyright (C) 1992, 1994-1995, 2000-2017 Free Software Foundation,
4;; Inc. 4;; Inc.
diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el
index e9f844487bc..a795211f4fe 100644
--- a/lisp/find-lisp.el
+++ b/lisp/find-lisp.el
@@ -1,4 +1,4 @@
1;;; find-lisp.el --- emulation of find in Emacs Lisp 1;;; find-lisp.el --- emulation of find in Emacs Lisp -*- lexical-binding: t -*-
2 2
3;; Author: Peter Breton 3;; Author: Peter Breton
4;; Created: Fri Mar 26 1999 4;; Created: Fri Mar 26 1999
diff --git a/lisp/frame.el b/lisp/frame.el
index 99d9159be9e..67b6bb53d87 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2158,7 +2158,7 @@ To adjust bottom dividers for frames individually, use the frame
2158parameter `bottom-divider-width'." 2158parameter `bottom-divider-width'."
2159 :type '(restricted-sexp 2159 :type '(restricted-sexp
2160 :tag "Default width of bottom dividers" 2160 :tag "Default width of bottom dividers"
2161 :match-alternatives (frame-window-divider-width-valid-p)) 2161 :match-alternatives (window-divider-width-valid-p))
2162 :initialize 'custom-initialize-default 2162 :initialize 'custom-initialize-default
2163 :set (lambda (symbol value) 2163 :set (lambda (symbol value)
2164 (set-default symbol value) 2164 (set-default symbol value)
@@ -2175,7 +2175,7 @@ To adjust right dividers for frames individually, use the frame
2175parameter `right-divider-width'." 2175parameter `right-divider-width'."
2176 :type '(restricted-sexp 2176 :type '(restricted-sexp
2177 :tag "Default width of right dividers" 2177 :tag "Default width of right dividers"
2178 :match-alternatives (frame-window-divider-width-valid-p)) 2178 :match-alternatives (window-divider-width-valid-p))
2179 :initialize 'custom-initialize-default 2179 :initialize 'custom-initialize-default
2180 :set (lambda (symbol value) 2180 :set (lambda (symbol value)
2181 (set-default symbol value) 2181 (set-default symbol value)
diff --git a/lisp/ido.el b/lisp/ido.el
index 07a5bcf7229..defb744201d 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1,4 +1,4 @@
1;;; ido.el --- interactively do things with buffers and files 1;;; ido.el --- interactively do things with buffers and files -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1996-2017 Free Software Foundation, Inc. 3;; Copyright (C) 1996-2017 Free Software Foundation, Inc.
4 4
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 838a492b6cb..2db8061fa4a 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -1,4 +1,4 @@
1;;; kmacro.el --- enhanced keyboard macros 1;;; kmacro.el --- enhanced keyboard macros -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2002-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
4 4
@@ -565,7 +565,8 @@ Use \\[kmacro-insert-counter] to insert (and increment) the macro counter.
565The counter value can be set or modified via \\[kmacro-set-counter] and \\[kmacro-add-counter]. 565The counter value can be set or modified via \\[kmacro-set-counter] and \\[kmacro-add-counter].
566The format of the counter can be modified via \\[kmacro-set-format]. 566The format of the counter can be modified via \\[kmacro-set-format].
567 567
568Use \\[kmacro-name-last-macro] to give it a permanent name. 568Use \\[kmacro-name-last-macro] to give it a name that will remain valid even
569after another macro is defined.
569Use \\[kmacro-bind-to-key] to bind it to a key sequence." 570Use \\[kmacro-bind-to-key] to bind it to a key sequence."
570 (interactive "P") 571 (interactive "P")
571 (if (or defining-kbd-macro executing-kbd-macro) 572 (if (or defining-kbd-macro executing-kbd-macro)
@@ -628,8 +629,8 @@ just the last key in the key sequence that you used to call this
628command. See `kmacro-call-repeat-key' and `kmacro-call-repeat-with-arg' 629command. See `kmacro-call-repeat-key' and `kmacro-call-repeat-with-arg'
629for details on how to adjust or disable this behavior. 630for details on how to adjust or disable this behavior.
630 631
631To make a macro permanent so you can call it even after defining 632To give a macro a name so you can call it even after defining others,
632others, use \\[kmacro-name-last-macro]." 633use \\[kmacro-name-last-macro]."
633 (interactive "p") 634 (interactive "p")
634 (let ((repeat-key (and (or (and (null no-repeat) 635 (let ((repeat-key (and (or (and (null no-repeat)
635 (> (length (this-single-command-keys)) 1)) 636 (> (length (this-single-command-keys)) 1))
@@ -730,8 +731,8 @@ With \\[universal-argument], call second macro in macro ring."
730With numeric prefix ARG, repeat macro that many times. 731With numeric prefix ARG, repeat macro that many times.
731Zero argument means repeat until there is an error. 732Zero argument means repeat until there is an error.
732 733
733To give a macro a permanent name, so you can call it 734To give a macro a name, so you can call it even after defining other
734even after defining other macros, use \\[kmacro-name-last-macro]." 735macros, use \\[kmacro-name-last-macro]."
735 (interactive "P") 736 (interactive "P")
736 (if defining-kbd-macro 737 (if defining-kbd-macro
737 (kmacro-end-macro nil)) 738 (kmacro-end-macro nil))
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 28d0b18c812..18c30f781f0 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -162,6 +162,70 @@ documentation of `unload-feature' for details.")
162 ;; mode, or proposed is not nil and not major-mode, and so we use it. 162 ;; mode, or proposed is not nil and not major-mode, and so we use it.
163 (funcall (or proposed 'fundamental-mode))))))) 163 (funcall (or proposed 'fundamental-mode)))))))
164 164
165(cl-defgeneric loadhist-unload-element (x)
166 "Unload an element from the `load-history'."
167 (message "Unexpected element %S in load-history" x))
168
169;; In `load-history', the definition of a previously autoloaded
170;; function is represented by 2 entries: (t . SYMBOL) comes before
171;; (defun . SYMBOL) and says we should restore SYMBOL's autoload when
172;; we undefine it.
173;; So we use this auxiliary variable to keep track of the last (t . SYMBOL)
174;; that occurred.
175(defvar loadhist--restore-autoload
176 "If non-nil, this is a symbol for which we should
177restore a previous autoload if possible.")
178
179(cl-defmethod loadhist-unload-element ((x (head t)))
180 (setq loadhist--restore-autoload (cdr x)))
181
182(defun loadhist--unload-function (x)
183 (let ((fun (cdr x)))
184 (when (fboundp fun)
185 (when (fboundp 'ad-unadvise)
186 (ad-unadvise fun))
187 (let ((aload (get fun 'autoload)))
188 (defalias fun
189 (if (and aload (eq fun loadhist--restore-autoload))
190 (cons 'autoload aload)
191 nil)))))
192 (setq loadhist--restore-autoload nil))
193
194(cl-defmethod loadhist-unload-element ((x (head defun)))
195 (loadhist--unload-function x))
196(cl-defmethod loadhist-unload-element ((x (head autoload)))
197 (loadhist--unload-function x))
198
199(cl-defmethod loadhist-unload-element ((_ (head require))) nil)
200(cl-defmethod loadhist-unload-element ((_ (head defface))) nil)
201
202(cl-defmethod loadhist-unload-element ((x (head provide)))
203 ;; Remove any feature names that this file provided.
204 (setq features (delq (cdr x) features)))
205
206(cl-defmethod loadhist-unload-element ((x symbol))
207 ;; Kill local values as much as possible.
208 (dolist (buf (buffer-list))
209 (with-current-buffer buf
210 (if (and (boundp x) (timerp (symbol-value x)))
211 (cancel-timer (symbol-value x)))
212 (kill-local-variable x)))
213 (if (and (boundp x) (timerp (symbol-value x)))
214 (cancel-timer (symbol-value x)))
215 ;; Get rid of the default binding if we can.
216 (unless (local-variable-if-set-p x)
217 (makunbound x)))
218
219(cl-defmethod loadhist-unload-element ((x (head define-type)))
220 (let* ((name (cdr x)))
221 ;; Remove the struct.
222 (setf (cl--find-class name) nil)))
223
224(cl-defmethod loadhist-unload-element ((x (head define-symbol-props)))
225 (pcase-dolist (`(,symbol . ,props) (cdr x))
226 (dolist (prop props)
227 (put symbol prop nil))))
228
165;;;###autoload 229;;;###autoload
166(defun unload-feature (feature &optional force) 230(defun unload-feature (feature &optional force)
167 "Unload the library that provided FEATURE. 231 "Unload the library that provided FEATURE.
@@ -200,9 +264,6 @@ something strange, such as redefining an Emacs function."
200 (prin1-to-string dependents) file)))) 264 (prin1-to-string dependents) file))))
201 (let* ((unload-function-defs-list (feature-symbols feature)) 265 (let* ((unload-function-defs-list (feature-symbols feature))
202 (file (pop unload-function-defs-list)) 266 (file (pop unload-function-defs-list))
203 ;; If non-nil, this is a symbol for which we should
204 ;; restore a previous autoload if possible.
205 restore-autoload
206 (name (symbol-name feature)) 267 (name (symbol-name feature))
207 (unload-hook (intern-soft (concat name "-unload-hook"))) 268 (unload-hook (intern-soft (concat name "-unload-hook")))
208 (unload-func (intern-soft (concat name "-unload-function")))) 269 (unload-func (intern-soft (concat name "-unload-function"))))
@@ -245,43 +306,7 @@ something strange, such as redefining an Emacs function."
245 ;; Change major mode in all buffers using one defined in the feature being unloaded. 306 ;; Change major mode in all buffers using one defined in the feature being unloaded.
246 (unload--set-major-mode) 307 (unload--set-major-mode)
247 308
248 (when (fboundp 'elp-restore-function) ; remove ELP stuff first 309 (mapc #'loadhist-unload-element unload-function-defs-list)
249 (dolist (elt unload-function-defs-list)
250 (when (symbolp elt)
251 (elp-restore-function elt))))
252
253 (dolist (x unload-function-defs-list)
254 (if (consp x)
255 (pcase (car x)
256 ;; Remove any feature names that this file provided.
257 (`provide
258 (setq features (delq (cdr x) features)))
259 ((or `defun `autoload)
260 (let ((fun (cdr x)))
261 (when (fboundp fun)
262 (when (fboundp 'ad-unadvise)
263 (ad-unadvise fun))
264 (let ((aload (get fun 'autoload)))
265 (if (and aload (eq fun restore-autoload))
266 (fset fun (cons 'autoload aload))
267 (fmakunbound fun))))))
268 ;; (t . SYMBOL) comes before (defun . SYMBOL)
269 ;; and says we should restore SYMBOL's autoload
270 ;; when we undefine it.
271 (`t (setq restore-autoload (cdr x)))
272 ((or `require `defface) nil)
273 (_ (message "Unexpected element %s in load-history" x)))
274 ;; Kill local values as much as possible.
275 (dolist (buf (buffer-list))
276 (with-current-buffer buf
277 (if (and (boundp x) (timerp (symbol-value x)))
278 (cancel-timer (symbol-value x)))
279 (kill-local-variable x)))
280 (if (and (boundp x) (timerp (symbol-value x)))
281 (cancel-timer (symbol-value x)))
282 ;; Get rid of the default binding if we can.
283 (unless (local-variable-if-set-p x)
284 (makunbound x))))
285 ;; Delete the load-history element for this file. 310 ;; Delete the load-history element for this file.
286 (setq load-history (delq (assoc file load-history) load-history)))) 311 (setq load-history (delq (assoc file load-history) load-history))))
287 ;; Don't return load-history, it is not useful. 312 ;; Don't return load-history, it is not useful.
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index b368efbbc95..2f723ca8ac8 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -1,4 +1,4 @@
1;;; ls-lisp.el --- emulate insert-directory completely in Emacs Lisp 1;;; ls-lisp.el --- emulate insert-directory completely in Emacs Lisp -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1992, 1994, 2000-2017 Free Software Foundation, Inc. 3;; Copyright (C) 1992, 1994, 2000-2017 Free Software Foundation, Inc.
4 4
@@ -60,6 +60,8 @@
60 60
61;;; Code: 61;;; Code:
62 62
63
64
63(defgroup ls-lisp nil 65(defgroup ls-lisp nil
64 "Emulate the ls program completely in Emacs Lisp." 66 "Emulate the ls program completely in Emacs Lisp."
65 :version "21.1" 67 :version "21.1"
@@ -477,6 +479,37 @@ not contain `d', so that a full listing is expected."
477 (message "%s: doesn't exist or is inaccessible" file) 479 (message "%s: doesn't exist or is inaccessible" file)
478 (ding) (sit-for 2))))) ; to show user the message! 480 (ding) (sit-for 2))))) ; to show user the message!
479 481
482
483(declare-function eshell-extended-glob "em-glob" (glob))
484(declare-function dired-read-dir-and-switches "dired" (str))
485(declare-function dired-goto-next-file "dired" ())
486
487(defun ls-lisp--dired (orig-fun dir-or-list &optional switches)
488 (interactive (dired-read-dir-and-switches ""))
489 (require 'em-glob)
490 (if (consp dir-or-list)
491 (funcall orig-fun dir-or-list switches)
492 (let ((dir-wildcard (insert-directory-wildcard-in-dir-p
493 (expand-file-name dir-or-list))))
494 (if (not dir-wildcard)
495 (funcall orig-fun dir-or-list switches)
496 (let* ((default-directory (car dir-wildcard))
497 (files (eshell-extended-glob (cdr dir-wildcard)))
498 (dir (car dir-wildcard)))
499 (if files
500 (let ((inhibit-read-only t)
501 (buf
502 (apply orig-fun (nconc (list dir) files) (and switches (list switches)))))
503 (with-current-buffer buf
504 (save-excursion
505 (goto-char (point-min))
506 (dired-goto-next-file)
507 (forward-line 0)
508 (insert " wildcard " (cdr dir-wildcard) "\n"))))
509 (user-error "No files matching regexp")))))))
510
511(advice-add 'dired :around #'ls-lisp--dired)
512
480(defun ls-lisp-sanitize (file-alist) 513(defun ls-lisp-sanitize (file-alist)
481 "Sanitize the elements in FILE-ALIST. 514 "Sanitize the elements in FILE-ALIST.
482Fixes any elements in the alist for directory entries whose file 515Fixes any elements in the alist for directory entries whose file
@@ -866,6 +899,13 @@ All ls time options, namely c, t and u, are handled."
866 file-size) 899 file-size)
867 (format " %6s" (file-size-human-readable file-size)))) 900 (format " %6s" (file-size-human-readable file-size))))
868 901
902(defun ls-lisp-unload-function ()
903 "Unload ls-lisp library."
904 (advice-remove 'insert-directory #'ls-lisp--insert-directory)
905 (advice-remove 'dired #'ls-lisp--dired)
906 ;; Continue standard unloading.
907 nil)
908
869(provide 'ls-lisp) 909(provide 'ls-lisp)
870 910
871;;; ls-lisp.el ends here 911;;; ls-lisp.el ends here
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 4a569783293..05a336bfe28 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1101,23 +1101,68 @@ The selected font will be the default on both the existing and future frames."
1101 :button (:radio . (eq tool-bar-mode nil)))) 1101 :button (:radio . (eq tool-bar-mode nil))))
1102 menu))) 1102 menu)))
1103 1103
1104(defun toggle-display-line-numbers () 1104(defun menu-bar-display-line-numbers-mode (type)
1105 (interactive) 1105 (setq display-line-numbers-type type)
1106 (if display-line-numbers 1106 (if global-display-line-numbers-mode
1107 (setq display-line-numbers nil) 1107 (global-display-line-numbers-mode)
1108 (setq display-line-numbers t)) 1108 (display-line-numbers-mode)))
1109 (force-mode-line-update)) 1109
1110(defvar menu-bar-showhide-line-numbers-menu
1111 (let ((menu (make-sparse-keymap "Line Numbers")))
1112
1113 (bindings--define-key menu [visual]
1114 `(menu-item "Visual Line Numbers"
1115 ,(lambda ()
1116 (interactive)
1117 (menu-bar-display-line-numbers-mode 'visual)
1118 (message "Visual line numbers enabled"))
1119 :help "Enable visual line numbers"
1120 :button (:radio . (eq display-line-numbers 'visual))
1121 :visible (menu-bar-menu-frame-live-and-visible-p)))
1122
1123 (bindings--define-key menu [relative]
1124 `(menu-item "Relative Line Numbers"
1125 ,(lambda ()
1126 (interactive)
1127 (menu-bar-display-line-numbers-mode 'relative)
1128 (message "Relative line numbers enabled"))
1129 :help "Enable relative line numbers"
1130 :button (:radio . (eq display-line-numbers 'relative))
1131 :visible (menu-bar-menu-frame-live-and-visible-p)))
1132
1133 (bindings--define-key menu [absolute]
1134 `(menu-item "Absolute Line Numbers"
1135 ,(lambda ()
1136 (interactive)
1137 (menu-bar-display-line-numbers-mode t)
1138 (setq display-line-numbers t)
1139 (message "Absolute line numbers enabled"))
1140 :help "Enable absolute line numbers"
1141 :button (:radio . (eq display-line-numbers t))
1142 :visible (menu-bar-menu-frame-live-and-visible-p)))
1143
1144 (bindings--define-key menu [none]
1145 `(menu-item "No Line Numbers"
1146 ,(lambda ()
1147 (interactive)
1148 (menu-bar-display-line-numbers-mode nil)
1149 (message "Line numbers disabled"))
1150 :help "Disable line numbers"
1151 :button (:radio . (null display-line-numbers))
1152 :visible (menu-bar-menu-frame-live-and-visible-p)))
1153
1154 (bindings--define-key menu [global]
1155 (menu-bar-make-mm-toggle global-display-line-numbers-mode
1156 "Global Line Numbers Mode"
1157 "Set line numbers globally"))
1158 menu))
1110 1159
1111(defvar menu-bar-showhide-menu 1160(defvar menu-bar-showhide-menu
1112 (let ((menu (make-sparse-keymap "Show/Hide"))) 1161 (let ((menu (make-sparse-keymap "Show/Hide")))
1113 1162
1114 (bindings--define-key menu [display-line-numbers] 1163 (bindings--define-key menu [display-line-numbers]
1115 `(menu-item "Line Numbers for All Lines" 1164 `(menu-item "Line Numbers for All Lines"
1116 ,(lambda () 1165 ,menu-bar-showhide-line-numbers-menu))
1117 (interactive)
1118 (toggle-display-line-numbers))
1119 :help "Show the line number alongside each line"
1120 :button (:toggle . display-line-numbers)))
1121 1166
1122 (bindings--define-key menu [column-number-mode] 1167 (bindings--define-key menu [column-number-mode]
1123 (menu-bar-make-mm-toggle column-number-mode 1168 (menu-bar-make-mm-toggle column-number-mode
@@ -2375,10 +2420,6 @@ FROM-MENU-BAR, if non-nil, means we are dropping one of menu-bar's menus."
2375 ;; `setup-specified-language-environment', for instance, 2420 ;; `setup-specified-language-environment', for instance,
2376 ;; expects this to be set from a menu keymap. 2421 ;; expects this to be set from a menu keymap.
2377 (setq last-command-event (car (last event))) 2422 (setq last-command-event (car (last event)))
2378 ;; Update `this-command' and run `pre-command-hook' so that
2379 ;; things like `delete-selection-pre-hook' will work correctly.
2380 (setq this-command cmd)
2381 (run-hooks 'pre-command-hook)
2382 ;; mouse-major-mode-menu was using `command-execute' instead. 2423 ;; mouse-major-mode-menu was using `command-execute' instead.
2383 (call-interactively cmd)))) 2424 (call-interactively cmd))))
2384 2425
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 4d4e8a809e1..fe93fc32ad3 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -945,6 +945,7 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
945 (when (and (buffer-name buffer) 945 (when (and (buffer-name buffer)
946 (not (plist-get status :error))) 946 (not (plist-get status :error)))
947 (url-store-in-cache image-buffer) 947 (url-store-in-cache image-buffer)
948 (goto-char (point-min))
948 (when (or (search-forward "\n\n" nil t) 949 (when (or (search-forward "\n\n" nil t)
949 (search-forward "\r\n\r\n" nil t)) 950 (search-forward "\r\n\r\n" nil t))
950 (let ((data (shr-parse-image-data))) 951 (let ((data (shr-parse-image-data)))
@@ -998,7 +999,7 @@ element is the data blob and the second element is the content-type."
998 (create-image data nil t :ascent 100 999 (create-image data nil t :ascent 100
999 :format content-type)) 1000 :format content-type))
1000 ((eq content-type 'image/svg+xml) 1001 ((eq content-type 'image/svg+xml)
1001 (create-image data 'imagemagick t :ascent 100)) 1002 (create-image data 'svg t :ascent 100))
1002 ((eq size 'full) 1003 ((eq size 'full)
1003 (ignore-errors 1004 (ignore-errors
1004 (shr-rescale-image data content-type 1005 (shr-rescale-image data content-type
diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index 7be3c6fdb6f..cbc248b9ecf 100644
--- a/lisp/password-cache.el
+++ b/lisp/password-cache.el
@@ -66,7 +66,7 @@ Whether passwords are cached at all is controlled by `password-cache'."
66 :type '(choice (const :tag "Never" nil) 66 :type '(choice (const :tag "Never" nil)
67 (integer :tag "Seconds"))) 67 (integer :tag "Seconds")))
68 68
69(defvar password-data (make-vector 7 0)) 69(defvar password-data (make-hash-table :test #'equal))
70 70
71(defun password-read-from-cache (key) 71(defun password-read-from-cache (key)
72 "Obtain passphrase for KEY from time-limited passphrase cache. 72 "Obtain passphrase for KEY from time-limited passphrase cache.
@@ -74,20 +74,20 @@ Custom variables `password-cache' and `password-cache-expiry'
74regulate cache behavior." 74regulate cache behavior."
75 (and password-cache 75 (and password-cache
76 key 76 key
77 (symbol-value (intern-soft key password-data)))) 77 (gethash key password-data)))
78 78
79;;;###autoload 79;;;###autoload
80(defun password-in-cache-p (key) 80(defun password-in-cache-p (key)
81 "Check if KEY is in the cache." 81 "Check if KEY is in the cache."
82 (and password-cache 82 (and password-cache
83 key 83 key
84 (intern-soft key password-data))) 84 (gethash key password-data)))
85 85
86(defun password-read (prompt &optional key) 86(defun password-read (prompt &optional key)
87 "Read password, for use with KEY, from user, or from cache if wanted. 87 "Read password, for use with KEY, from user, or from cache if wanted.
88KEY indicate the purpose of the password, so the cache can 88KEY indicate the purpose of the password, so the cache can
89separate passwords. The cache is not used if KEY is nil. It is 89separate passwords. The cache is not used if KEY is nil.
90typically a string. 90KEY is typically a string but can be anything (compared via `equal').
91The variable `password-cache' control whether the cache is used." 91The variable `password-cache' control whether the cache is used."
92 (or (password-read-from-cache key) 92 (or (password-read-from-cache key)
93 (read-passwd prompt))) 93 (read-passwd prompt)))
@@ -115,29 +115,27 @@ but can be invoked at any time to forcefully remove passwords
115from the cache. This may be useful when it has been detected 115from the cache. This may be useful when it has been detected
116that a password is invalid, so that `password-read' query the 116that a password is invalid, so that `password-read' query the
117user again." 117user again."
118 (let ((sym (intern-soft key password-data))) 118 (let ((password (gethash key password-data)))
119 (when sym 119 (when (stringp password)
120 (let ((password (symbol-value sym))) 120 (if (fboundp 'clear-string)
121 (when (stringp password) 121 (clear-string password)
122 (if (fboundp 'clear-string) 122 (fillarray password ?_)))
123 (clear-string password) 123 (remhash key password-data)))
124 (fillarray password ?_)))
125 (unintern key password-data)))))
126 124
127(defun password-cache-add (key password) 125(defun password-cache-add (key password)
128 "Add password to cache. 126 "Add password to cache.
129The password is removed by a timer after `password-cache-expiry' seconds." 127The password is removed by a timer after `password-cache-expiry' seconds."
130 (when (and password-cache-expiry (null (intern-soft key password-data))) 128 (when (and password-cache-expiry (null (gethash key password-data)))
131 (run-at-time password-cache-expiry nil 129 (run-at-time password-cache-expiry nil
132 #'password-cache-remove 130 #'password-cache-remove
133 key)) 131 key))
134 (set (intern key password-data) password) 132 (puthash key password password-data)
135 nil) 133 nil)
136 134
137(defun password-reset () 135(defun password-reset ()
138 "Clear the password cache." 136 "Clear the password cache."
139 (interactive) 137 (interactive)
140 (fillarray password-data 0)) 138 (clrhash password-data))
141 139
142(provide 'password-cache) 140(provide 'password-cache)
143 141
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 22f5b906e4e..59dc96af030 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6089,14 +6089,8 @@ comment at the start of cc-engine.el for more info."
6089 6089
6090(defsubst c-clear-found-types () 6090(defsubst c-clear-found-types ()
6091 ;; Clears `c-found-types'. 6091 ;; Clears `c-found-types'.
6092 (setq c-found-types (make-vector 53 0))) 6092 (setq c-found-types
6093 6093 (make-hash-table :test #'equal :weakness nil)))
6094(defun c-copy-found-types ()
6095 (let ((copy (make-vector 53 0)))
6096 (mapatoms (lambda (sym)
6097 (intern (symbol-name sym) copy))
6098 c-found-types)
6099 copy))
6100 6094
6101(defun c-add-type (from to) 6095(defun c-add-type (from to)
6102 ;; Add the given region as a type in `c-found-types'. If the region 6096 ;; Add the given region as a type in `c-found-types'. If the region
@@ -6110,29 +6104,27 @@ comment at the start of cc-engine.el for more info."
6110 ;; 6104 ;;
6111 ;; This function might do hidden buffer changes. 6105 ;; This function might do hidden buffer changes.
6112 (let ((type (c-syntactic-content from to c-recognize-<>-arglists))) 6106 (let ((type (c-syntactic-content from to c-recognize-<>-arglists)))
6113 (unless (intern-soft type c-found-types) 6107 (unless (gethash type c-found-types)
6114 (unintern (substring type 0 -1) c-found-types) 6108 (remhash (substring type 0 -1) c-found-types)
6115 (intern type c-found-types)))) 6109 (puthash type t c-found-types))))
6116 6110
6117(defun c-unfind-type (name) 6111(defun c-unfind-type (name)
6118 ;; Remove the "NAME" from c-found-types, if present. 6112 ;; Remove the "NAME" from c-found-types, if present.
6119 (unintern name c-found-types)) 6113 (remhash name c-found-types))
6120 6114
6121(defsubst c-check-type (from to) 6115(defsubst c-check-type (from to)
6122 ;; Return non-nil if the given region contains a type in 6116 ;; Return non-nil if the given region contains a type in
6123 ;; `c-found-types'. 6117 ;; `c-found-types'.
6124 ;; 6118 ;;
6125 ;; This function might do hidden buffer changes. 6119 ;; This function might do hidden buffer changes.
6126 (intern-soft (c-syntactic-content from to c-recognize-<>-arglists) 6120 (gethash (c-syntactic-content from to c-recognize-<>-arglists) c-found-types))
6127 c-found-types))
6128 6121
6129(defun c-list-found-types () 6122(defun c-list-found-types ()
6130 ;; Return all the types in `c-found-types' as a sorted list of 6123 ;; Return all the types in `c-found-types' as a sorted list of
6131 ;; strings. 6124 ;; strings.
6132 (let (type-list) 6125 (let (type-list)
6133 (mapatoms (lambda (type) 6126 (maphash (lambda (type _)
6134 (setq type-list (cons (symbol-name type) 6127 (setq type-list (cons type type-list)))
6135 type-list)))
6136 c-found-types) 6128 c-found-types)
6137 (sort type-list 'string-lessp))) 6129 (sort type-list 'string-lessp)))
6138 6130
@@ -7066,7 +7058,7 @@ comment at the start of cc-engine.el for more info."
7066 ;; This function might do hidden buffer changes. 7058 ;; This function might do hidden buffer changes.
7067 7059
7068 (let ((start (point)) 7060 (let ((start (point))
7069 (old-found-types (c-copy-found-types)) 7061 (old-found-types (copy-hash-table c-found-types))
7070 ;; If `c-record-type-identifiers' is set then activate 7062 ;; If `c-record-type-identifiers' is set then activate
7071 ;; recording of any found types that constitute an argument in 7063 ;; recording of any found types that constitute an argument in
7072 ;; the arglist. 7064 ;; the arglist.
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 66f2575f49f..b35d33a5fd3 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1182,10 +1182,15 @@ casts and declarations are fontified. Used on level 2 and higher."
1182 (goto-char match-pos) 1182 (goto-char match-pos)
1183 (backward-char) 1183 (backward-char)
1184 (c-backward-token-2) 1184 (c-backward-token-2)
1185 (or (looking-at c-block-stmt-2-key) 1185 (cond
1186 (looking-at c-block-stmt-1-2-key) 1186 ((looking-at c-paren-stmt-key)
1187 (looking-at c-typeof-key)))) 1187 ;; Allow comma separated <> arglists in for statements.
1188 (cons nil t)) 1188 (cons nil nil))
1189 ((or (looking-at c-block-stmt-2-key)
1190 (looking-at c-block-stmt-1-2-key)
1191 (looking-at c-typeof-key))
1192 (cons nil t))
1193 (t nil)))))
1189 ;; Near BOB. 1194 ;; Near BOB.
1190 ((<= match-pos (point-min)) 1195 ((<= match-pos (point-min))
1191 (cons 'arglist t)) 1196 (cons 'arglist t))
@@ -1226,13 +1231,16 @@ casts and declarations are fontified. Used on level 2 and higher."
1226 ;; Got a cached hit in some other type of arglist. 1231 ;; Got a cached hit in some other type of arglist.
1227 (type 1232 (type
1228 (cons 'arglist t)) 1233 (cons 'arglist t))
1229 (not-front-decl 1234 ((and not-front-decl
1230 ;; The point is within the range of a previously 1235 ;; The point is within the range of a previously
1231 ;; encountered type decl expression, so the arglist 1236 ;; encountered type decl expression, so the arglist
1232 ;; is probably one that contains declarations. 1237 ;; is probably one that contains declarations.
1233 ;; However, if `c-recognize-paren-inits' is set it 1238 ;; However, if `c-recognize-paren-inits' is set it
1234 ;; might also be an initializer arglist. 1239 ;; might also be an initializer arglist.
1235 ;; 1240 (or (not c-recognize-paren-inits)
1241 (save-excursion
1242 (goto-char match-pos)
1243 (not (c-back-over-member-initializers)))))
1236 ;; The result of this check is cached with a char 1244 ;; The result of this check is cached with a char
1237 ;; property on the match token, so that we can look 1245 ;; property on the match token, so that we can look
1238 ;; it up again when refontifying single lines in a 1246 ;; it up again when refontifying single lines in a
@@ -1243,17 +1251,21 @@ casts and declarations are fontified. Used on level 2 and higher."
1243 ;; Got an open paren preceded by an arith operator. 1251 ;; Got an open paren preceded by an arith operator.
1244 ((and (eq (char-before match-pos) ?\() 1252 ((and (eq (char-before match-pos) ?\()
1245 (save-excursion 1253 (save-excursion
1254 (goto-char match-pos)
1246 (and (zerop (c-backward-token-2 2)) 1255 (and (zerop (c-backward-token-2 2))
1247 (looking-at c-arithmetic-op-regexp)))) 1256 (looking-at c-arithmetic-op-regexp))))
1248 (cons nil nil)) 1257 (cons nil nil))
1249 ;; In a C++ member initialization list. 1258 ;; In a C++ member initialization list.
1250 ((and (eq (char-before match-pos) ?,) 1259 ((and (eq (char-before match-pos) ?,)
1251 (c-major-mode-is 'c++-mode) 1260 (c-major-mode-is 'c++-mode)
1252 (save-excursion (c-back-over-member-initializers))) 1261 (save-excursion
1262 (goto-char match-pos)
1263 (c-back-over-member-initializers)))
1253 (c-put-char-property (1- match-pos) 'c-type 'c-not-decl) 1264 (c-put-char-property (1- match-pos) 'c-type 'c-not-decl)
1254 (cons 'not-decl nil)) 1265 (cons 'not-decl nil))
1255 ;; At start of a declaration inside a declaration paren. 1266 ;; At start of a declaration inside a declaration paren.
1256 ((save-excursion 1267 ((save-excursion
1268 (goto-char match-pos)
1257 (and (memq (char-before match-pos) '(?\( ?\,)) 1269 (and (memq (char-before match-pos) '(?\( ?\,))
1258 (c-go-up-list-backward match-pos) 1270 (c-go-up-list-backward match-pos)
1259 (eq (char-after) ?\() 1271 (eq (char-after) ?\()
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index bf0439ffe8a..0bf89b9a36a 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1539,6 +1539,21 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
1539 (setq new-pos capture-opener)) 1539 (setq new-pos capture-opener))
1540 (and (/= new-pos pos) new-pos))) 1540 (and (/= new-pos pos) new-pos)))
1541 1541
1542(defun c-fl-decl-end (pos)
1543 ;; If POS is inside a declarator, return the end of the token that follows
1544 ;; the declarator, otherwise return nil.
1545 (goto-char pos)
1546 (let ((lit-start (c-literal-start))
1547 pos1)
1548 (if lit-start (goto-char lit-start))
1549 (c-backward-syntactic-ws)
1550 (when (setq pos1 (c-on-identifier))
1551 (goto-char pos1)
1552 (when (and (c-forward-declarator)
1553 (eq (c-forward-token-2) 0))
1554 (c-backward-syntactic-ws)
1555 (point)))))
1556
1542(defun c-change-expand-fl-region (_beg _end _old-len) 1557(defun c-change-expand-fl-region (_beg _end _old-len)
1543 ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock 1558 ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock
1544 ;; region. This will usually be the smallest sequence of whole lines 1559 ;; region. This will usually be the smallest sequence of whole lines
@@ -1552,18 +1567,16 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
1552 (setq c-new-BEG 1567 (setq c-new-BEG
1553 (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG)) 1568 (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG))
1554 c-new-END 1569 c-new-END
1555 (save-excursion 1570 (or (c-fl-decl-end c-new-END)
1556 (goto-char c-new-END) 1571 (c-point 'bonl (max (1- c-new-END) (point-min)))))))
1557 (if (bolp)
1558 (point)
1559 (c-point 'bonl c-new-END))))))
1560 1572
1561(defun c-context-expand-fl-region (beg end) 1573(defun c-context-expand-fl-region (beg end)
1562 ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a 1574 ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a
1563 ;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is 1575 ;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is
1564 ;; in. NEW-END is beginning of the line after the one END is in. 1576 ;; in. NEW-END is beginning of the line after the one END is in.
1565 (cons (or (c-fl-decl-start beg) (c-point 'bol beg)) 1577 (c-save-buffer-state ()
1566 (c-point 'bonl end))) 1578 (cons (or (c-fl-decl-start beg) (c-point 'bol beg))
1579 (or (c-fl-decl-end end) (c-point 'bonl (1- end))))))
1567 1580
1568(defun c-before-context-fl-expand-region (beg end) 1581(defun c-before-context-fl-expand-region (beg end)
1569 ;; Expand the region (BEG END) as specified by 1582 ;; Expand the region (BEG END) as specified by
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index c0f1aaf39d4..c69eca22413 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -3734,7 +3734,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
3734 "\\(\\`\n?\\|^\n\\)=" ; POD 3734 "\\(\\`\n?\\|^\n\\)=" ; POD
3735 "\\|" 3735 "\\|"
3736 ;; One extra () before this: 3736 ;; One extra () before this:
3737 "<<" ; HERE-DOC 3737 "<<~?" ; HERE-DOC
3738 "\\(" ; 1 + 1 3738 "\\(" ; 1 + 1
3739 ;; First variant "BLAH" or just ``. 3739 ;; First variant "BLAH" or just ``.
3740 "[ \t]*" ; Yes, whitespace is allowed! 3740 "[ \t]*" ; Yes, whitespace is allowed!
@@ -4000,7 +4000,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
4000 (setq b (point)) 4000 (setq b (point))
4001 ;; We do not search to max, since we may be called from 4001 ;; We do not search to max, since we may be called from
4002 ;; some hook of fontification, and max is random 4002 ;; some hook of fontification, and max is random
4003 (or (and (re-search-forward (concat "^" qtag "$") 4003 (or (and (re-search-forward (concat "^[ \t]*" qtag "$")
4004 stop-point 'toend) 4004 stop-point 'toend)
4005 ;;;(eq (following-char) ?\n) ; XXXX WHY??? 4005 ;;;(eq (following-char) ?\n) ; XXXX WHY???
4006 ) 4006 )
diff --git a/lisp/progmodes/ld-script.el b/lisp/progmodes/ld-script.el
index 389ddfca6b1..7a666e95297 100644
--- a/lisp/progmodes/ld-script.el
+++ b/lisp/progmodes/ld-script.el
@@ -85,10 +85,12 @@
85 ;; 3.4.5 Other Linker Script Commands 85 ;; 3.4.5 Other Linker Script Commands
86 "ASSERT" "EXTERN" "FORCE_COMMON_ALLOCATION" 86 "ASSERT" "EXTERN" "FORCE_COMMON_ALLOCATION"
87 "INHIBIT_COMMON_ALLOCATION" "INSERT" "AFTER" "BEFORE" 87 "INHIBIT_COMMON_ALLOCATION" "INSERT" "AFTER" "BEFORE"
88 "NOCROSSREFS" "OUTPUT_ARCH" "LD_FEATURE" 88 "NOCROSSREFS" "NOCROSSREFS_TO" "OUTPUT_ARCH" "LD_FEATURE"
89 ;; 3.5.2 PROVIDE 89 ;; 3.5.2 HIDDEN
90 "HIDDEN"
91 ;; 3.5.3 PROVIDE
90 "PROVIDE" 92 "PROVIDE"
91 ;; 3.5.3 PROVIDE_HIDDEN 93 ;; 3.5.4 PROVIDE_HIDDEN
92 "PROVIDE_HIDDEN" 94 "PROVIDE_HIDDEN"
93 ;; 3.6 SECTIONS Command 95 ;; 3.6 SECTIONS Command
94 "SECTIONS" 96 "SECTIONS"
@@ -142,6 +144,7 @@
142 "DEFINED" 144 "DEFINED"
143 "LENGTH" "len" "l" 145 "LENGTH" "len" "l"
144 "LOADADDR" 146 "LOADADDR"
147 "LOG2CEIL"
145 "MAX" 148 "MAX"
146 "MIN" 149 "MIN"
147 "NEXT" 150 "NEXT"
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 3def37a2ea8..6197a53ee66 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -213,25 +213,6 @@
213 (regexp-opt perl--syntax-exp-intro-keywords) 213 (regexp-opt perl--syntax-exp-intro-keywords)
214 "\\|[-?:.,;|&+*=!~({[]\\|\\(^\\)\\)[ \t\n]*"))) 214 "\\|[-?:.,;|&+*=!~({[]\\|\\(^\\)\\)[ \t\n]*")))
215 215
216;; FIXME: handle here-docs and regexps.
217;; <<EOF <<"EOF" <<'EOF' (no space)
218;; see `man perlop'
219;; ?...?
220;; /.../
221;; m [...]
222;; m /.../
223;; q /.../ = '...'
224;; qq /.../ = "..."
225;; qx /.../ = `...`
226;; qr /.../ = precompiled regexp =~=~ m/.../
227;; qw /.../
228;; s /.../.../
229;; s <...> /.../
230;; s '...'...'
231;; tr /.../.../
232;; y /.../.../
233;;
234;; <file*glob>
235(defun perl-syntax-propertize-function (start end) 216(defun perl-syntax-propertize-function (start end)
236 (let ((case-fold-search nil)) 217 (let ((case-fold-search nil))
237 (goto-char start) 218 (goto-char start)
@@ -324,23 +305,25 @@
324 ((concat 305 ((concat
325 "\\(?:" 306 "\\(?:"
326 ;; << "EOF", << 'EOF', or << \EOF 307 ;; << "EOF", << 'EOF', or << \EOF
327 "<<[ \t]*\\('[^'\n]*'\\|\"[^\"\n]*\"\\|\\\\[[:alpha:]][[:alnum:]]*\\)" 308 "<<\\(~\\)?[ \t]*\\('[^'\n]*'\\|\"[^\"\n]*\"\\|\\\\[[:alpha:]][[:alnum:]]*\\)"
328 ;; The <<EOF case which needs perl--syntax-exp-intro-regexp, to 309 ;; The <<EOF case which needs perl--syntax-exp-intro-regexp, to
329 ;; disambiguate with the left-bitshift operator. 310 ;; disambiguate with the left-bitshift operator.
330 "\\|" perl--syntax-exp-intro-regexp "<<\\(?1:\\sw+\\)\\)" 311 "\\|" perl--syntax-exp-intro-regexp "<<\\(?2:\\sw+\\)\\)"
331 ".*\\(\n\\)") 312 ".*\\(\n\\)")
332 (3 (let* ((st (get-text-property (match-beginning 3) 'syntax-table)) 313 (4 (let* ((st (get-text-property (match-beginning 4) 'syntax-table))
333 (name (match-string 1))) 314 (name (match-string 2))
334 (goto-char (match-end 1)) 315 (indented (match-beginning 1)))
316 (goto-char (match-end 2))
335 (if (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) 317 (if (save-excursion (nth 8 (syntax-ppss (match-beginning 0))))
336 ;; Leave the property of the newline unchanged. 318 ;; Leave the property of the newline unchanged.
337 st 319 st
338 (cons (car (string-to-syntax "< c")) 320 (cons (car (string-to-syntax "< c"))
339 ;; Remember the names of heredocs found on this line. 321 ;; Remember the names of heredocs found on this line.
340 (cons (pcase (aref name 0) 322 (cons (cons (pcase (aref name 0)
341 (`?\\ (substring name 1)) 323 (`?\\ (substring name 1))
342 ((or `?\" `?\' `?\`) (substring name 1 -1)) 324 ((or `?\" `?\' `?\`) (substring name 1 -1))
343 (_ name)) 325 (_ name))
326 indented)
344 (cdr st))))))) 327 (cdr st)))))))
345 ;; We don't call perl-syntax-propertize-special-constructs directly 328 ;; We don't call perl-syntax-propertize-special-constructs directly
346 ;; from the << rule, because there might be other elements (between 329 ;; from the << rule, because there might be other elements (between
@@ -383,7 +366,9 @@
383 (goto-char (nth 8 state))) 366 (goto-char (nth 8 state)))
384 (while (and names 367 (while (and names
385 (re-search-forward 368 (re-search-forward
386 (concat "^" (regexp-quote (pop names)) "\n") 369 (pcase-let ((`(,name . ,indented) (pop names)))
370 (concat "^" (if indented "[ \t]*")
371 (regexp-quote name) "\n"))
387 limit 'move)) 372 limit 'move))
388 (unless names 373 (unless names
389 (put-text-property (1- (point)) (point) 'syntax-table 374 (put-text-property (1- (point)) (point) 'syntax-table
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 35b555e6879..23e79f6ac59 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1683,6 +1683,7 @@ with your script for an edit-interpret-debug cycle."
1683 ((string-match "[.]sh\\>" buffer-file-name) "sh") 1683 ((string-match "[.]sh\\>" buffer-file-name) "sh")
1684 ((string-match "[.]bash\\>" buffer-file-name) "bash") 1684 ((string-match "[.]bash\\>" buffer-file-name) "bash")
1685 ((string-match "[.]ksh\\>" buffer-file-name) "ksh") 1685 ((string-match "[.]ksh\\>" buffer-file-name) "ksh")
1686 ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
1686 ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh") 1687 ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
1687 ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh") 1688 ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
1688 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh") 1689 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
diff --git a/lisp/register.el b/lisp/register.el
index 7cc3ccd870c..e395963f56a 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -164,6 +164,10 @@ display such a window regardless."
164 help-chars) 164 help-chars)
165 (unless (get-buffer-window buffer) 165 (unless (get-buffer-window buffer)
166 (register-preview buffer 'show-empty))) 166 (register-preview buffer 'show-empty)))
167 (when (or (eq ?\C-g last-input-event)
168 (eq 'escape last-input-event)
169 (eq ?\C-\[ last-input-event))
170 (keyboard-quit))
167 (if (characterp last-input-event) last-input-event 171 (if (characterp last-input-event) last-input-event
168 (error "Non-character input-event"))) 172 (error "Non-character input-event")))
169 (and (timerp timer) (cancel-timer timer)) 173 (and (timerp timer) (cancel-timer timer))
diff --git a/lisp/replace.el b/lisp/replace.el
index 64dfe7da22d..a5024943e64 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1395,6 +1395,11 @@ invoke `occur'."
1395 "Show all lines in the current buffer containing a match for REGEXP. 1395 "Show all lines in the current buffer containing a match for REGEXP.
1396If a match spreads across multiple lines, all those lines are shown. 1396If a match spreads across multiple lines, all those lines are shown.
1397 1397
1398Each match is extended to include complete lines. Only non-overlapping
1399matches are considered. (Note that extending matches to complete
1400lines could cause some of the matches to overlap; if so, they will not
1401be shown as separate matches.)
1402
1398Each line is displayed with NLINES lines before and after, or -NLINES 1403Each line is displayed with NLINES lines before and after, or -NLINES
1399before if NLINES is negative. 1404before if NLINES is negative.
1400NLINES defaults to `list-matching-lines-default-context-lines'. 1405NLINES defaults to `list-matching-lines-default-context-lines'.
diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 7b0588dfead..fdfd5c61be9 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -696,6 +696,10 @@ Optional argument PROPS specifies other text properties to apply."
696 ;; Create an "clean" ruler. 696 ;; Create an "clean" ruler.
697 (ruler 697 (ruler
698 (propertize 698 (propertize
699 ;; FIXME: `make-string' returns a unibyte string if it's ASCII-only,
700 ;; which prevents further `aset' from inserting non-ASCII chars,
701 ;; hence the need for `string-to-multibyte'.
702 ;; http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00841.html
699 (string-to-multibyte 703 (string-to-multibyte
700 (make-string w ruler-mode-basic-graduation-char)) 704 (make-string w ruler-mode-basic-graduation-char))
701 'face 'ruler-mode-default 705 'face 'ruler-mode-default
diff --git a/lisp/startup.el b/lisp/startup.el
index bc60bbd08b8..0fbba1bea23 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1432,6 +1432,7 @@ settings will be marked as \"CHANGED outside of Customize\"."
1432 (let ((no-vals '("no" "off" "false" "0")) 1432 (let ((no-vals '("no" "off" "false" "0"))
1433 (settings '(("menuBar" "MenuBar" menu-bar-mode nil) 1433 (settings '(("menuBar" "MenuBar" menu-bar-mode nil)
1434 ("toolBar" "ToolBar" tool-bar-mode nil) 1434 ("toolBar" "ToolBar" tool-bar-mode nil)
1435 ("scrollBar" "ScrollBar" scroll-bar-mode nil)
1435 ("cursorBlink" "CursorBlink" no-blinking-cursor t)))) 1436 ("cursorBlink" "CursorBlink" no-blinking-cursor t))))
1436 (dolist (x settings) 1437 (dolist (x settings)
1437 (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals) 1438 (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
diff --git a/lisp/subr.el b/lisp/subr.el
index d9d918ed12d..b3f9f902349 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1789,7 +1789,8 @@ Return the new history list.
1789If MAXELT is non-nil, it specifies the maximum length of the history. 1789If MAXELT is non-nil, it specifies the maximum length of the history.
1790Otherwise, the maximum history length is the value of the `history-length' 1790Otherwise, the maximum history length is the value of the `history-length'
1791property on symbol HISTORY-VAR, if set, or the value of the `history-length' 1791property on symbol HISTORY-VAR, if set, or the value of the `history-length'
1792variable. 1792variable. The possible values of maximum length have the same meaning as
1793the values of `history-length'.
1793Remove duplicates of NEWELT if `history-delete-duplicates' is non-nil. 1794Remove duplicates of NEWELT if `history-delete-duplicates' is non-nil.
1794If optional fourth arg KEEP-ALL is non-nil, add NEWELT to history even 1795If optional fourth arg KEEP-ALL is non-nil, add NEWELT to history even
1795if it is empty or a duplicate." 1796if it is empty or a duplicate."
@@ -1998,6 +1999,25 @@ If TOGGLE has a `:menu-tag', that is used for the menu item's label."
1998;; "Return the name of the file from which AUTOLOAD will be loaded. 1999;; "Return the name of the file from which AUTOLOAD will be loaded.
1999;; \n\(fn AUTOLOAD)") 2000;; \n\(fn AUTOLOAD)")
2000 2001
2002(defun define-symbol-prop (symbol prop val)
2003 "Define the property PROP of SYMBOL to be VAL.
2004This is to `put' what `defalias' is to `fset'."
2005 ;; Can't use `cl-pushnew' here (nor `push' on (cdr foo)).
2006 ;; (cl-pushnew symbol (alist-get prop
2007 ;; (alist-get 'define-symbol-props
2008 ;; current-load-list)))
2009 (let ((sps (assq 'define-symbol-props current-load-list)))
2010 (unless sps
2011 (setq sps (list 'define-symbol-props))
2012 (push sps current-load-list))
2013 (let ((ps (assq prop sps)))
2014 (unless ps
2015 (setq ps (list prop))
2016 (setcdr sps (cons ps (cdr sps))))
2017 (unless (member symbol (cdr ps))
2018 (setcdr ps (cons symbol (cdr ps))))))
2019 (put symbol prop val))
2020
2001(defun symbol-file (symbol &optional type) 2021(defun symbol-file (symbol &optional type)
2002 "Return the name of the file that defined SYMBOL. 2022 "Return the name of the file that defined SYMBOL.
2003The value is normally an absolute file name. It can also be nil, 2023The value is normally an absolute file name. It can also be nil,
@@ -2007,47 +2027,30 @@ file name without extension.
2007 2027
2008If TYPE is nil, then any kind of definition is acceptable. If 2028If TYPE is nil, then any kind of definition is acceptable. If
2009TYPE is `defun', `defvar', or `defface', that specifies function 2029TYPE is `defun', `defvar', or `defface', that specifies function
2010definition, variable definition, or face definition only." 2030definition, variable definition, or face definition only.
2031Otherwise TYPE is assumed to be a symbol property."
2011 (if (and (or (null type) (eq type 'defun)) 2032 (if (and (or (null type) (eq type 'defun))
2012 (symbolp symbol) 2033 (symbolp symbol)
2013 (autoloadp (symbol-function symbol))) 2034 (autoloadp (symbol-function symbol)))
2014 (nth 1 (symbol-function symbol)) 2035 (nth 1 (symbol-function symbol))
2015 (let ((files load-history) 2036 (catch 'found
2016 file match) 2037 (pcase-dolist (`(,file . ,elems) load-history)
2017 (while files 2038 (when (if type
2018 (if (if type 2039 (if (eq type 'defvar)
2019 (if (eq type 'defvar) 2040 ;; Variables are present just as their names.
2020 ;; Variables are present just as their names. 2041 (member symbol elems)
2021 (member symbol (cdr (car files))) 2042 ;; Many other types are represented as (TYPE . NAME).
2022 ;; Other types are represented as (TYPE . NAME). 2043 (or (member (cons type symbol) elems)
2023 (member (cons type symbol) (cdr (car files)))) 2044 (memq symbol (alist-get type
2024 ;; We accept all types, so look for variable def 2045 (alist-get 'define-symbol-props
2025 ;; and then for any other kind. 2046 elems)))))
2026 (or (member symbol (cdr (car files))) 2047 ;; We accept all types, so look for variable def
2027 (and (setq match (rassq symbol (cdr (car files)))) 2048 ;; and then for any other kind.
2028 (not (eq 'require (car match)))))) 2049 (or (member symbol elems)
2029 (setq file (car (car files)) files nil)) 2050 (let ((match (rassq symbol elems)))
2030 (setq files (cdr files))) 2051 (and match
2031 file))) 2052 (not (eq 'require (car match)))))))
2032 2053 (throw 'found file))))))
2033(defun method-files (method)
2034 "Return a list of files where METHOD is defined by `cl-defmethod'.
2035The list will have entries of the form (FILE . (METHOD ...))
2036where (METHOD ...) contains the qualifiers and specializers of
2037the method and is a suitable argument for
2038`find-function-search-for-symbol'. Filenames are absolute."
2039 (let ((files load-history)
2040 result)
2041 (while files
2042 (let ((defs (cdr (car files))))
2043 (while defs
2044 (let ((def (car defs)))
2045 (if (and (eq (car-safe def) 'cl-defmethod)
2046 (eq (cadr def) method))
2047 (push (cons (car (car files)) (cdr def)) result)))
2048 (setq defs (cdr defs))))
2049 (setq files (cdr files)))
2050 result))
2051 2054
2052(defun locate-library (library &optional nosuffix path interactive-call) 2055(defun locate-library (library &optional nosuffix path interactive-call)
2053 "Show the precise file name of Emacs library LIBRARY. 2056 "Show the precise file name of Emacs library LIBRARY.
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 596570ca4e2..cdc2af4a7ad 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -4889,7 +4889,7 @@ If optional argument STATE is positive, turn borders on."
4889 (select-window (posn-window (event-start last-input-event))) 4889 (select-window (posn-window (event-start last-input-event)))
4890 (list last-input-event 4890 (list last-input-event
4891 (if (display-popup-menus-p) 4891 (if (display-popup-menus-p)
4892 (x-popup-menu last-nonmenu-event artist-popup-menu-table) 4892 (x-popup-menu t artist-popup-menu-table)
4893 'no-popup-menus)))) 4893 'no-popup-menus))))
4894 4894
4895 (if (eq op 'no-popup-menus) 4895 (if (eq op 'no-popup-menus)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index b37e6dce1af..19cb7b4fea8 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -835,7 +835,7 @@ cannot be completed sensibly: `custom-ident',
835(defface css-selector '((t :inherit font-lock-function-name-face)) 835(defface css-selector '((t :inherit font-lock-function-name-face))
836 "Face to use for selectors." 836 "Face to use for selectors."
837 :group 'css) 837 :group 'css)
838(defface css-property '((t :inherit font-lock-variable-name-face)) 838(defface css-property '((t :inherit font-lock-keyword-face))
839 "Face to use for properties." 839 "Face to use for properties."
840 :group 'css) 840 :group 'css)
841(defface css-proprietary-property '((t :inherit (css-property italic))) 841(defface css-proprietary-property '((t :inherit (css-property italic)))
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 4912db6c53b..0edc93c9649 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -1,4 +1,4 @@
1;;; url-cookie.el --- URL cookie support 1;;; url-cookie.el --- URL cookie support -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1996-1999, 2004-2017 Free Software Foundation, Inc. 3;; Copyright (C) 1996-1999, 2004-2017 Free Software Foundation, Inc.
4 4
@@ -227,21 +227,17 @@ telling Microsoft that."
227 :group 'url-cookie) 227 :group 'url-cookie)
228 228
229(defun url-cookie-host-can-set-p (host domain) 229(defun url-cookie-host-can-set-p (host domain)
230 (let ((last nil) 230 (cond
231 (case-fold-search t)) 231 ((string= host domain) ; Apparently netscape lets you do this
232 (cond 232 t)
233 ((string= host domain) ; Apparently netscape lets you do this 233 ((zerop (length domain))
234 t) 234 nil)
235 ((zerop (length domain)) 235 (t
236 nil) 236 ;; Remove the dot from wildcard domains before matching.
237 (t 237 (when (eq ?. (aref domain 0))
238 ;; Remove the dot from wildcard domains before matching. 238 (setq domain (substring domain 1)))
239 (when (eq ?. (aref domain 0)) 239 (and (url-domsuf-cookie-allowed-p domain)
240 (setq domain (substring domain 1))) 240 (string-suffix-p domain host 'ignore-case)))))
241 (and (url-domsuf-cookie-allowed-p domain)
242 ;; Need to check and make sure the host is actually _in_ the
243 ;; domain it wants to set a cookie for though.
244 (string-match (concat (regexp-quote domain) "$") host))))))
245 241
246(defun url-cookie-handle-set-cookie (str) 242(defun url-cookie-handle-set-cookie (str)
247 (setq url-cookies-changed-since-last-save t) 243 (setq url-cookies-changed-since-last-save t)
@@ -380,8 +376,8 @@ instead delete all cookies that do not match REGEXP."
380 "Display a buffer listing the current URL cookies, if there are any. 376 "Display a buffer listing the current URL cookies, if there are any.
381Use \\<url-cookie-mode-map>\\[url-cookie-delete] to remove cookies." 377Use \\<url-cookie-mode-map>\\[url-cookie-delete] to remove cookies."
382 (interactive) 378 (interactive)
383 (when (and (null url-cookie-secure-storage) 379 (unless (or url-cookie-secure-storage
384 (null url-cookie-storage)) 380 url-cookie-storage)
385 (error "No cookies are defined")) 381 (error "No cookies are defined"))
386 382
387 (pop-to-buffer "*url cookies*") 383 (pop-to-buffer "*url cookies*")
@@ -442,20 +438,13 @@ Use \\<url-cookie-mode-map>\\[url-cookie-delete] to remove cookies."
442 (forward-line 1) 438 (forward-line 1)
443 (point))))) 439 (point)))))
444 440
445(defun url-cookie-quit ()
446 "Kill the current buffer."
447 (interactive)
448 (kill-buffer (current-buffer)))
449
450(defvar url-cookie-mode-map 441(defvar url-cookie-mode-map
451 (let ((map (make-sparse-keymap))) 442 (let ((map (make-sparse-keymap)))
452 (suppress-keymap map)
453 (define-key map "q" 'url-cookie-quit)
454 (define-key map [delete] 'url-cookie-delete) 443 (define-key map [delete] 'url-cookie-delete)
455 (define-key map [(control k)] 'url-cookie-delete) 444 (define-key map [(control k)] 'url-cookie-delete)
456 map)) 445 map))
457 446
458(define-derived-mode url-cookie-mode nil "URL Cookie" 447(define-derived-mode url-cookie-mode special-mode "URL Cookie"
459 "Mode for listing cookies. 448 "Mode for listing cookies.
460 449
461\\{url-cookie-mode-map}" 450\\{url-cookie-mode-map}"
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index 21c39c85ca8..f94f8a6d4d2 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -938,15 +938,15 @@ It has the following disadvantages:
938- cannot use `diff -w' because the weighting causes added spaces in a line 938- cannot use `diff -w' because the weighting causes added spaces in a line
939 to be represented as added copies of some line, so `diff -w' can't do the 939 to be represented as added copies of some line, so `diff -w' can't do the
940 right thing any more. 940 right thing any more.
941- may in degenerate cases take a 1KB input region and turn it into a 1MB 941- Is a bit more costly (may in degenerate cases use temp files that are 10x
942 file to pass to diff.") 942 larger than the refined regions).")
943 943
944(defun smerge--refine-forward (n) 944(defun smerge--refine-forward (n)
945 (let ((case-fold-search nil) 945 (let ((case-fold-search nil)
946 (re "[[:upper:]]?[[:lower:]]+\\|[[:upper:]]+\\|[[:digit:]]+\\|.\\|\n")) 946 (re "[[:upper:]]?[[:lower:]]+\\|[[:upper:]]+\\|[[:digit:]]+\\|.\\|\n"))
947 (when (and smerge-refine-ignore-whitespace 947 (when (and smerge-refine-ignore-whitespace
948 ;; smerge-refine-weight-hack causes additional spaces to 948 ;; smerge-refine-weight-hack causes additional spaces to
949 ;; appear as additional lines as well, so even if diff ignore 949 ;; appear as additional lines as well, so even if diff ignores
950 ;; whitespace changes, it'll report added/removed lines :-( 950 ;; whitespace changes, it'll report added/removed lines :-(
951 (not smerge-refine-weight-hack)) 951 (not smerge-refine-weight-hack))
952 (setq re (concat "[ \t]*\\(?:" re "\\)"))) 952 (setq re (concat "[ \t]*\\(?:" re "\\)")))
@@ -954,6 +954,8 @@ It has the following disadvantages:
954 (unless (looking-at re) (error "Smerge refine internal error")) 954 (unless (looking-at re) (error "Smerge refine internal error"))
955 (goto-char (match-end 0))))) 955 (goto-char (match-end 0)))))
956 956
957(defvar smerge--refine-long-words)
958
957(defun smerge--refine-chopup-region (beg end file &optional preproc) 959(defun smerge--refine-chopup-region (beg end file &optional preproc)
958 "Chopup the region into small elements, one per line. 960 "Chopup the region into small elements, one per line.
959Save the result into FILE. 961Save the result into FILE.
@@ -976,18 +978,46 @@ chars to try and eliminate some spurious differences."
976 (subst-char-in-region (point-min) (point-max) ?\n ?\s)) 978 (subst-char-in-region (point-min) (point-max) ?\n ?\s))
977 (goto-char (point-min)) 979 (goto-char (point-min))
978 (while (not (eobp)) 980 (while (not (eobp))
979 (funcall smerge-refine-forward-function 1) 981 (cl-assert (bolp))
980 (let ((s (if (prog2 (forward-char -1) (bolp) (forward-char 1)) 982 (let ((start (point)))
981 nil 983 (funcall smerge-refine-forward-function 1)
982 (buffer-substring (line-beginning-position) (point))))) 984 (let ((len (- (point) start)))
983 ;; We add \n after each char except after \n, so we get 985 (cl-assert (>= len 1))
984 ;; one line per text char, where each line contains 986 ;; We add \n after each chunk except after \n, so we get
985 ;; just one char, except for \n chars which are 987 ;; one line per text chunk, where each line contains
986 ;; represented by the empty line. 988 ;; just one chunk, except for \n chars which are
987 (unless (eq (char-before) ?\n) (insert ?\n)) 989 ;; represented by the empty line.
988 ;; HACK ALERT!! 990 (unless (bolp) (insert ?\n))
989 (if smerge-refine-weight-hack 991 (when (and smerge-refine-weight-hack (> len 1))
990 (dotimes (_i (1- (length s))) (insert s "\n"))))) 992 (let ((s (buffer-substring-no-properties start (point))))
993 ;; The weight-hack inserts N copies of words of size N,
994 ;; so it naturally suffers from an O(N²) blow up.
995 ;; To circumvent this, we map each long word
996 ;; to a shorter (but still unique) replacement.
997 ;; Another option would be to change smerge--refine-forward
998 ;; so it chops up long words into smaller ones.
999 (when (> len 8)
1000 (let ((short (gethash s smerge--refine-long-words)))
1001 (unless short
1002 ;; To avoid accidental conflicts with ≤8 words,
1003 ;; we make sure the replacement is >8 chars. Overall,
1004 ;; this should bound the blowup factor to ~10x,
1005 ;; tho if those chars end up encoded as multiple bytes
1006 ;; each, it could probably still reach ~30x in
1007 ;; pathological cases.
1008 (setq short
1009 (concat (substring s 0 7)
1010 " "
1011 (string
1012 (+ ?0
1013 (hash-table-count
1014 smerge--refine-long-words)))
1015 "\n"))
1016 (puthash s short smerge--refine-long-words))
1017 (delete-region start (point))
1018 (insert short)
1019 (setq s short)))
1020 (dotimes (_i (1- len)) (insert s)))))))
991 (unless (bolp) (error "Smerge refine internal error")) 1021 (unless (bolp) (error "Smerge refine internal error"))
992 (let ((coding-system-for-write 'emacs-internal)) 1022 (let ((coding-system-for-write 'emacs-internal))
993 (write-region (point-min) (point-max) file nil 'nomessage)))) 1023 (write-region (point-min) (point-max) file nil 'nomessage))))
@@ -1042,7 +1072,9 @@ used to replace chars to try and eliminate some spurious differences."
1042 (let* ((pos (point)) 1072 (let* ((pos (point))
1043 deactivate-mark ; The code does not modify any visible buffer. 1073 deactivate-mark ; The code does not modify any visible buffer.
1044 (file1 (make-temp-file "diff1")) 1074 (file1 (make-temp-file "diff1"))
1045 (file2 (make-temp-file "diff2"))) 1075 (file2 (make-temp-file "diff2"))
1076 (smerge--refine-long-words
1077 (if smerge-refine-weight-hack (make-hash-table :test #'equal))))
1046 (unless (markerp beg1) (setq beg1 (copy-marker beg1))) 1078 (unless (markerp beg1) (setq beg1 (copy-marker beg1)))
1047 (unless (markerp beg2) (setq beg2 (copy-marker beg2))) 1079 (unless (markerp beg2) (setq beg2 (copy-marker beg2)))
1048 ;; Chop up regions into smaller elements and save into files. 1080 ;; Chop up regions into smaller elements and save into files.
@@ -1062,7 +1094,7 @@ used to replace chars to try and eliminate some spurious differences."
1062 ;; also and more importantly because otherwise it 1094 ;; also and more importantly because otherwise it
1063 ;; may happen that diff doesn't behave like 1095 ;; may happen that diff doesn't behave like
1064 ;; smerge-refine-weight-hack expects it to. 1096 ;; smerge-refine-weight-hack expects it to.
1065 ;; See http://thread.gmane.org/gmane.emacs.devel/82685. 1097 ;; See http://thread.gmane.org/gmane.emacs.devel/82685, aka https://lists.gnu.org/archive/html/emacs-devel/2007-11/msg00401.html
1066 "-awd" "-ad") 1098 "-awd" "-ad")
1067 file1 file2)) 1099 file1 file2))
1068 ;; Process diff's output. 1100 ;; Process diff's output.
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index c6d5b16caeb..4198b9bd0e7 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1,4 +1,4 @@
1;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE 1;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2000-2017 Free Software Foundation, Inc. 3;; Copyright (C) 2000-2017 Free Software Foundation, Inc.
4 4