summaryrefslogtreecommitdiff
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.el92
-rw-r--r--lisp/cedet/semantic/symref/grep.el33
-rw-r--r--lisp/dired-aux.el10
-rw-r--r--lisp/dired-x.el9
-rw-r--r--lisp/dired.el230
-rw-r--r--lisp/display-line-numbers.el1
-rw-r--r--lisp/emacs-lisp/autoload.el10
-rw-r--r--lisp/emacs-lisp/avl-tree.el17
-rw-r--r--lisp/emacs-lisp/bytecomp.el40
-rw-r--r--lisp/emacs-lisp/cl-generic.el55
-rw-r--r--lisp/emacs-lisp/edebug.el4
-rw-r--r--lisp/emacs-lisp/eieio-compat.el3
-rw-r--r--lisp/emacs-lisp/elp.el5
-rw-r--r--lisp/emacs-lisp/ert.el14
-rw-r--r--lisp/emacs-lisp/pcase.el4
-rw-r--r--lisp/emacs-lisp/re-builder.el4
-rw-r--r--lisp/emacs-lisp/tabulated-list.el4
-rw-r--r--lisp/eshell/em-ls.el78
-rw-r--r--lisp/faces.el6
-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/gnus/mm-uu.el2
-rw-r--r--lisp/help-mode.el4
-rw-r--r--lisp/ido.el2
-rw-r--r--lisp/info.el6
-rw-r--r--lisp/international/mule-conf.el4
-rw-r--r--lisp/kmacro.el2
-rw-r--r--lisp/ldefs-boot.el425
-rw-r--r--lisp/loadhist.el10
-rw-r--r--lisp/ls-lisp.el39
-rw-r--r--lisp/menu-bar.el1
-rw-r--r--lisp/newcomment.el5
-rw-r--r--lisp/password-cache.el30
-rw-r--r--lisp/progmodes/cc-fonts.el26
-rw-r--r--lisp/progmodes/cc-mode.el27
-rw-r--r--lisp/progmodes/grep.el90
-rw-r--r--lisp/progmodes/sh-script.el1
-rw-r--r--lisp/progmodes/xref.el2
-rw-r--r--lisp/register.el4
-rw-r--r--lisp/replace.el5
-rw-r--r--lisp/ruler-mode.el21
-rw-r--r--lisp/shell.el4
-rw-r--r--lisp/simple.el30
-rw-r--r--lisp/subr.el76
-rw-r--r--lisp/term.el6
-rw-r--r--lisp/term/ns-win.el2
-rw-r--r--lisp/term/x-win.el2
-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
56 files changed, 1158 insertions, 645 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'."
(let ((apropos-do-all (if do-not-all nil t)))
(apropos-user-option pattern)))
+;;;###autoload
+(defun apropos-local-variable (pattern &optional buffer)
+ "Show buffer-local variables that match PATTERN.
+Optional arg BUFFER (default: current buffer) is the buffer to check.
+
+The output includes variables that are not yet set in BUFFER, but that
+will be buffer-local when set."
+ (interactive (list (apropos-read-pattern "buffer-local variable")))
+ (unless buffer (setq buffer (current-buffer)))
+ (apropos-command pattern nil (lambda (symbol)
+ (and (local-variable-if-set-p symbol)
+ (get symbol 'variable-documentation)))))
+
;; For auld lang syne:
;;;###autoload
(defalias 'command-apropos 'apropos-command)
@@ -795,6 +808,35 @@ Returns list of symbols and values found."
(let ((apropos-multi-type do-all))
(apropos-print nil "\n----------------\n")))
+;;;###autoload
+(defun apropos-local-value (pattern &optional buffer)
+ "Show buffer-local variables whose values match PATTERN.
+This is like `apropos-value', but only for buffer-local variables.
+Optional arg BUFFER (default: current buffer) is the buffer to check."
+ (interactive (list (apropos-read-pattern "value of buffer-local variable")))
+ (unless buffer (setq buffer (current-buffer)))
+ (apropos-parse-pattern pattern)
+ (setq apropos-accumulator ())
+ (let ((var nil))
+ (mapatoms
+ (lambda (symb)
+ (unless (memq symb '(apropos-regexp apropos-pattern apropos-all-words-regexp
+ apropos-words apropos-all-words apropos-accumulator symb var))
+ (setq var (apropos-value-internal 'local-variable-if-set-p symb 'symbol-value)))
+ (when (and (fboundp 'apropos-false-hit-str) (apropos-false-hit-str var))
+ (setq var nil))
+ (when var
+ (setq apropos-accumulator (cons (list symb (apropos-score-str var) nil var)
+ apropos-accumulator))))))
+ (let ((apropos-multi-type nil))
+ (if (> emacs-major-version 20)
+ (apropos-print
+ nil "\n----------------\n"
+ (format "Buffer `%s' has the following local variables\nmatching %s`%s':"
+ (buffer-name buffer)
+ (if (consp pattern) "keywords " "")
+ pattern))
+ (apropos-print nil "\n----------------\n"))))
;;;###autoload
(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."
(const :tag "Save GPG-encrypted password tokens" gpg)
(const :tag "Don't encrypt tokens" never))))))
-(defvar auth-source-magic "auth-source-magic ")
-
(defcustom auth-source-do-cache t
"Whether auth-source should cache information with `password-cache'."
:group 'auth-source
@@ -782,16 +780,16 @@ Returns the deleted entries."
(defun auth-source-forget-all-cached ()
"Forget all cached auth-source data."
(interactive)
- (cl-do-symbols (sym password-data)
- ;; when the symbol name starts with auth-source-magic
- (when (string-match (concat "^" auth-source-magic) (symbol-name sym))
- ;; remove that key
- (password-cache-remove (symbol-name sym))))
+ (maphash (lambda (key _password)
+ (when (eq 'auth-source (car-safe key))
+ ;; remove that key
+ (password-cache-remove key)))
+ password-data)
(setq auth-source-netrc-cache nil))
(defun auth-source-format-cache-entry (spec)
"Format SPEC entry to put it in the password cache."
- (concat auth-source-magic (format "%S" spec)))
+ `(auth-source . ,spec))
(defun auth-source-remember (spec found)
"Remember FOUND search results for SPEC."
@@ -822,18 +820,16 @@ This is not a full `auth-source-search' spec but works similarly.
For instance, \(:host \"myhost\" \"yourhost\") would find all the
cached data that was found with a search for those two hosts,
while \(:host t) would find all host entries."
- (let ((count 0)
- sname)
- (cl-do-symbols (sym password-data)
- ;; when the symbol name matches with auth-source-magic
- (when (and (setq sname (symbol-name sym))
- (string-match (concat "^" auth-source-magic "\\(.+\\)")
- sname)
- ;; and the spec matches what was stored in the cache
- (auth-source-specmatchp spec (read (match-string 1 sname))))
- ;; remove that key
- (password-cache-remove sname)
- (cl-incf count)))
+ (let ((count 0))
+ (maphash
+ (lambda (key _password)
+ (when (and (eq 'auth-source (car-safe key))
+ ;; and the spec matches what was stored in the cache
+ (auth-source-specmatchp spec (cdr key)))
+ ;; remove that key
+ (password-cache-remove key)
+ (cl-incf count)))
+ password-data)
count))
(defun auth-source-specmatchp (spec stored)
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index b89c1c2bbd5..e39fee5bfa1 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -701,7 +701,8 @@ and done items are always shown on visiting a category."
;; We just initialized the first todo file, so make it the default.
(setq todo-default-todo-file (todo-short-file-name file)
first-file t)
- (todo-reevaluate-default-file-defcustom))
+ (put 'todo-default-todo-file 'custom-type
+ `(radio ,@(todo--files-type-list))))
(unless (member file todo-visited)
;; Can't setq t-c-t-f here, otherwise wrong file shown when
;; todo-show is called from todo-show-categories-table.
@@ -780,7 +781,8 @@ and done items are always shown on visiting a category."
(when first-file
(setq todo-default-todo-file nil
todo-current-todo-file nil)
- (todo-reevaluate-default-file-defcustom))
+ (put 'todo-default-todo-file 'custom-type
+ `(radio ,@(todo--files-type-list))))
(kill-buffer)
(keyboard-quit)))))
(save-excursion (todo-category-select))
@@ -1102,7 +1104,7 @@ Noninteractively, return the name of the new file."
(write-region (point-min) (point-max) file nil 'nomessage nil t)
(kill-buffer file))
(setq todo-files (funcall todo-files-function))
- (todo-reevaluate-filelist-defcustoms)
+ (todo-update-filelist-defcustoms)
(if (called-interactively-p 'any)
(progn
(set-window-buffer (selected-window)
@@ -1156,7 +1158,7 @@ these files, also rename them accordingly."
(setq todo-default-todo-file snname))
(when (string= todo-global-current-todo-file oname)
(setq todo-global-current-todo-file nname))
- (todo-reevaluate-filelist-defcustoms)))
+ (todo-update-filelist-defcustoms)))
(defun todo-delete-file ()
"Delete the current todo, archive or filtered items file.
@@ -1217,7 +1219,7 @@ visiting the deleted files."
(when (or (string= file1 todo-global-current-todo-file)
(and delete2 (string= file2 todo-global-current-todo-file)))
(setq todo-global-current-todo-file nil))
- (todo-reevaluate-filelist-defcustoms)
+ (todo-update-filelist-defcustoms)
(message (concat (cond (todo "Todo") (archive "Archive")) " file \"%s\" "
(when delete2
(concat "and its "
@@ -1387,7 +1389,7 @@ todo or done items."
(if (= (length todo-categories) 1)
;; If deleted category was the only one, delete the file.
(progn
- (todo-reevaluate-filelist-defcustoms)
+ (todo-update-filelist-defcustoms)
;; Skip confirming killing the archive buffer if it has been
;; modified and not saved.
(set-buffer-modified-p nil)
@@ -1430,7 +1432,7 @@ the archive of the file moved to, creating it if it does not exist."
(write-region (point-min) (point-max) nfile nil 'nomessage nil t)
(kill-buffer nfile))
(setq todo-files (funcall todo-files-function))
- (todo-reevaluate-filelist-defcustoms))
+ (todo-update-filelist-defcustoms))
(dolist (buf buffers)
;; Make sure archive file is in Todo Archive mode so that
;; todo-categories has correct value.
@@ -1524,7 +1526,7 @@ the archive of the file moved to, creating it if it does not exist."
(delete-file todo-current-todo-file)
(kill-buffer)
(when (member todo-current-todo-file todo-files)
- (todo-reevaluate-filelist-defcustoms)))
+ (todo-update-filelist-defcustoms)))
(setq todo-categories (delete (assoc cat todo-categories)
todo-categories))
(todo-update-categories-sexp)
@@ -4527,11 +4529,9 @@ If the file already exists, overwrite it only on confirmation."
(defcustom todo-print-buffer-function #'ps-print-buffer-with-faces
"Function called by `todo-print-buffer' to print Todo mode buffers.
-The function should take an optional argument whose non-nil value
-is a string naming a file to save the print image to; calling
-`todo-print-buffer-to-file' prompts for the file name, which is
-passed to this function. Calling this function with no or a nil
-argument sends the image to the printer."
+Called with one argument which can either be:
+- a string, naming a file to save the print image to.
+- nil, to send the image to the printer."
:type 'symbol
:group 'todo)
@@ -4801,7 +4801,7 @@ name in `todo-directory'. See also the documentation string of
(prin1 sexp (current-buffer)))
(write-region (point-min) (point-max) file nil 'nomessage))
(setq todo-archives (funcall todo-files-function t)))
- (todo-reevaluate-filelist-defcustoms)
+ (todo-update-filelist-defcustoms)
(when (y-or-n-p (concat "Format conversion done; do you want to "
"visit the converted file now? "))
(setq todo-current-todo-file file)
@@ -4865,7 +4865,7 @@ buffer, clean up the state and return nil."
(member todo-default-todo-file files))
(setq todo-default-todo-file (todo-short-file-name
(car todo-files))))
- (todo-reevaluate-filelist-defcustoms)
+ (todo-update-filelist-defcustoms)
(when buf (kill-buffer buf))
nil)))))
@@ -5751,7 +5751,8 @@ have been removed."
" been deleted and removed from\n"
"the list of category completion files")
names))
- (todo-reevaluate-category-completions-files-defcustom)
+ (put 'todo-category-completions-files 'custom-type
+ `(set ,@(todo--files-type-list)))
(custom-set-default 'todo-category-completions-files
(symbol-value 'todo-category-completions-files))
(sleep-for 1.5)))
@@ -6251,59 +6252,12 @@ the empty string (i.e., no time string)."
(hl-line-mode 1)
(hl-line-mode -1)))))))))
-(defun todo-reevaluate-filelist-defcustoms ()
- "Reevaluate defcustoms that provide choice list of todo files."
- ;; FIXME: This is hideous! I don't know enough about Custom to
- ;; offer something better, but please ask on emacs-devel!
- (custom-set-default 'todo-default-todo-file
- (symbol-value 'todo-default-todo-file))
- (todo-reevaluate-default-file-defcustom)
- (custom-set-default 'todo-filter-files (symbol-value 'todo-filter-files))
- (todo-reevaluate-filter-files-defcustom)
- (custom-set-default 'todo-category-completions-files
- (symbol-value 'todo-category-completions-files))
- (todo-reevaluate-category-completions-files-defcustom))
-
-(defun todo-reevaluate-default-file-defcustom ()
- "Reevaluate defcustom of `todo-default-todo-file'.
-Called after adding or deleting a todo file. If the value of
-`todo-default-todo-file' before calling this function was
-associated with an existing file, keep that value."
- ;; FIXME: This is hideous! I don't know enough about Custom to
- ;; offer something better, but please ask on emacs-devel!
- ;; (let ((curval todo-default-todo-file))
- (eval
- (defcustom todo-default-todo-file (todo-short-file-name
- (car (funcall todo-files-function)))
- "Todo file visited by first session invocation of `todo-show'."
- :type (when todo-files
- `(radio ,@(todo--files-type-list)))
- :group 'todo))
- ;; (when (and curval (file-exists-p (todo-absolute-file-name curval)))
- ;; (custom-set-default 'todo-default-todo-file curval)
- ;; ;; (custom-reevaluate-setting 'todo-default-todo-file)
- ;; )))
- )
-
-(defun todo-reevaluate-category-completions-files-defcustom ()
- "Reevaluate defcustom of `todo-category-completions-files'.
-Called after adding or deleting a todo file."
- ;; FIXME: This is hideous! I don't know enough about Custom to
- ;; offer something better, but please ask on emacs-devel!
- (eval (defcustom todo-category-completions-files nil
- "List of files for building `todo-read-category' completions."
- :type `(set ,@(todo--files-type-list))
- :group 'todo)))
-
-(defun todo-reevaluate-filter-files-defcustom ()
- "Reevaluate defcustom of `todo-filter-files'.
-Called after adding or deleting a todo file."
- ;; FIXME: This is hideous! I don't know enough about Custom to
- ;; offer something better, but please ask on emacs-devel!
- (eval (defcustom todo-filter-files nil
- "List of files for multifile item filtering."
- :type `(set ,@(todo--files-type-list))
- :group 'todo)))
+(defun todo-update-filelist-defcustoms ()
+ "Update defcustoms that provide choice list of todo files."
+ (put 'todo-default-todo-file 'custom-type `(radio ,@(todo--files-type-list)))
+ (put 'todo-category-completions-files 'custom-type
+ `(set ,@(todo--files-type-list)))
+ (put 'todo-filter-files 'custom-type `(set ,@(todo--files-type-list))))
;; -----------------------------------------------------------------------------
;;; Font locking
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 42dc40cce04..f7c72bfb0be 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."
;; Return the answer
ans))
-(defconst semantic-symref-grep--line-re
- "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):")
-
(cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-grep))
"Parse one line of grep output, and return it as a match list.
Moves cursor to end of the match."
- (cond ((eq (oref tool :resulttype) 'file)
- ;; Search for files
- (when (re-search-forward "^\\([^\n]+\\)$" nil t)
- (match-string 1)))
- ((eq (oref tool :resulttype) 'line-and-text)
- (when (re-search-forward semantic-symref-grep--line-re nil t)
- (list (string-to-number (match-string 2))
- (match-string 1)
- (buffer-substring-no-properties (point) (line-end-position)))))
- (t
- (when (re-search-forward semantic-symref-grep--line-re nil t)
- (cons (string-to-number (match-string 2))
- (match-string 1))
- ))))
+ (pcase-let
+ ((`(,grep-re ,file-group ,line-group . ,_) (car grep-regexp-alist)))
+ (cond ((eq (oref tool :resulttype) 'file)
+ ;; Search for files
+ (when (re-search-forward "^\\([^\n]+\\)$" nil t)
+ (match-string 1)))
+ ((eq (oref tool :resulttype) 'line-and-text)
+ (when (re-search-forward grep-re nil t)
+ (list (string-to-number (match-string line-group))
+ (match-string file-group)
+ (buffer-substring-no-properties (point) (line-end-position)))))
+ (t
+ (when (re-search-forward grep-re nil t)
+ (cons (string-to-number (match-string line-group))
+ (match-string file-group))
+ )))))
(provide 'semantic/symref/grep)
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 17dae6085df..2b89e527c30 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1,4 +1,4 @@
-;;; dired-aux.el --- less commonly used parts of dired
+;;; dired-aux.el --- less commonly used parts of dired -*- lexical-binding: t -*-
;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2017 Free Software
;; Foundation, Inc.
@@ -619,8 +619,9 @@ with a prefix argument."
This function is used to add all related commands retrieved by `mailcap'
to the end of the list of defaults just after the default value."
(interactive)
- (let ((commands (and (boundp 'files) (require 'mailcap nil t)
- (mailcap-file-default-commands files))))
+ (let* ((files minibuffer-completion-table)
+ (commands (and (require 'mailcap nil t)
+ (mailcap-file-default-commands files))))
(if (listp minibuffer-default)
(append minibuffer-default commands)
(cons minibuffer-default commands))))
@@ -638,6 +639,7 @@ This normally reads using `read-shell-command', but if the
offer a smarter default choice of shell command."
(minibuffer-with-setup-hook
(lambda ()
+ (set (make-local-variable 'minibuffer-completion-table) files)
(set (make-local-variable 'minibuffer-default-add-function)
'minibuffer-default-add-dired-shell-commands))
(setq prompt (format prompt (dired-mark-prompt arg files)))
@@ -742,8 +744,6 @@ can be produced by `dired-get-marked-files', for example."
(string-match regexp res))))
(let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
(no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
- (star (string-match "\\*" command))
- (qmark (string-match "\\?" command))
;; Get confirmation for wildcards that may have been meant
;; to control substitution of a file name or the file name list.
(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'."
(if (called-interactively-p 'interactive)
(setq dired-x-hands-off-my-keys
(not (y-or-n-p "Bind dired-x-find-file over find-file? "))))
- (define-key (current-global-map) [remap find-file]
- (if (not dired-x-hands-off-my-keys) 'dired-x-find-file))
- (define-key (current-global-map) [remap find-file-other-window]
- (if (not dired-x-hands-off-my-keys) 'dired-x-find-file-other-window)))
+ (unless dired-x-hands-off-my-keys
+ (define-key (current-global-map) [remap find-file]
+ 'dired-x-find-file)
+ (define-key (current-global-map) [remap find-file-other-window]
+ 'dired-x-find-file-other-window)))
;; Now call it so binding is correct. This could go in the :initialize
;; 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..54bc6217031 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -34,6 +34,7 @@
;;; Code:
+(eval-when-compile (require 'subr-x))
;; When bootstrapping dired-loaddefs has not been generated.
(require 'dired-loaddefs nil t)
@@ -133,7 +134,7 @@ always set this variable to t."
:type 'boolean
:group 'dired-mark)
-(defcustom dired-trivial-filenames (purecopy "^\\.\\.?$\\|^#")
+(defcustom dired-trivial-filenames (purecopy "\\`\\.\\.?\\'\\|\\`#")
"Regexp of files to skip when finding first file of a directory.
A value of nil means move to the subdir line.
A value of t means move to first file."
@@ -871,6 +872,46 @@ periodically reverts at specified time intervals."
:group 'dired
:version "23.2")
+(defun dired--need-align-p ()
+ "Return non-nil if some file names are misaligned.
+The return value is the target column for the file names."
+ (save-excursion
+ (goto-char (point-min))
+ (dired-goto-next-file)
+ ;; Use point difference instead of `current-column', because
+ ;; the former works when `dired-hide-details-mode' is enabled.
+ (let* ((first (- (point) (point-at-bol)))
+ (target first))
+ (while (and (not (eobp))
+ (progn
+ (forward-line)
+ (dired-move-to-filename)))
+ (when-let* ((distance (- (point) (point-at-bol)))
+ (higher (> distance target)))
+ (setq target distance)))
+ (and (/= first target) target))))
+
+(defun dired--align-all-files ()
+ "Align all files adding spaces in front of the size column."
+ (let ((target (dired--need-align-p))
+ (regexp directory-listing-before-filename-regexp))
+ (when target
+ (save-excursion
+ (goto-char (point-min))
+ (dired-goto-next-file)
+ (while (dired-move-to-filename)
+ ;; Use point difference instead of `current-column', because
+ ;; the former works when `dired-hide-details-mode' is enabled.
+ (let ((distance (- target (- (point) (point-at-bol))))
+ (inhibit-read-only t))
+ (unless (zerop distance)
+ (re-search-backward regexp nil t)
+ (goto-char (match-beginning 0))
+ (search-backward-regexp "[[:space:]]" nil t)
+ (skip-chars-forward "[:space:]")
+ (insert-char ?\s distance 'inherit))
+ (forward-line)))))))
+
(defun dired-internal-noselect (dir-or-list &optional switches mode)
;; If DIR-OR-LIST is a string and there is an existing dired buffer
;; for it, just leave buffer as it is (don't even call dired-revert).
@@ -920,11 +961,12 @@ periodically reverts at specified time intervals."
"Directory has changed on disk; type \\[revert-buffer] to update Dired")))))
;; Else a new buffer
(setq default-directory
- ;; We can do this unconditionally
- ;; because dired-noselect ensures that the name
- ;; is passed in directory name syntax
- ;; if it was the name of a directory at all.
- (file-name-directory dirname))
+ (or (car-safe (insert-directory-wildcard-in-dir-p dirname))
+ ;; We can do this unconditionally
+ ;; because dired-noselect ensures that the name
+ ;; is passed in directory name syntax
+ ;; if it was the name of a directory at all.
+ (file-name-directory dirname)))
(or switches (setq switches dired-listing-switches))
(if mode (funcall mode)
(dired-mode dir-or-list switches))
@@ -939,6 +981,8 @@ periodically reverts at specified time intervals."
(if failed (kill-buffer buffer))))
(goto-char (point-min))
(dired-initial-position dirname))
+ (when (consp dired-directory)
+ (dired--align-all-files))
(set-buffer old-buf)
buffer))
@@ -1056,13 +1100,14 @@ wildcards, erases the buffer, and builds the subdir-alist anew
(not file-list))
;; If we are reading a whole single directory...
(dired-insert-directory dir dired-actual-switches nil nil t)
- (if (not (file-readable-p
- (directory-file-name (file-name-directory dir))))
- (error "Directory %s inaccessible or nonexistent" dir)
- ;; Else treat it as a wildcard spec
- ;; unless we have an explicit list of files.
- (dired-insert-directory dir dired-actual-switches
- file-list (not file-list) t)))))
+ (if (and (not (insert-directory-wildcard-in-dir-p dir))
+ (not (file-readable-p
+ (directory-file-name (file-name-directory dir)))))
+ (error "Directory %s inaccessible or nonexistent" dir))
+ ;; Else treat it as a wildcard spec
+ ;; unless we have an explicit list of files.
+ (dired-insert-directory dir dired-actual-switches
+ file-list (not file-list) t))))
(defun dired-align-file (beg end)
"Align the fields of a file to the ones of surrounding lines.
@@ -1160,7 +1205,7 @@ BEG..END is the line where the file info is located."
(setq file-col (+ spaces file-col))
(if (> file-col other-col)
(setq spaces (- spaces (- file-col other-col))))
- (insert-char ?\s spaces)
+ (insert-char ?\s spaces 'inherit)
;; Let's just make really sure we did not mess up.
(unless (save-excursion
(eq (dired-move-to-filename) (marker-position file)))
@@ -1207,29 +1252,56 @@ If HDR is non-nil, insert a header line with the directory name."
;; as indicated by `ls-lisp-use-insert-directory-program'.
(not (and (featurep 'ls-lisp)
(null ls-lisp-use-insert-directory-program)))
- (or (if (eq dired-use-ls-dired 'unspecified)
+ (not (and (featurep 'eshell)
+ (bound-and-true-p eshell-ls-use-in-dired)))
+ (or (file-remote-p dir)
+ (if (eq dired-use-ls-dired 'unspecified)
;; Check whether "ls --dired" gives exit code 0, and
;; save the answer in `dired-use-ls-dired'.
(or (setq dired-use-ls-dired
(eq 0 (call-process insert-directory-program
- nil nil nil "--dired")))
+ nil nil nil "--dired")))
(progn
(message "ls does not support --dired; \
see `dired-use-ls-dired' for more details.")
nil))
- dired-use-ls-dired)
- (file-remote-p dir)))
+ dired-use-ls-dired)))
(setq switches (concat "--dired " switches)))
- ;; We used to specify the C locale here, to force English month names;
- ;; but this should not be necessary any more,
- ;; with the new value of `directory-listing-before-filename-regexp'.
- (if file-list
- (dolist (f file-list)
- (let ((beg (point)))
- (insert-directory f switches nil nil)
- ;; Re-align fields, if necessary.
- (dired-align-file beg (point))))
- (insert-directory dir switches wildcard (not wildcard)))
+ ;; Expand directory wildcards and fill file-list.
+ (let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir)))
+ (cond (dir-wildcard
+ (setq switches (concat "-d " switches))
+ ;; We don't know whether the remote ls supports
+ ;; "--dired", so we cannot add it to the `process-file'
+ ;; call for wildcards.
+ (when (file-remote-p dir)
+ (setq switches (dired-replace-in-string "--dired" "" switches)))
+ (let* ((default-directory (car dir-wildcard))
+ (script (format "ls %s %s" switches (cdr dir-wildcard)))
+ (remotep (file-remote-p dir))
+ (sh (or (and remotep "/bin/sh")
+ (and (bound-and-true-p explicit-shell-file-name)
+ (executable-find explicit-shell-file-name))
+ (executable-find "sh")))
+ (switch (if remotep "-c" shell-command-switch)))
+ (unless
+ (zerop
+ (process-file sh nil (current-buffer) nil switch script))
+ (user-error
+ "%s: No files matching wildcard" (cdr dir-wildcard)))
+ (insert-directory-clean (point) switches)))
+ (t
+ ;; We used to specify the C locale here, to force English
+ ;; month names; but this should not be necessary any
+ ;; more, with the new value of
+ ;; `directory-listing-before-filename-regexp'.
+ (if file-list
+ (dolist (f file-list)
+ (let ((beg (point)))
+ (insert-directory f switches nil nil)
+ ;; Re-align fields, if necessary.
+ (dired-align-file beg (point))))
+ (insert-directory dir switches wildcard (not wildcard))))))
;; Quote certain characters, unless ls quoted them for us.
(if (not (dired-switches-escape-p dired-actual-switches))
(save-excursion
@@ -1279,11 +1351,14 @@ see `dired-use-ls-dired' for more details.")
;; Note that dired-build-subdir-alist will replace the name
;; by its expansion, so it does not matter whether what we insert
;; here is fully expanded, but it should be absolute.
- (insert " " (directory-file-name (file-name-directory dir)) ":\n")
+ (insert " " (or (car-safe (insert-directory-wildcard-in-dir-p dir))
+ (directory-file-name (file-name-directory dir))) ":\n")
(setq content-point (point)))
(when wildcard
;; Insert "wildcard" line where "total" line would be for a full dir.
- (insert " wildcard " (file-name-nondirectory dir) "\n")))
+ (insert " wildcard " (or (cdr-safe (insert-directory-wildcard-in-dir-p dir))
+ (file-name-nondirectory dir))
+ "\n")))
(dired-insert-set-properties content-point (point)))))
(defun dired-insert-set-properties (beg end)
@@ -1369,18 +1444,22 @@ ARG and NOCONFIRM, passed from `revert-buffer', are ignored."
The positions have the form (BUFFER-POSITION WINDOW-POSITIONS).
BUFFER-POSITION is the point position in the current Dired buffer.
-It has the form (BUFFER DIRED-FILENAME BUFFER-POINT).
+It has the form (BUFFER DIRED-FILENAME BUFFER-LINE-NUMBER).
WINDOW-POSITIONS are current positions in all windows displaying
this dired buffer. The window positions have the form (WINDOW
-DIRED-FILENAME WINDOW-POINT)."
+DIRED-FILENAME WINDOW-LINE-NUMBER).
+
+We store line numbers instead of point positions because the header
+lines might change as well: when this happen the line number doesn't
+change; the point does."
(list
- (list (current-buffer) (dired-get-filename nil t) (point))
+ (list (current-buffer) (dired-get-filename nil t) (line-number-at-pos))
(mapcar (lambda (w)
- (list w
- (with-selected-window w
- (dired-get-filename nil t))
- (window-point w)))
+ (with-selected-window w
+ (list w
+ (dired-get-filename nil t)
+ (line-number-at-pos (window-point w)))))
(get-buffer-window-list nil 0 t))))
(defun dired-restore-positions (positions)
@@ -1389,7 +1468,8 @@ DIRED-FILENAME WINDOW-POINT)."
(buffer (nth 0 buf-file-pos)))
(unless (and (nth 1 buf-file-pos)
(dired-goto-file (nth 1 buf-file-pos)))
- (goto-char (nth 2 buf-file-pos))
+ (goto-char (point-min))
+ (forward-line (1- (nth 2 buf-file-pos)))
(dired-move-to-filename))
(dolist (win-file-pos (nth 1 positions))
;; Ensure that window still displays the original buffer.
@@ -1397,7 +1477,8 @@ DIRED-FILENAME WINDOW-POINT)."
(with-selected-window (nth 0 win-file-pos)
(unless (and (nth 1 win-file-pos)
(dired-goto-file (nth 1 win-file-pos)))
- (goto-char (nth 2 win-file-pos))
+ (goto-char (point-min))
+ (forward-line (1- (nth 2 win-file-pos)))
(dired-move-to-filename)))))))
(defun dired-remember-marks (beg end)
@@ -2900,6 +2981,14 @@ Any other value means to ask for each directory."
;; Match anything but `.' and `..'.
(defvar dired-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")
+(defconst dired-delete-help
+ "Type:
+`yes' to delete recursively the current directory,
+`no' to skip to next,
+`all' to delete all remaining directories with no more questions,
+`quit' to exit,
+`help' to show this help message.")
+
;; Delete file, possibly delete a directory and all its files.
;; This function is useful outside of dired. One could change its name
;; to e.g. recursive-delete-file and put it somewhere else.
@@ -2915,23 +3004,45 @@ its possible values is:
TRASH non-nil means to trash the file instead of deleting, provided
`delete-by-moving-to-trash' (which see) is non-nil."
- ;; This test is equivalent to
- ;; (and (file-directory-p fn) (not (file-symlink-p fn)))
- ;; but more efficient
- (if (not (eq t (car (file-attributes file))))
- (delete-file file trash)
- (if (and recursive
- (directory-files file t dired-re-no-dot) ; Not empty.
- (or (eq recursive 'always)
- (yes-or-no-p (format "Recursively %s %s? "
- (if (and trash
- delete-by-moving-to-trash)
- "trash"
- "delete")
- (dired-make-relative file)))))
- (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask again.
- (setq recursive nil))
- (delete-directory file recursive trash)))
+ ;; This test is equivalent to
+ ;; (and (file-directory-p fn) (not (file-symlink-p fn)))
+ ;; but more efficient
+ (if (not (eq t (car (file-attributes file))))
+ (delete-file file trash)
+ (let* ((valid-answers (list "yes" "no" "all" "quit" "help"))
+ (answer "")
+ (input-fn
+ (lambda ()
+ (setq answer
+ (read-string
+ (format "Recursively %s %s? [yes, no, all, quit, help] "
+ (if (and trash
+ delete-by-moving-to-trash)
+ "trash"
+ "delete")
+ (dired-make-relative file))))
+ (when (string= answer "help")
+ (with-help-window "*Help*"
+ (with-current-buffer "*Help*" (insert dired-delete-help))))
+ answer)))
+ (if (and recursive
+ (directory-files file t dired-re-no-dot) ; Not empty.
+ (eq recursive 'always))
+ (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask again.
+ ;; Otherwise prompt user:
+ (funcall input-fn)
+ (while (not (member answer valid-answers))
+ (unless (string= answer "help")
+ (beep)
+ (message "Please answer `yes' or `no' or `all' or `quit'")
+ (sleep-for 2))
+ (funcall input-fn))
+ (pcase answer
+ ('"all" (setq recursive 'always dired-recursive-deletes recursive))
+ ('"yes" (if (eq recursive 'top) (setq recursive 'always)))
+ ('"no" (setq recursive nil))
+ ('"quit" (keyboard-quit))))
+ (delete-directory file recursive trash))))
(defun dired-do-flagged-delete (&optional nomessage)
"In Dired, delete the files flagged for deletion.
@@ -2980,6 +3091,9 @@ non-empty directories is allowed."
(let* ((files (mapcar #'car l))
(count (length l))
(succ 0)
+ ;; Bind `dired-recursive-deletes' so that we can change it
+ ;; locally according with the user answer within `dired-delete-file'.
+ (dired-recursive-deletes dired-recursive-deletes)
(trashing (and trash delete-by-moving-to-trash)))
;; canonicalize file list for pop up
(setq files (nreverse (mapcar #'dired-make-relative files)))
@@ -2989,6 +3103,7 @@ non-empty directories is allowed."
(if trashing "Trash" "Delete")
(dired-mark-prompt arg files)))
(save-excursion
+ (catch '--delete-cancel
(let ((progress-reporter
(make-progress-reporter
(if trashing "Trashing..." "Deleting...")
@@ -3006,6 +3121,7 @@ non-empty directories is allowed."
(dired-fun-in-all-buffers
(file-name-directory fn) (file-name-nondirectory fn)
#'dired-delete-entry fn))
+ (quit (throw '--delete-cancel (message "OK, canceled")))
(error ;; catch errors from failed deletions
(dired-log "%s\n" err)
(setq failures (cons (car (car l)) failures)))))
@@ -3016,7 +3132,7 @@ non-empty directories is allowed."
(format "%d of %d deletion%s failed"
(length failures) count
(dired-plural-s count))
- failures))))
+ failures)))))
(message "(No deletions performed)")))
(dired-move-to-filename))
diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
index a99474547bf..c9dd28a40fa 100644
--- a/lisp/display-line-numbers.el
+++ b/lisp/display-line-numbers.el
@@ -38,7 +38,6 @@
"Display line numbers in the buffer."
:group 'display)
-;;;###autoload
(defcustom display-line-numbers-type t
"The default type of line numbers to use in `display-line-numbers-mode'.
See `display-line-numbers' for value options."
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 8fe94013700..4a9bd6d06b3 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -875,16 +875,16 @@ FILE's modification time."
"Save current buffer to its file, atomically."
;; Copied from byte-compile-file.
(let* ((version-control 'never)
- (tempfile (make-temp-name buffer-file-name))
+ (tempfile (make-temp-file buffer-file-name))
(kill-emacs-hook
(cons (lambda () (ignore-errors (delete-file tempfile)))
kill-emacs-hook)))
(write-region (point-min) (point-max) tempfile nil 1)
(backup-buffer)
- (rename-file tempfile buffer-file-name t)
- (set-buffer-modified-p nil)
- (set-visited-file-modtime)
- (or noninteractive (message "Wrote %s" buffer-file-name))))
+ (rename-file tempfile buffer-file-name t))
+ (set-buffer-modified-p nil)
+ (set-visited-file-modtime)
+ (or noninteractive (message "Wrote %s" buffer-file-name)))
(defun autoload-save-buffers ()
(while autoload-modified-buffers
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
index 17f1ffa9f61..32f7d2c6d8d 100644
--- a/lisp/emacs-lisp/avl-tree.el
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -52,7 +52,7 @@
;;; Code:
(eval-when-compile (require 'cl-lib))
-
+(require 'generator)
;; ================================================================
@@ -670,6 +670,21 @@ a null element stored in the AVL tree.)"
(null (avl-tree--stack-store avl-tree-stack)))
+(iter-defun avl-tree-iter (tree &optional reverse)
+ "Return an AVL tree iterator object.
+
+Calling `iter-next' on this object will retrieve the next element
+from TREE. If REVERSE is non-nil, elements are returned in
+reverse order.
+
+Note that any modification to TREE *immediately* invalidates all
+iterators created from TREE before the modification (in
+particular, calling `iter-next' will give unpredictable results)."
+ (let ((stack (avl-tree-stack tree reverse)))
+ (while (not (avl-tree-stack-empty-p stack))
+ (iter-yield (avl-tree-stack-pop stack)))))
+
+
(provide 'avl-tree)
;;; avl-tree.el ends here
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index fdd4276e4e7..5fa7389e431 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1888,25 +1888,27 @@ The value is non-nil if there were no errors, nil if errors."
(insert "\n") ; aaah, unix.
(if (file-writable-p target-file)
;; We must disable any code conversion here.
- (let* ((coding-system-for-write 'no-conversion)
- ;; Write to a tempfile so that if another Emacs
- ;; process is trying to load target-file (eg in a
- ;; parallel bootstrap), it does not risk getting a
- ;; half-finished file. (Bug#4196)
- (tempfile (make-temp-name target-file))
- (kill-emacs-hook
- (cons (lambda () (ignore-errors (delete-file tempfile)))
- kill-emacs-hook)))
- (write-region (point-min) (point-max) tempfile nil 1)
- ;; This has the intentional side effect that any
- ;; hard-links to target-file continue to
- ;; point to the old file (this makes it possible
- ;; for installed files to share disk space with
- ;; the build tree, without causing problems when
- ;; emacs-lisp files in the build tree are
- ;; recompiled). Previously this was accomplished by
- ;; deleting target-file before writing it.
- (rename-file tempfile target-file t)
+ (progn
+ (let* ((coding-system-for-write 'no-conversion)
+ ;; Write to a tempfile so that if another Emacs
+ ;; process is trying to load target-file (eg in a
+ ;; parallel bootstrap), it does not risk getting a
+ ;; half-finished file. (Bug#4196)
+ (tempfile (make-temp-file target-file))
+ (kill-emacs-hook
+ (cons (lambda () (ignore-errors
+ (delete-file tempfile)))
+ kill-emacs-hook)))
+ (write-region (point-min) (point-max) tempfile nil 1)
+ ;; This has the intentional side effect that any
+ ;; hard-links to target-file continue to
+ ;; point to the old file (this makes it possible
+ ;; for installed files to share disk space with
+ ;; the build tree, without causing problems when
+ ;; emacs-lisp files in the build tree are
+ ;; recompiled). Previously this was accomplished by
+ ;; deleting target-file before writing it.
+ (rename-file tempfile target-file t))
(or noninteractive (message "Wrote %s" target-file)))
;; This is just to give a better error message than write-region
(let ((exists (file-exists-p target-file)))
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 6a4ee47ac24..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
(defmacro cl--generic (name)
`(get ,name 'cl--generic))
+(defun cl-generic-p (f)
+ "Return non-nil if F is a generic function."
+ (and (symbolp f) (cl--generic f)))
+
(defun cl-generic-ensure-function (name &optional noerror)
(let (generic
(origname name))
@@ -409,7 +413,7 @@ The set of acceptable TYPEs (also called \"specializers\") is defined
\(and can be extended) by the various methods of `cl-generic-generalizers'.
\(fn NAME [QUALIFIER] ARGS &rest [DOCSTRING] BODY)"
- (declare (doc-string 3) (indent 2)
+ (declare (doc-string 3) (indent defun)
(debug
(&define ; this means we are defining something
[&or name ("setf" name :name setf)]
@@ -500,25 +504,26 @@ The set of acceptable TYPEs (also called \"specializers\") is defined
(cons method mt)
;; Keep the ordering; important for methods with :extra qualifiers.
(mapcar (lambda (x) (if (eq x (car me)) method x)) mt)))
- (cl-pushnew `(cl-defmethod . ,(cl--generic-load-hist-format
- (cl--generic-name generic)
- qualifiers specializers))
- current-load-list :test #'equal)
- ;; FIXME: Try to avoid re-constructing a new function if the old one
- ;; is still valid (e.g. still empty method cache)?
- (let ((gfun (cl--generic-make-function generic))
- ;; Prevent `defalias' from recording this as the definition site of
- ;; the generic function.
- current-load-list)
- ;; For aliases, cl--generic-name gives us the actual name.
- (let ((purify-flag
- ;; BEWARE! Don't purify this function definition, since that leads
- ;; to memory corruption if the hash-tables it holds are modified
- ;; (the GC doesn't trace those pointers).
- nil))
+ (let ((sym (cl--generic-name generic))) ; Actual name (for aliases).
+ (unless (symbol-function sym)
+ (defalias sym 'dummy)) ;Record definition into load-history.
+ (cl-pushnew `(cl-defmethod . ,(cl--generic-load-hist-format
+ (cl--generic-name generic)
+ qualifiers specializers))
+ current-load-list :test #'equal)
+ ;; FIXME: Try to avoid re-constructing a new function if the old one
+ ;; is still valid (e.g. still empty method cache)?
+ (let ((gfun (cl--generic-make-function generic))
+ ;; Prevent `defalias' from recording this as the definition site of
+ ;; the generic function.
+ current-load-list
+ ;; BEWARE! Don't purify this function definition, since that leads
+ ;; to memory corruption if the hash-tables it holds are modified
+ ;; (the GC doesn't trace those pointers).
+ (purify-flag nil))
;; But do use `defalias', so that it interacts properly with nadvice,
;; e.g. for tracing/debug-on-entry.
- (defalias (cl--generic-name generic) gfun)))))
+ (defalias sym gfun)))))
(defmacro cl--generic-with-memoization (place &rest code)
(declare (indent 1) (debug t))
@@ -1022,6 +1027,20 @@ The value returned is a list of elements of the form
(push (cl--generic-method-info method) docs))))
docs))
+(defun cl--generic-method-files (method)
+ "Return a list of files where METHOD is defined by `cl-defmethod'.
+The list will have entries of the form (FILE . (METHOD ...))
+where (METHOD ...) contains the qualifiers and specializers of
+the method and is a suitable argument for
+`find-function-search-for-symbol'. Filenames are absolute."
+ (let (result)
+ (pcase-dolist (`(,file . ,defs) load-history)
+ (dolist (def defs)
+ (when (and (eq (car-safe def) 'cl-defmethod)
+ (eq (cadr def) method))
+ (push (cons file (cdr def)) result))))
+ result))
+
;;; Support for (head <val>) specializers.
;; For both the `eql' and the `head' specializers, the dispatch
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."
((consp func-marker)
(message "%s is already instrumented." func)
(list func))
- ((get func 'cl--generic)
- (let ((method-defs (method-files func))
+ ((cl-generic-p func)
+ (let ((method-defs (cl--generic-method-files func))
symbols)
(unless method-defs
(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:
(if (memq method '(no-next-method no-applicable-method))
(symbol-function method)
(let ((generic (cl-generic-ensure-function method)))
- (symbol-function (cl--generic-name generic)))))
+ (or (symbol-function (cl--generic-name generic))
+ (cl--generic-make-function generic)))))
;;;###autoload
(defun eieio--defmethod (method kind argclass code)
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."
(elp-restore-all)
;; continue standard unloading
nil)
+
+(cl-defmethod loadhist-unload-element :before :extra "elp" ((x (head defun)))
+ "Un-instrument before unloading a function."
+ (elp-restore-function (cdr x)))
+
(provide 'elp)
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 5c88b070f65..d7bd331c11b 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -135,16 +135,9 @@ Emacs bug 6581 at URL `http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6581'."
;; Note that nil is still a valid value for the `name' slot in
;; ert-test objects. It designates an anonymous test.
(error "Attempt to define a test named nil"))
- (put symbol 'ert--test definition)
- ;; Register in load-history, so `symbol-file' can find us, and so
- ;; unload-feature can unload our tests.
- (cl-pushnew `(ert-deftest . ,symbol) current-load-list :test #'equal)
+ (define-symbol-prop symbol 'ert--test definition)
definition)
-(cl-defmethod loadhist-unload-element ((x (head ert-deftest)))
- (let ((name (cdr x)))
- (put name 'ert--test nil)))
-
(defun ert-make-test-unbound (symbol)
"Make SYMBOL name no test. Return SYMBOL."
(cl-remprop symbol 'ert--test)
@@ -2406,8 +2399,7 @@ To be used in the ERT results buffer."
(buffer-disable-undo)
(erase-buffer)
(ert-simple-view-mode)
- ;; Use unibyte because `debugger-setup-buffer' also does so.
- (set-buffer-multibyte nil)
+ (set-buffer-multibyte t) ; mimic debugger-setup-buffer
(setq truncate-lines t)
(ert--print-backtrace backtrace t)
(goto-char (point-min))
@@ -2540,7 +2532,7 @@ To be used in the ERT results buffer."
(insert (if test-name (format "%S" test-name) "<anonymous test>"))
(insert " is a test")
(let ((file-name (and test-name
- (symbol-file test-name 'ert-deftest))))
+ (symbol-file test-name 'ert--test))))
(when file-name
(insert (format-message " defined in `%s'"
(file-name-nondirectory file-name)))
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index b40161104d2..253b60e7534 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -418,8 +418,8 @@ to this macro."
(when decl (setq body (remove decl body)))
`(progn
(defun ,fsym ,args ,@body)
- (put ',fsym 'edebug-form-spec ',(cadr (assq 'debug decl)))
- (put ',name 'pcase-macroexpander #',fsym))))
+ (define-symbol-prop ',fsym 'edebug-form-spec ',(cadr (assq 'debug decl)))
+ (define-symbol-prop ',name 'pcase-macroexpander #',fsym))))
(defun pcase--match (val upat)
"Build a MATCH structure, hoisting all `or's and `and's outside."
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index f60d723a883..2eff1d1ab30 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -64,8 +64,8 @@
;; syntax and string syntax are both delimited by `"'s and behave
;; according to their name. With the `string' syntax there's no need
;; to escape the backslashes and double quotes simplifying the editing
-;; somewhat. The other three allow editing of symbolic regular
-;; expressions supported by the packages of the same name.
+;; somewhat. The `rx' syntax allows editing of symbolic regular
+;; expressions supported by the package of the same name.
;; Editing symbolic expressions is done through a major mode derived
;; from `emacs-lisp-mode' so you'll get all the good stuff like
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index b6b49b1bfa2..8ff5cdf18e8 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -194,6 +194,8 @@ Populated by `tabulated-list-init-header'.")
mouse-face highlight
keymap ,tabulated-list-sort-button-map))
(cols nil))
+ (if display-line-numbers
+ (setq x (+ x (line-number-display-width) 2)))
(push (propertize " " 'display `(space :align-to ,x)) cols)
(dotimes (n (length tabulated-list-format))
(let* ((col (aref tabulated-list-format n))
@@ -410,6 +412,8 @@ of column descriptors."
(x (max tabulated-list-padding 0))
(ncols (length tabulated-list-format))
(inhibit-read-only t))
+ (if display-line-numbers
+ (setq x (+ x (line-number-display-width) 2)))
(if (> tabulated-list-padding 0)
(insert (make-string x ?\s)))
(let ((tabulated-list--near-rows ; Bind it if not bound yet (Bug#25506).
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 79799db30bc..38e38132bf7 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."
"If non-nil, use `eshell-ls' to read directories in Dired.
Changing this without using customize has no effect."
:set (lambda (symbol value)
- (if value
- (advice-add 'insert-directory :around
- #'eshell-ls--insert-directory)
- (advice-remove 'insert-directory
- #'eshell-ls--insert-directory))
+ (cond (value
+ (require 'dired)
+ (advice-add 'insert-directory :around
+ #'eshell-ls--insert-directory)
+ (advice-add 'dired :around #'eshell-ls--dired))
+ (t
+ (advice-remove 'insert-directory
+ #'eshell-ls--insert-directory)
+ (advice-remove 'dired #'eshell-ls--dired)))
(set symbol value))
:type 'boolean
:require 'em-ls)
-(add-hook 'eshell-ls-unload-hook
- (lambda () (advice-remove 'insert-directory
- #'eshell-ls--insert-directory)))
+(add-hook 'eshell-ls-unload-hook #'eshell-ls-unload-function)
(defcustom eshell-ls-default-blocksize 1024
@@ -241,6 +243,9 @@ scope during the evaluation of TEST-SEXP."
;;; Functions:
+(declare-function eshell-extended-glob "em-glob" (glob))
+(defvar eshell-error-if-no-glob)
+
(defun eshell-ls--insert-directory
(orig-fun file switches &optional wildcard full-directory-p)
"Insert directory listing for FILE, formatted according to SWITCHES.
@@ -273,11 +278,53 @@ instead."
(set 'font-lock-buffers
(delq (current-buffer)
(symbol-value 'font-lock-buffers)))))
- (let ((insert-func 'insert)
- (error-func 'insert)
- (flush-func 'ignore)
- eshell-ls-dired-initial-args)
- (eshell-do-ls (append switches (list file)))))))))
+ (require 'em-glob)
+ (let* ((insert-func 'insert)
+ (error-func 'insert)
+ (flush-func 'ignore)
+ (eshell-error-if-no-glob t)
+ (target ; Expand the shell wildcards if any.
+ (if (and (atom file)
+ (string-match "[[?*]" file)
+ (not (file-exists-p file)))
+ (mapcar #'file-relative-name (eshell-extended-glob file))
+ (file-relative-name file)))
+ (switches
+ (append eshell-ls-dired-initial-args
+ (and (or (consp dired-directory) wildcard) (list "-d"))
+ switches)))
+ (eshell-do-ls (nconc switches (list target)))))))))
+
+
+(declare-function eshell-extended-glob "em-glob" (glob))
+(declare-function dired-read-dir-and-switches "dired" (str))
+(declare-function dired-goto-next-file "dired" ())
+
+(defun eshell-ls--dired (orig-fun dir-or-list &optional switches)
+ (interactive (dired-read-dir-and-switches ""))
+ (require 'em-glob)
+ (if (consp dir-or-list)
+ (funcall orig-fun dir-or-list switches)
+ (let ((dir-wildcard (insert-directory-wildcard-in-dir-p
+ (expand-file-name dir-or-list))))
+ (if (not dir-wildcard)
+ (funcall orig-fun dir-or-list switches)
+ (let* ((default-directory (car dir-wildcard))
+ (files (eshell-extended-glob (cdr dir-wildcard)))
+ (dir (car dir-wildcard)))
+ (if files
+ (let ((inhibit-read-only t)
+ (buf
+ (apply orig-fun
+ (nconc (list dir) files)
+ (and switches (list switches)))))
+ (with-current-buffer buf
+ (save-excursion
+ (goto-char (point-min))
+ (dired-goto-next-file)
+ (forward-line 0)
+ (insert " wildcard " (cdr dir-wildcard) "\n"))))
+ (user-error "No files matching regexp")))))))
(defsubst eshell/ls (&rest args)
"An alias version of `eshell-do-ls'."
@@ -909,6 +956,11 @@ to use, and each member of which is the width of that column
(car file)))))
(car file))
+(defun eshell-ls-unload-function ()
+ (advice-remove 'insert-directory #'eshell-ls--insert-directory)
+ (advice-remove 'dired #'eshell-ls--dired)
+ nil)
+
(provide 'em-ls)
;; Local Variables:
diff --git a/lisp/faces.el b/lisp/faces.el
index 97c32165b9c..5ed11d11cef 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -104,7 +104,9 @@ a font height that isn't optimal."
;; when combined with Monospaced and with other standard fonts.
;; One of its uses is for 'tex-verbatim' and 'Info-quoted' faces,
;; so the result must be different from the default face's font,
- ;; and must be monospaced.
+ ;; and must be monospaced. For 'tex-verbatim', it is desirable
+ ;; that the font really is a Serif font, so as to look like
+ ;; TeX's 'verbatim'.
("Monospace Serif"
;; This looks good on GNU/Linux.
@@ -1452,7 +1454,7 @@ If FRAME is omitted or nil, use the selected frame."
(setq face (list face)))
(with-help-window (help-buffer)
(with-current-buffer standard-output
- (dolist (f face)
+ (dolist (f face (buffer-string))
(if (stringp f) (setq f (intern f)))
;; We may get called for anonymous faces (i.e., faces
;; expressed using prop-value plists). Those can't be
diff --git a/lisp/files.el b/lisp/files.el
index 321a35b530d..c9114be55a9 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -978,12 +978,15 @@ or mount points potentially requiring authentication as a different user.")
;; nil)))
(defun locate-dominating-file (file name)
- "Look up the directory hierarchy from FILE for a directory containing NAME.
+ "Starting from FILE, look up directory hierarchy for directory containing NAME.
+FILE can be a file or a directory. If it's a file, its directory will
+serve as the starting point for searching the hierarchy of directories.
Stop at the first parent directory containing a file NAME,
and return the directory. Return nil if not found.
Instead of a string, NAME can also be a predicate taking one argument
\(a directory) and returning a non-nil value if that directory is the one for
-which we're looking."
+which we're looking. The predicate will be called with every file/directory
+the function needs to examine, starting with FILE."
;; We used to use the above locate-dominating-files code, but the
;; directory-files call is very costly, so we're much better off doing
;; multiple calls using the code in here.
@@ -1596,8 +1599,8 @@ automatically choosing a major mode, use \\[find-file-literally]."
(confirm-nonexistent-file-or-buffer)))
(let ((value (find-file-noselect filename nil nil wildcards)))
(if (listp value)
- (mapcar 'switch-to-buffer (nreverse value))
- (switch-to-buffer value))))
+ (mapcar 'pop-to-buffer-same-window (nreverse value))
+ (pop-to-buffer-same-window value))))
(defun find-file-other-window (filename &optional wildcards)
"Edit file FILENAME, in another window.
@@ -6552,6 +6555,75 @@ regardless of the language.")
(defvar insert-directory-ls-version 'unknown)
+(defun insert-directory-wildcard-in-dir-p (dir)
+ "Return non-nil if DIR contents a shell wildcard in the directory part.
+The return value is a cons (DIR . WILDCARDS); DIR is the
+`default-directory' in the Dired buffer, and WILDCARDS are the wildcards.
+
+Valid wildcards are '*', '?', '[abc]' and '[a-z]'."
+ (let ((wildcards "[?*"))
+ (when (and (or (not (featurep 'ls-lisp))
+ ls-lisp-support-shell-wildcards)
+ (string-match (concat "[" wildcards "]") (file-name-directory dir))
+ (not (file-exists-p dir))) ; Prefer an existing file to wildcards.
+ (let ((regexp (format "\\`\\([^%s]*/\\)\\([^%s]*[%s].*\\)"
+ wildcards wildcards wildcards)))
+ (string-match regexp dir)
+ (cons (match-string 1 dir) (match-string 2 dir))))))
+
+(defun insert-directory-clean (beg switches)
+ (when (if (stringp switches)
+ (string-match "--dired\\>" switches)
+ (member "--dired" switches))
+ ;; The following overshoots by one line for an empty
+ ;; directory listed with "--dired", but without "-a"
+ ;; switch, where the ls output contains a
+ ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
+ ;; We take care of that case later.
+ (forward-line -2)
+ (when (looking-at "//SUBDIRED//")
+ (delete-region (point) (progn (forward-line 1) (point)))
+ (forward-line -1))
+ (if (looking-at "//DIRED//")
+ (let ((end (line-end-position))
+ (linebeg (point))
+ error-lines)
+ ;; Find all the lines that are error messages,
+ ;; and record the bounds of each one.
+ (goto-char beg)
+ (while (< (point) linebeg)
+ (or (eql (following-char) ?\s)
+ (push (list (point) (line-end-position)) error-lines))
+ (forward-line 1))
+ (setq error-lines (nreverse error-lines))
+ ;; Now read the numeric positions of file names.
+ (goto-char linebeg)
+ (forward-word-strictly 1)
+ (forward-char 3)
+ (while (< (point) end)
+ (let ((start (insert-directory-adj-pos
+ (+ beg (read (current-buffer)))
+ error-lines))
+ (end (insert-directory-adj-pos
+ (+ beg (read (current-buffer)))
+ error-lines)))
+ (if (memq (char-after end) '(?\n ?\s))
+ ;; End is followed by \n or by " -> ".
+ (put-text-property start end 'dired-filename t)
+ ;; It seems that we can't trust ls's output as to
+ ;; byte positions of filenames.
+ (put-text-property beg (point) 'dired-filename nil)
+ (end-of-line))))
+ (goto-char end)
+ (beginning-of-line)
+ (delete-region (point) (progn (forward-line 1) (point))))
+ ;; Take care of the case where the ls output contains a
+ ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line
+ ;; and we went one line too far back (see above).
+ (forward-line 1))
+ (if (looking-at "//DIRED-OPTIONS//")
+ (delete-region (point) (progn (forward-line 1) (point))))))
+
;; insert-directory
;; - must insert _exactly_one_line_ describing FILE if WILDCARD and
;; FULL-DIRECTORY-P is nil.
@@ -6611,19 +6683,25 @@ normally equivalent short `-D' option is just passed on to
default-file-name-coding-system))))
(setq result
(if wildcard
- ;; Run ls in the directory part of the file pattern
- ;; using the last component as argument.
- (let ((default-directory
- (if (file-name-absolute-p file)
- (file-name-directory file)
- (file-name-directory (expand-file-name file))))
- (pattern (file-name-nondirectory file)))
+ ;; If the wildcard is just in the file part, then run ls in
+ ;; the directory part of the file pattern using the last
+ ;; component as argument. Otherwise, run ls in the longest
+ ;; subdirectory of the directory part free of wildcards; use
+ ;; the remaining of the file pattern as argument.
+ (let* ((dir-wildcard (insert-directory-wildcard-in-dir-p file))
+ (default-directory
+ (cond (dir-wildcard (car dir-wildcard))
+ (t
+ (if (file-name-absolute-p file)
+ (file-name-directory file)
+ (file-name-directory (expand-file-name file))))))
+ (pattern (if dir-wildcard (cdr dir-wildcard) (file-name-nondirectory file))))
;; NB since switches is passed to the shell, be
;; careful of malicious values, eg "-l;reboot".
;; See eg dired-safe-switches-p.
(call-process
shell-file-name nil t nil
- "-c"
+ shell-command-switch
(concat (if (memq system-type '(ms-dos windows-nt))
""
"\\") ; Disregard Unix shell aliases!
@@ -6665,7 +6743,8 @@ normally equivalent short `-D' option is just passed on to
(setq file (expand-file-name file)))
(list
(if full-directory-p
- (concat (file-name-as-directory file) ".")
+ ;; (concat (file-name-as-directory file) ".")
+ file
file))))))))
;; 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
;; Unix. Access the file to get a suitable error.
(access-file file "Reading directory")
(error "Listing directory failed but `access-file' worked")))
-
- (when (if (stringp switches)
- (string-match "--dired\\>" switches)
- (member "--dired" switches))
- ;; The following overshoots by one line for an empty
- ;; directory listed with "--dired", but without "-a"
- ;; switch, where the ls output contains a
- ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
- ;; We take care of that case later.
- (forward-line -2)
- (when (looking-at "//SUBDIRED//")
- (delete-region (point) (progn (forward-line 1) (point)))
- (forward-line -1))
- (if (looking-at "//DIRED//")
- (let ((end (line-end-position))
- (linebeg (point))
- error-lines)
- ;; Find all the lines that are error messages,
- ;; and record the bounds of each one.
- (goto-char beg)
- (while (< (point) linebeg)
- (or (eql (following-char) ?\s)
- (push (list (point) (line-end-position)) error-lines))
- (forward-line 1))
- (setq error-lines (nreverse error-lines))
- ;; Now read the numeric positions of file names.
- (goto-char linebeg)
- (forward-word-strictly 1)
- (forward-char 3)
- (while (< (point) end)
- (let ((start (insert-directory-adj-pos
- (+ beg (read (current-buffer)))
- error-lines))
- (end (insert-directory-adj-pos
- (+ beg (read (current-buffer)))
- error-lines)))
- (if (memq (char-after end) '(?\n ?\s))
- ;; End is followed by \n or by " -> ".
- (put-text-property start end 'dired-filename t)
- ;; It seems that we can't trust ls's output as to
- ;; byte positions of filenames.
- (put-text-property beg (point) 'dired-filename nil)
- (end-of-line))))
- (goto-char end)
- (beginning-of-line)
- (delete-region (point) (progn (forward-line 1) (point))))
- ;; Take care of the case where the ls output contains a
- ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line
- ;; and we went one line too far back (see above).
- (forward-line 1))
- (if (looking-at "//DIRED-OPTIONS//")
- (delete-region (point) (progn (forward-line 1) (point)))))
-
+ (insert-directory-clean beg switches)
;; Now decode what read if necessary.
(let ((coding (or coding-system-for-read
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 @@
-;;; find-dired.el --- run a `find' command and dired the output
+;;; find-dired.el --- run a `find' command and dired the output -*- lexical-binding: t -*-
;; Copyright (C) 1992, 1994-1995, 2000-2017 Free Software Foundation,
;; 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 @@
-;;; find-lisp.el --- emulation of find in Emacs Lisp
+;;; find-lisp.el --- emulation of find in Emacs Lisp -*- lexical-binding: t -*-
;; Author: Peter Breton
;; Created: Fri Mar 26 1999
diff --git a/lisp/frame.el b/lisp/frame.el
index 634367edf45..2a14302e9fb 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2158,7 +2158,7 @@ To adjust bottom dividers for frames individually, use the frame
parameter `bottom-divider-width'."
:type '(restricted-sexp
:tag "Default width of bottom dividers"
- :match-alternatives (frame-window-divider-width-valid-p))
+ :match-alternatives (window-divider-width-valid-p))
:initialize 'custom-initialize-default
:set (lambda (symbol value)
(set-default symbol value)
@@ -2175,7 +2175,7 @@ To adjust right dividers for frames individually, use the frame
parameter `right-divider-width'."
:type '(restricted-sexp
:tag "Default width of right dividers"
- :match-alternatives (frame-window-divider-width-valid-p))
+ :match-alternatives (window-divider-width-valid-p))
:initialize 'custom-initialize-default
:set (lambda (symbol value)
(set-default symbol value)
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index 10cdeed3fbb..177589c5f03 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -393,7 +393,7 @@ apply the face `mm-uu-extract'."
(defun mm-uu-org-src-code-block-extract ()
(mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
- '("text/x-org")))
+ '("text/x-org" (charset . gnus-decoded))))
(defvar gnus-newsgroup-name)
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 3fb793e7aa5..24dfb9120bf 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -393,12 +393,12 @@ it does not already exist."
(defvar describe-symbol-backends
`((nil ,#'fboundp ,(lambda (s _b _f) (describe-function s)))
- ("face" ,#'facep ,(lambda (s _b _f) (describe-face s)))
(nil
,(lambda (symbol)
(or (and (boundp symbol) (not (keywordp symbol)))
(get symbol 'variable-documentation)))
- ,#'describe-variable)))
+ ,#'describe-variable)
+ ("face" ,#'facep ,(lambda (s _b _f) (describe-face s)))))
;;;###autoload
(defun help-make-xrefs (&optional buffer)
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 @@
-;;; ido.el --- interactively do things with buffers and files
+;;; ido.el --- interactively do things with buffers and files -*- lexical-binding: t -*-
;; Copyright (C) 1996-2017 Free Software Foundation, Inc.
diff --git a/lisp/info.el b/lisp/info.el
index a2071533d8f..c7f0bbf08d2 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -171,7 +171,11 @@ A header-line does not scroll with the rest of the buffer."
;; defvar and explicitly give it a standard-value property, and
;; call custom-initialize-delay on it.
;; The progn forces the autoloader to include the whole thing, not
-;; just an abbreviated version.
+;; just an abbreviated version. The value is initialized at startup
+;; time, when command-line calls custom-reevaluate-setting on all
+;; the defcustoms in custom-delayed-init-variables. This is
+;; somewhat sub-optimal, as ideally this should be done when Info
+;; mode is first invoked.
;;;###autoload
(progn
(defcustom Info-default-directory-list
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index 68a412f206e..a7764b6a535 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1175,7 +1175,8 @@
:short-name "CNS11643-15"
:long-name "CNS11643-15 (Chinese traditional)"
:code-space [33 126 33 126]
- :code-offset #x27A000)
+ :code-offset #x27A000
+ :unify-map "CNS-F")
(unify-charset 'chinese-gb2312)
(unify-charset 'chinese-gbk)
@@ -1186,6 +1187,7 @@
(unify-charset 'chinese-cns11643-5)
(unify-charset 'chinese-cns11643-6)
(unify-charset 'chinese-cns11643-7)
+(unify-charset 'chinese-cns11643-15)
(unify-charset 'big5)
(unify-charset 'chinese-big5-1)
(unify-charset 'chinese-big5-2)
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 472972e3edb..2db8061fa4a 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -1,4 +1,4 @@
-;;; kmacro.el --- enhanced keyboard macros
+;;; kmacro.el --- enhanced keyboard macros -*- lexical-binding: t -*-
;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index dababdb4fa6..0cb2eb4c31b 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -1102,6 +1102,15 @@ options only, i.e. behave like `apropos-user-option'.
\(fn PATTERN &optional DO-NOT-ALL)" t nil)
+(autoload 'apropos-local-variable "apropos" "\
+Show buffer-local variables that match PATTERN.
+Optional arg BUFFER (default: current buffer) is the buffer to check.
+
+The output includes variables that are not yet set in BUFFER, but that
+will be buffer-local when set.
+
+\(fn PATTERN &optional BUFFER)" t nil)
+
(defalias 'command-apropos 'apropos-command)
(autoload 'apropos-command "apropos" "\
@@ -1167,6 +1176,13 @@ Returns list of symbols and values found.
\(fn PATTERN &optional DO-ALL)" t nil)
+(autoload 'apropos-local-value "apropos" "\
+Show buffer-local variables whose values match PATTERN.
+This is like `apropos-value', but only for buffer-local variables.
+Optional arg BUFFER (default: current buffer) is the buffer to check.
+
+\(fn PATTERN &optional BUFFER)" t nil)
+
(autoload 'apropos-documentation "apropos" "\
Show symbols whose documentation contains matches for PATTERN.
PATTERN can be a word, a list of words (separated by spaces),
@@ -2878,6 +2894,8 @@ columns on its right towards the left.
(put 'bug-reference-url-format 'safe-local-variable (lambda (s) (or (stringp s) (and (symbolp s) (get s 'bug-reference-url-format)))))
+(put 'bug-reference-bug-regexp 'safe-local-variable 'stringp)
+
(autoload 'bug-reference-mode "bug-reference" "\
Toggle hyperlinking bug references in the buffer (Bug Reference mode).
With a prefix argument ARG, enable Bug Reference mode if ARG is
@@ -7684,6 +7702,46 @@ in `.emacs'.
;;;***
+;;;### (autoloads nil "display-line-numbers" "display-line-numbers.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from display-line-numbers.el
+
+(autoload 'display-line-numbers-mode "display-line-numbers" "\
+Toggle display of line numbers in the buffer.
+This uses `display-line-numbers' internally.
+
+To change the type of line numbers displayed by default,
+customize `display-line-numbers-type'. To change the type while
+the mode is on, set `display-line-numbers' directly.
+
+\(fn &optional ARG)" t nil)
+
+(defvar global-display-line-numbers-mode nil "\
+Non-nil if Global Display-Line-Numbers mode is enabled.
+See the `global-display-line-numbers-mode' command
+for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `global-display-line-numbers-mode'.")
+
+(custom-autoload 'global-display-line-numbers-mode "display-line-numbers" nil)
+
+(autoload 'global-display-line-numbers-mode "display-line-numbers" "\
+Toggle Display-Line-Numbers mode in all buffers.
+With prefix ARG, enable Global Display-Line-Numbers mode if ARG is positive;
+otherwise, disable it. If called from Lisp, enable the mode if
+ARG is omitted or nil.
+
+Display-Line-Numbers mode is enabled in all buffers where
+`display-line-numbers--turn-on' would do it.
+See `display-line-numbers-mode' for more information on Display-Line-Numbers mode.
+
+\(fn &optional ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "display-line-numbers" '("display-line-numbers-")))
+
+;;;***
+
;;;### (autoloads nil "dissociate" "play/dissociate.el" (0 0 0 0))
;;; Generated autoloads from play/dissociate.el
@@ -11892,9 +11950,12 @@ Render FILE using EWW.
(autoload 'eww-search-words "eww" "\
Search the web for the text between BEG and END.
-See the `eww-search-prefix' variable for the search engine used.
+If region is active (and not whitespace), search the web for
+the text between BEG and END. Else, prompt the user for a search
+string. See the `eww-search-prefix' variable for the search
+engine used.
-\(fn &optional BEG END)" t nil)
+\(fn)" t nil)
(autoload 'eww-mode "eww" "\
Mode for browsing the web.
@@ -11935,7 +11996,7 @@ command to find the next error. The buffer is also in `comint-mode' and
(autoload 'executable-set-magic "executable" "\
Set this buffer's interpreter to INTERPRETER with optional ARGUMENT.
-The variables `executable-magicless-file-regexp', `executable-prefix',
+The variables `executable-magicless-file-regexp', `executable-prefix-env',
`executable-insert', `executable-query' and `executable-chmod' control
when and how magic numbers are inserted or replaced and scripts made
executable.
@@ -12316,7 +12377,8 @@ If `ffap-url-regexp' is not nil, the FILENAME may also be an URL.
With a prefix, this command behaves exactly like `ffap-file-finder'.
If `ffap-require-prefix' is set, the prefix meaning is reversed.
See also the variables `ffap-dired-wildcards', `ffap-newfile-prompt',
-and the functions `ffap-file-at-point' and `ffap-url-at-point'.
+`ffap-url-unwrap-local', `ffap-url-unwrap-remote', and the functions
+`ffap-file-at-point' and `ffap-url-at-point'.
\(fn &optional FILENAME)" t nil)
@@ -14998,8 +15060,12 @@ List of hook functions run by `grep-process-setup' (see `run-hooks').")
(custom-autoload 'grep-setup-hook "grep" t)
-(defconst grep-regexp-alist '(("^\\(.*?[^/\n]\\):[ ]*\\([1-9][0-9]*\\)[ ]*:" 1 2 ((lambda nil (when grep-highlight-matches (let* ((beg (match-end 0)) (end (save-excursion (goto-char beg) (line-end-position))) (mbeg (text-property-any beg end 'font-lock-face grep-match-face))) (when mbeg (- mbeg beg))))) lambda nil (when grep-highlight-matches (let* ((beg (match-end 0)) (end (save-excursion (goto-char beg) (line-end-position))) (mbeg (text-property-any beg end 'font-lock-face grep-match-face)) (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end)))) (when mend (- mend beg)))))) ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1)) "\
-Regexp used to match grep hits. See `compilation-error-regexp-alist'.")
+(autoload 'grep-regexp-alist "grep" "\
+Return a regexp alist to match grep hits.
+The regexp used depends on `grep-use-null-filename-separator'.
+See `compilation-error-regexp-alist' for format details.
+
+\(fn)" nil nil)
(defvar grep-program (purecopy "grep") "\
The default grep program for `grep-command' and `grep-find-command'.
@@ -19147,7 +19213,8 @@ Use \\[kmacro-insert-counter] to insert (and increment) the macro counter.
The counter value can be set or modified via \\[kmacro-set-counter] and \\[kmacro-add-counter].
The format of the counter can be modified via \\[kmacro-set-format].
-Use \\[kmacro-name-last-macro] to give it a permanent name.
+Use \\[kmacro-name-last-macro] to give it a name that will remain valid even
+after another macro is defined.
Use \\[kmacro-bind-to-key] to bind it to a key sequence.
\(fn ARG)" t nil)
@@ -19175,8 +19242,8 @@ just the last key in the key sequence that you used to call this
command. See `kmacro-call-repeat-key' and `kmacro-call-repeat-with-arg'
for details on how to adjust or disable this behavior.
-To make a macro permanent so you can call it even after defining
-others, use \\[kmacro-name-last-macro].
+To give a macro a name so you can call it even after defining others,
+use \\[kmacro-name-last-macro].
\(fn ARG &optional NO-REPEAT END-MACRO MACRO)" t nil)
@@ -19211,8 +19278,8 @@ Call last keyboard macro, ending it first if currently being defined.
With numeric prefix ARG, repeat macro that many times.
Zero argument means repeat until there is an error.
-To give a macro a permanent name, so you can call it
-even after defining other macros, use \\[kmacro-name-last-macro].
+To give a macro a name, so you can call it even after defining other
+macros, use \\[kmacro-name-last-macro].
\(fn ARG &optional NO-REPEAT)" t nil)
@@ -19522,7 +19589,7 @@ something strange, such as redefining an Emacs function.
\(fn FEATURE &optional FORCE)" t nil)
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "loadhist" '("unload-" "loadhist-hook-functions" "read-feature" "feature-" "file-")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "loadhist" '("loadhist-" "unload-" "read-feature" "feature-" "file-")))
;;;***
@@ -20360,7 +20427,7 @@ Default bookmark handler for Man buffers.
;;;### (autoloads nil "map" "emacs-lisp/map.el" (0 0 0 0))
;;; Generated autoloads from emacs-lisp/map.el
-(push (purecopy '(map 1 1)) package--builtin-versions)
+(push (purecopy '(map 1 2)) package--builtin-versions)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "map" '("map")))
@@ -22710,10 +22777,25 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-J" "org/ob-J.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-J.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-J" '("obj-" "org-babel-")))
+
+;;;***
+
;;;### (autoloads nil "ob-R" "org/ob-R.el" (0 0 0 0))
;;; Generated autoloads from org/ob-R.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-R" '("org-babel-")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-R" '("ob-R-" "org-babel-")))
+
+;;;***
+
+;;;### (autoloads nil "ob-abc" "org/ob-abc.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-abc.el
+(push (purecopy '(ob-abc 0 1)) package--builtin-versions)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-abc" '("org-babel-")))
;;;***
@@ -22753,6 +22835,13 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-coq" "org/ob-coq.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-coq.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-coq" '("org-babel-" "coq-program-name")))
+
+;;;***
+
;;;### (autoloads "actual autoloads are elsewhere" "ob-core" "org/ob-core.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from org/ob-core.el
@@ -22782,6 +22871,14 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-ebnf" "org/ob-ebnf.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-ebnf.el
+(push (purecopy '(ob-ebnf 1 0)) package--builtin-versions)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-ebnf" '("org-babel-")))
+
+;;;***
+
;;;### (autoloads nil "ob-emacs-lisp" "org/ob-emacs-lisp.el" (0 0
;;;;;; 0 0))
;;; Generated autoloads from org/ob-emacs-lisp.el
@@ -22804,6 +22901,13 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-forth" "org/ob-forth.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-forth.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-forth" '("org-babel-")))
+
+;;;***
+
;;;### (autoloads nil "ob-fortran" "org/ob-fortran.el" (0 0 0 0))
;;; Generated autoloads from org/ob-fortran.el
@@ -22818,6 +22922,13 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-groovy" "org/ob-groovy.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-groovy.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-groovy" '("org-babel-")))
+
+;;;***
+
;;;### (autoloads nil "ob-haskell" "org/ob-haskell.el" (0 0 0 0))
;;; Generated autoloads from org/ob-haskell.el
@@ -22857,7 +22968,7 @@ Many aspects this mode can be customized using
;;;### (autoloads nil "ob-latex" "org/ob-latex.el" (0 0 0 0))
;;; Generated autoloads from org/ob-latex.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-latex" '("org-babel-" "convert-pdf")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-latex" '("org-babel-")))
;;;***
@@ -22890,6 +23001,13 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-lua" "org/ob-lua.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-lua.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-lua" '("org-babel-")))
+
+;;;***
+
;;;### (autoloads nil "ob-makefile" "org/ob-makefile.el" (0 0 0 0))
;;; Generated autoloads from org/ob-makefile.el
@@ -22953,6 +23071,14 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-processing" "org/ob-processing.el" (0 0
+;;;;;; 0 0))
+;;; Generated autoloads from org/ob-processing.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-processing" '("org-babel-")))
+
+;;;***
+
;;;### (autoloads nil "ob-python" "org/ob-python.el" (0 0 0 0))
;;; Generated autoloads from org/ob-python.el
@@ -23002,10 +23128,18 @@ Many aspects this mode can be customized using
;;;***
-;;;### (autoloads nil "ob-sh" "org/ob-sh.el" (0 0 0 0))
-;;; Generated autoloads from org/ob-sh.el
+;;;### (autoloads nil "ob-sed" "org/ob-sed.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-sed.el
+(push (purecopy '(ob-sed 0 1 0)) package--builtin-versions)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sed" '("org-babel-")))
+
+;;;***
+
+;;;### (autoloads nil "ob-shell" "org/ob-shell.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-shell.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sh" '("org-babel-")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-shell" '("org-babel-")))
;;;***
@@ -23019,7 +23153,7 @@ Many aspects this mode can be customized using
;;;### (autoloads nil "ob-sql" "org/ob-sql.el" (0 0 0 0))
;;; Generated autoloads from org/ob-sql.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sql" '("org-babel-" "dbstring-mysql")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-sql" '("org-babel-")))
;;;***
@@ -23030,6 +23164,13 @@ Many aspects this mode can be customized using
;;;***
+;;;### (autoloads nil "ob-stan" "org/ob-stan.el" (0 0 0 0))
+;;; Generated autoloads from org/ob-stan.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ob-stan" '("org-babel-")))
+
+;;;***
+
;;;### (autoloads nil "ob-table" "org/ob-table.el" (0 0 0 0))
;;; Generated autoloads from org/ob-table.el
@@ -23137,7 +23278,7 @@ Load the languages defined in `org-babel-load-languages'.
\(fn SYM VALUE)" nil nil)
(autoload 'org-babel-load-file "org" "\
-Load Emacs Lisp source code blocks in the Org-mode FILE.
+Load Emacs Lisp source code blocks in the Org FILE.
This function exports the source code using `org-babel-tangle'
and then loads the resulting file using `load-file'. With prefix
arg (noninteractively: 2nd arg) COMPILE the tangled Emacs Lisp
@@ -23146,10 +23287,11 @@ file to byte-code before it is loaded.
\(fn FILE &optional COMPILE)" t nil)
(autoload 'org-version "org" "\
-Show the org-mode version in the echo area.
-With prefix argument HERE, insert it at point.
-When FULL is non-nil, use a verbose version string.
-When MESSAGE is non-nil, display a message with the version.
+Show the Org version.
+Interactively, or when MESSAGE is non-nil, show it in echo area.
+With prefix argument, or when HERE is non-nil, insert it at point.
+In non-interactive uses, a reduced version string is output unless
+FULL is given.
\(fn &optional HERE FULL MESSAGE)" t nil)
@@ -23167,15 +23309,15 @@ Set up hooks for clock persistence.
Outline-based notes management and organizer, alias
\"Carsten's outline-mode for keeping track of everything.\"
-Org-mode develops organizational tasks around a NOTES file which
-contains information about projects as plain text. Org-mode is
-implemented on top of outline-mode, which is ideal to keep the content
+Org mode develops organizational tasks around a NOTES file which
+contains information about projects as plain text. Org mode is
+implemented on top of Outline mode, which is ideal to keep the content
of large files well structured. It supports ToDo items, deadlines and
time stamps, which magically appear in the diary listing of the Emacs
calendar. Tables are easily created with a built-in table editor.
Plain text URL-like links connect to websites, emails (VM), Usenet
messages (Gnus), BBDB entries, and any files related to the project.
-For printing and sharing of notes, an Org-mode file (or a part of it)
+For printing and sharing of notes, an Org file (or a part of it)
can be exported as a structured ASCII or HTML file.
The following commands are available:
@@ -23185,58 +23327,60 @@ The following commands are available:
\(fn)" t nil)
(autoload 'org-cycle "org" "\
-TAB-action and visibility cycling for Org-mode.
+TAB-action and visibility cycling for Org mode.
-This is the command invoked in Org-mode by the TAB key. Its main purpose
-is outline visibility cycling, but it also invokes other actions
+This is the command invoked in Org mode by the `TAB' key. Its main
+purpose is outline visibility cycling, but it also invokes other actions
in special contexts.
-- When this function is called with a prefix argument, rotate the entire
- buffer through 3 states (global cycling)
+When this function is called with a `\\[universal-argument]' prefix, rotate the entire
+buffer through 3 states (global cycling)
1. OVERVIEW: Show only top-level headlines.
2. CONTENTS: Show all headlines of all levels, but no body text.
3. SHOW ALL: Show everything.
- When called with two `C-u C-u' prefixes, switch to the startup visibility,
- determined by the variable `org-startup-folded', and by any VISIBILITY
- properties in the buffer.
- When called with three `C-u C-u C-u' prefixed, show the entire buffer,
- including any drawers.
-- When inside a table, re-align the table and move to the next field.
+With a `\\[universal-argument] \\[universal-argument]' prefix argument, switch to the startup visibility,
+determined by the variable `org-startup-folded', and by any VISIBILITY
+properties in the buffer.
+
+With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix argument, show the entire buffer, including
+any drawers.
-- When point is at the beginning of a headline, rotate the subtree started
- by this line through 3 different states (local cycling)
+When inside a table, re-align the table and move to the next field.
+
+When point is at the beginning of a headline, rotate the subtree started
+by this line through 3 different states (local cycling)
1. FOLDED: Only the main headline is shown.
2. CHILDREN: The main headline and the direct children are shown.
From this state, you can move to one of the children
and zoom in further.
3. SUBTREE: Show the entire subtree, including body text.
- If there is no subtree, switch directly from CHILDREN to FOLDED.
+If there is no subtree, switch directly from CHILDREN to FOLDED.
-- When point is at the beginning of an empty headline and the variable
- `org-cycle-level-after-item/entry-creation' is set, cycle the level
- of the headline by demoting and promoting it to likely levels. This
- speeds up creation document structure by pressing TAB once or several
- times right after creating a new headline.
+When point is at the beginning of an empty headline and the variable
+`org-cycle-level-after-item/entry-creation' is set, cycle the level
+of the headline by demoting and promoting it to likely levels. This
+speeds up creation document structure by pressing `TAB' once or several
+times right after creating a new headline.
-- When there is a numeric prefix, go up to a heading with level ARG, do
- a `show-subtree' and return to the previous cursor position. If ARG
- is negative, go up that many levels.
+When there is a numeric prefix, go up to a heading with level ARG, do
+a `show-subtree' and return to the previous cursor position. If ARG
+is negative, go up that many levels.
-- When point is not at the beginning of a headline, execute the global
- binding for TAB, which is re-indenting the line. See the option
- `org-cycle-emulate-tab' for details.
+When point is not at the beginning of a headline, execute the global
+binding for `TAB', which is re-indenting the line. See the option
+`org-cycle-emulate-tab' for details.
-- Special case: if point is at the beginning of the buffer and there is
- no headline in line 1, this function will act as if called with prefix arg
- (C-u TAB, same as S-TAB) also when called without prefix arg.
- But only if also the variable `org-cycle-global-at-bob' is t.
+As a special case, if point is at the beginning of the buffer and there is
+no headline in line 1, this function will act as if called with prefix arg
+\(`\\[universal-argument] TAB', same as `S-TAB') also when called without prefix arg, but only
+if the variable `org-cycle-global-at-bob' is t.
\(fn &optional ARG)" t nil)
(autoload 'org-global-cycle "org" "\
Cycle the global visibility. For details see `org-cycle'.
-With \\[universal-argument] prefix arg, switch to startup visibility.
+With `\\[universal-argument]' prefix ARG, switch to startup visibility.
With a numeric prefix, show all headlines up to that level.
\(fn &optional ARG)" t nil)
@@ -23244,10 +23388,10 @@ With a numeric prefix, show all headlines up to that level.
(autoload 'orgstruct-mode "org" "\
Toggle the minor mode `orgstruct-mode'.
-This mode is for using Org-mode structure commands in other
-modes. The following keys behave as if Org-mode were active, if
+This mode is for using Org mode structure commands in other
+modes. The following keys behave as if Org mode were active, if
the cursor is on a headline, or on a plain list item (both as
-defined by Org-mode).
+defined by Org mode).
\(fn &optional ARG)" t nil)
@@ -23262,61 +23406,59 @@ Unconditionally turn on `orgstruct++-mode'.
\(fn)" nil nil)
(autoload 'org-run-like-in-org-mode "org" "\
-Run a command, pretending that the current buffer is in Org-mode.
+Run a command, pretending that the current buffer is in Org mode.
This will temporarily bind local variables that are typically bound in
-Org-mode to the values they have in Org-mode, and then interactively
+Org mode to the values they have in Org mode, and then interactively
call CMD.
\(fn CMD)" nil nil)
(autoload 'org-store-link "org" "\
-\\<org-mode-map>Store an org-link to the current location.
+Store an org-link to the current location.
+\\<org-mode-map>
This link is added to `org-stored-links' and can later be inserted
-into an org-buffer with \\[org-insert-link].
+into an Org buffer with `org-insert-link' (`\\[org-insert-link]').
-For some link types, a prefix arg is interpreted.
-For links to Usenet articles, arg negates `org-gnus-prefer-web-links'.
-For file links, arg negates `org-context-in-file-links'.
+For some link types, a `\\[universal-argument]' prefix ARG is interpreted. A single
+`\\[universal-argument]' negates `org-context-in-file-links' for file links or
+`org-gnus-prefer-web-links' for links to Usenet articles.
-A double prefix arg force skipping storing functions that are not
-part of Org's core.
+A `\\[universal-argument] \\[universal-argument]' prefix ARG forces skipping storing functions that are not
+part of Org core.
-A triple prefix arg force storing a link for each line in the
+A `\\[universal-argument] \\[universal-argument] \\[universal-argument]' prefix ARG forces storing a link for each line in the
active region.
\(fn ARG)" t nil)
(autoload 'org-insert-link-global "org" "\
-Insert a link like Org-mode does.
-This command can be called in any mode to insert a link in Org-mode syntax.
+Insert a link like Org mode does.
+This command can be called in any mode to insert a link in Org syntax.
\(fn)" t nil)
(autoload 'org-open-at-point-global "org" "\
-Follow a link like Org-mode does.
-This command can be called in any mode to follow a link that has
-Org-mode syntax.
+Follow a link or time-stamp like Org mode does.
+This command can be called in any mode to follow an external link
+or a time-stamp that has Org mode syntax. Its behavior is
+undefined when called on internal links (e.g., fuzzy links).
+Raise an error when there is nothing to follow.
\(fn)" t nil)
(autoload 'org-open-link-from-string "org" "\
-Open a link in the string S, as if it was in Org-mode.
+Open a link in the string S, as if it was in Org mode.
\(fn S &optional ARG REFERENCE-BUFFER)" t nil)
(autoload 'org-switchb "org" "\
Switch between Org buffers.
-With one prefix argument, restrict available buffers to files.
-With two prefix arguments, restrict available buffers to agenda files.
-
-Defaults to `iswitchb' for buffer name completion.
-Set `org-completion-use-ido' to make it use ido instead.
-\(fn &optional ARG)" t nil)
+With `\\[universal-argument]' prefix, restrict available buffers to files.
-(defalias 'org-ido-switchb 'org-switchb)
+With `\\[universal-argument] \\[universal-argument]' prefix, restrict available buffers to agenda files.
-(defalias 'org-iswitchb 'org-switchb)
+\(fn &optional ARG)" t nil)
(autoload 'org-cycle-agenda-files "org" "\
Cycle through the files in `org-agenda-files'.
@@ -23326,13 +23468,13 @@ If the current buffer does not, find the first agenda file.
\(fn)" t nil)
(autoload 'org-submit-bug-report "org" "\
-Submit a bug report on Org-mode via mail.
+Submit a bug report on Org via mail.
Don't hesitate to report any problems or inaccurate documentation.
If you don't have setup sending mail from (X)Emacs, please copy the
output buffer into your mail program, as it gives us important
-information about your Org-mode version and configuration.
+information about your Org version and configuration.
\(fn)" t nil)
@@ -23388,9 +23530,9 @@ More commands can be added by configuring the variable
`org-agenda-custom-commands'. In particular, specific tags and TODO keyword
searches can be pre-defined in this way.
-If the current buffer is in Org-mode and visiting a file, you can also
+If the current buffer is in Org mode and visiting a file, you can also
first press `<' once to indicate that the agenda should be temporarily
-\(until the next use of \\[org-agenda]) restricted to the current file.
+\(until the next use of `\\[org-agenda]') restricted to the current file.
Pressing `<' twice means to restrict to the current subtree or region
\(if active).
@@ -23519,7 +23661,7 @@ in `org-agenda-text-search-extra-files'.
(autoload 'org-todo-list "org-agenda" "\
Show all (not done) TODO entries from all agenda file in a single list.
The prefix arg can be used to select a specific TODO keyword and limit
-the list to these. When using \\[universal-argument], you will be prompted
+the list to these. When using `\\[universal-argument]', you will be prompted
for a keyword. A numeric prefix directly selects the Nth keyword in
`org-todo-keywords-1'.
@@ -23575,22 +23717,22 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
(autoload 'org-agenda-set-restriction-lock "org-agenda" "\
Set restriction lock for agenda, to current subtree or file.
-Restriction will be the file if TYPE is `file', or if TYPE is the
-universal prefix `(4)', or if the cursor is before the first headline
+Restriction will be the file if TYPE is `file', or if type is the
+universal prefix \\='(4), or if the cursor is before the first headline
in the file. Otherwise, restriction will be to the current subtree.
\(fn &optional TYPE)" t nil)
(autoload 'org-calendar-goto-agenda "org-agenda" "\
-Compute the Org-mode agenda for the calendar date displayed at the cursor.
+Compute the Org agenda for the calendar date displayed at the cursor.
This is a command that has to be installed in `calendar-mode-map'.
\(fn)" t nil)
(autoload 'org-agenda-to-appt "org-agenda" "\
Activate appointments found in `org-agenda-files'.
-With a \\[universal-argument] prefix, refresh the list of
-appointments.
+
+With a `\\[universal-argument]' prefix, refresh the list of appointments.
If FILTER is t, interactively prompt the user for a regular
expression, and filter out entries that don't match it.
@@ -23605,8 +23747,8 @@ argument: an entry from `org-agenda-get-day-entries'.
FILTER can also be an alist with the car of each cell being
either `headline' or `category'. For example:
- ((headline \"IMPORTANT\")
- (category \"Work\"))
+ \\='((headline \"IMPORTANT\")
+ (category \"Work\"))
will only add headlines containing IMPORTANT or headlines
belonging to the \"Work\" category.
@@ -23668,16 +23810,17 @@ Capture STRING with the template selected by KEYS.
(autoload 'org-capture "org-capture" "\
Capture something.
\\<org-capture-mode-map>
-This will let you select a template from `org-capture-templates', and then
-file the newly captured information. The text is immediately inserted
-at the target location, and an indirect buffer is shown where you can
-edit it. Pressing \\[org-capture-finalize] brings you back to the previous state
-of Emacs, so that you can continue your work.
+This will let you select a template from `org-capture-templates', and
+then file the newly captured information. The text is immediately
+inserted at the target location, and an indirect buffer is shown where
+you can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous
+state of Emacs, so that you can continue your work.
+
+When called interactively with a `\\[universal-argument]' prefix argument GOTO, don't
+capture anything, just go to the file/headline where the selected
+template stores its notes.
-When called interactively with a \\[universal-argument] prefix argument GOTO, don't capture
-anything, just go to the file/headline where the selected template
-stores its notes. With a double prefix argument \\[universal-argument] \\[universal-argument], go to the last note
-stored.
+With a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored.
When called with a `C-0' (zero) prefix, insert a template at point.
@@ -23723,26 +23866,29 @@ Remove all currently active column overlays.
\(fn)" nil nil)
(autoload 'org-columns "org-colview" "\
-Turn on column view on an org-mode file.
+Turn on column view on an Org mode file.
+
+Column view applies to the whole buffer if point is before the
+first headline. Otherwise, it applies to the first ancestor
+setting \"COLUMNS\" property. If there is none, it defaults to
+the current headline. With a `\\[universal-argument]' prefix argument, turn on column
+view for the whole buffer unconditionally.
+
When COLUMNS-FMT-STRING is non-nil, use it as the column format.
-\(fn &optional COLUMNS-FMT-STRING)" t nil)
+\(fn &optional GLOBAL COLUMNS-FMT-STRING)" t nil)
(autoload 'org-columns-compute "org-colview" "\
-Sum the values of property PROPERTY hierarchically, for the entire buffer.
+Summarize the values of PROPERTY hierarchically.
+Also update existing values for PROPERTY according to the first
+column specification.
\(fn PROPERTY)" t nil)
-(autoload 'org-columns-number-to-string "org-colview" "\
-Convert a computed column number to a string value, according to FMT.
-
-\(fn N FMT &optional PRINTF)" nil nil)
-
(autoload 'org-dblock-write:columnview "org-colview" "\
Write the column view table.
PARAMS is a property list of parameters:
-:width enforce same column widths with <N> specifiers.
:id the :ID: property of the entry where the columns view
should be built. When the symbol `local', call locally.
When `global' call column view with the cursor at the beginning
@@ -23752,15 +23898,17 @@ PARAMS is a property list of parameters:
using `org-id-find'.
:hlines When t, insert a hline before each item. When a number, insert
a hline before each level <= that number.
+:indent When non-nil, indent each ITEM field according to its level.
:vlines When t, make each column a colgroup to enforce vertical lines.
:maxlevel When set to a number, don't capture headlines below this level.
:skip-empty-rows
When t, skip rows where all specifiers other than ITEM are empty.
+:width apply widths specified in columns format using <N> specifiers.
:format When non-nil, specify the column view format to use.
\(fn PARAMS)" nil nil)
-(autoload 'org-insert-columns-dblock "org-colview" "\
+(autoload 'org-columns-insert-dblock "org-colview" "\
Create a dynamic block capturing a column view table.
\(fn)" t nil)
@@ -23796,7 +23944,7 @@ Try very hard to provide sensible version strings.
;;;### (autoloads nil "org-ctags" "org/org-ctags.el" (0 0 0 0))
;;; Generated autoloads from org/org-ctags.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-ctags" '("org-ctags-" "y-or-n-minibuffer")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-ctags" '("org-ctags-")))
;;;***
@@ -23827,7 +23975,7 @@ Try very hard to provide sensible version strings.
;;;;;; 0))
;;; Generated autoloads from org/org-entities.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-entities" '("replace-amp" "org-entit")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-entities" '("org-entit")))
;;;***
@@ -23838,6 +23986,13 @@ Try very hard to provide sensible version strings.
;;;***
+;;;### (autoloads nil "org-eww" "org/org-eww.el" (0 0 0 0))
+;;; Generated autoloads from org/org-eww.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-eww" '("org-eww-")))
+
+;;;***
+
;;;### (autoloads nil "org-faces" "org/org-faces.el" (0 0 0 0))
;;; Generated autoloads from org/org-faces.el
@@ -23864,7 +24019,7 @@ Try very hard to provide sensible version strings.
;;;### (autoloads nil "org-gnus" "org/org-gnus.el" (0 0 0 0))
;;; Generated autoloads from org/org-gnus.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-gnus" '("org-gnus-")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-gnus" '("org-")))
;;;***
@@ -23914,6 +24069,24 @@ Try very hard to provide sensible version strings.
;;;***
+;;;### (autoloads nil "org-lint" "org/org-lint.el" (0 0 0 0))
+;;; Generated autoloads from org/org-lint.el
+
+(autoload 'org-lint "org-lint" "\
+Check current Org buffer for syntax mistakes.
+
+By default, run all checkers. With a `\\[universal-argument]' prefix ARG, select one
+category of checkers only. With a `\\[universal-argument] \\[universal-argument]' prefix, run one precise
+checker by its name.
+
+ARG can also be a list of checker names, as symbols, to run.
+
+\(fn &optional ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-lint" '("org-lint-")))
+
+;;;***
+
;;;### (autoloads nil "org-list" "org/org-list.el" (0 0 0 0))
;;; Generated autoloads from org/org-list.el
@@ -23932,7 +24105,7 @@ Try very hard to provide sensible version strings.
;;; Generated autoloads from org/org-macs.el
(autoload 'org-load-noerror-mustsuffix "org-macs" "\
-Load FILE with optional arguments NOERROR and MUSTSUFFIX. Drop the MUSTSUFFIX argument for XEmacs, which doesn't recognize it.
+Load FILE with optional arguments NOERROR and MUSTSUFFIX.
\(fn FILE)" nil t)
@@ -24004,7 +24177,7 @@ Load FILE with optional arguments NOERROR and MUSTSUFFIX. Drop the MUSTSUFFIX a
;;;;;; (0 0 0 0))
;;; Generated autoloads from org/org-table.el
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-table" '("org" "*orgtbl-")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-table" '("org")))
;;;***
@@ -24020,14 +24193,14 @@ Load FILE with optional arguments NOERROR and MUSTSUFFIX. Drop the MUSTSUFFIX a
;;; Generated autoloads from org/org-version.el
(autoload 'org-release "org-version" "\
-The release version of org-mode.
- Inserted by installing org-mode or when a release is made.
+The release version of Org.
+Inserted by installing Org mode or when a release is made.
\(fn)" nil nil)
(autoload 'org-git-version "org-version" "\
The Git version of org-mode.
- Inserted by installing org-mode or when a release is made.
+Inserted by installing Org or when a release is made.
\(fn)" nil nil)
@@ -26220,7 +26393,7 @@ Optional argument FACE specifies the face to do the highlighting.
;;; Generated autoloads from progmodes/python.el
(push (purecopy '(python 0 25 2)) package--builtin-versions)
-(add-to-list 'auto-mode-alist (cons (purecopy "\\.pyw?\\'") 'python-mode))
+(add-to-list 'auto-mode-alist (cons (purecopy "\\.py[iw]?\\'") 'python-mode))
(add-to-list 'interpreter-mode-alist (cons (purecopy "python[0-9.]*") 'python-mode))
@@ -34153,7 +34326,7 @@ Reenable Ange-FTP, when Tramp is unloaded.
;;;### (autoloads nil "trampver" "net/trampver.el" (0 0 0 0))
;;; Generated autoloads from net/trampver.el
-(push (purecopy '(tramp 2 3 2)) package--builtin-versions)
+(push (purecopy '(tramp 2 3 3 -1)) package--builtin-versions)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "trampver" '("tramp-")))
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 24c3acd1b99..18c30f781f0 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -221,6 +221,11 @@ restore a previous autoload if possible.")
;; Remove the struct.
(setf (cl--find-class name) nil)))
+(cl-defmethod loadhist-unload-element ((x (head define-symbol-props)))
+ (pcase-dolist (`(,symbol . ,props) (cdr x))
+ (dolist (prop props)
+ (put symbol prop nil))))
+
;;;###autoload
(defun unload-feature (feature &optional force)
"Unload the library that provided FEATURE.
@@ -301,11 +306,6 @@ something strange, such as redefining an Emacs function."
;; Change major mode in all buffers using one defined in the feature being unloaded.
(unload--set-major-mode)
- (when (fboundp 'elp-restore-function) ; remove ELP stuff first
- (dolist (elt unload-function-defs-list)
- (when (symbolp elt)
- (elp-restore-function elt))))
-
(mapc #'loadhist-unload-element unload-function-defs-list)
;; Delete the load-history element for this file.
(setq load-history (delq (assoc file load-history) load-history))))
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index b368efbbc95..9a81ef07ad8 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -1,4 +1,4 @@
-;;; ls-lisp.el --- emulate insert-directory completely in Emacs Lisp
+;;; ls-lisp.el --- emulate insert-directory completely in Emacs Lisp -*- lexical-binding: t -*-
;; Copyright (C) 1992, 1994, 2000-2017 Free Software Foundation, Inc.
@@ -60,6 +60,8 @@
;;; Code:
+
+
(defgroup ls-lisp nil
"Emulate the ls program completely in Emacs Lisp."
:version "21.1"
@@ -477,6 +479,34 @@ not contain `d', so that a full listing is expected."
(message "%s: doesn't exist or is inaccessible" file)
(ding) (sit-for 2))))) ; to show user the message!
+(declare-function dired-read-dir-and-switches "dired" (str))
+(declare-function dired-goto-next-file "dired" ())
+
+(defun ls-lisp--dired (orig-fun dir-or-list &optional switches)
+ (interactive (dired-read-dir-and-switches ""))
+ (if (consp dir-or-list)
+ (funcall orig-fun dir-or-list switches)
+ (let ((dir-wildcard (insert-directory-wildcard-in-dir-p
+ (expand-file-name dir-or-list))))
+ (if (not dir-wildcard)
+ (funcall orig-fun dir-or-list switches)
+ (let* ((default-directory (car dir-wildcard))
+ (files (file-expand-wildcards (cdr dir-wildcard)))
+ (dir (car dir-wildcard)))
+ (if files
+ (let ((inhibit-read-only t)
+ (buf
+ (apply orig-fun (nconc (list dir) files) (and switches (list switches)))))
+ (with-current-buffer buf
+ (save-excursion
+ (goto-char (point-min))
+ (dired-goto-next-file)
+ (forward-line 0)
+ (insert " wildcard " (cdr dir-wildcard) "\n"))))
+ (user-error "No files matching regexp")))))))
+
+(advice-add 'dired :around #'ls-lisp--dired)
+
(defun ls-lisp-sanitize (file-alist)
"Sanitize the elements in FILE-ALIST.
Fixes any elements in the alist for directory entries whose file
@@ -866,6 +896,13 @@ All ls time options, namely c, t and u, are handled."
file-size)
(format " %6s" (file-size-human-readable file-size))))
+(defun ls-lisp-unload-function ()
+ "Unload ls-lisp library."
+ (advice-remove 'insert-directory #'ls-lisp--insert-directory)
+ (advice-remove 'dired #'ls-lisp--dired)
+ ;; Continue standard unloading.
+ nil)
+
(provide 'ls-lisp)
;;; ls-lisp.el ends here
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 05a336bfe28..75ffd1e2b49 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1101,6 +1101,7 @@ The selected font will be the default on both the existing and future frames."
:button (:radio . (eq tool-bar-mode nil))))
menu)))
+(defvar display-line-numbers-type)
(defun menu-bar-display-line-numbers-mode (type)
(setq display-line-numbers-type type)
(if global-display-line-numbers-mode
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 8772b52376d..e3ee4dfab11 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1382,10 +1382,9 @@ unless optional argument SOFT is non-nil."
(interactive)
(comment-normalize-vars t)
(let (compos comin)
- ;; If we are not inside a comment and we only auto-fill comments,
- ;; don't do anything (unless no comment syntax is defined).
+ ;; If we are not inside a comment don't do anything (unless no
+ ;; comment syntax is defined).
(unless (and comment-start
- comment-auto-fill-only-comments
(not (called-interactively-p 'interactive))
(not (save-excursion
(prog1 (setq compos (comment-beginning))
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'."
:type '(choice (const :tag "Never" nil)
(integer :tag "Seconds")))
-(defvar password-data (make-vector 7 0))
+(defvar password-data (make-hash-table :test #'equal))
(defun password-read-from-cache (key)
"Obtain passphrase for KEY from time-limited passphrase cache.
@@ -74,20 +74,20 @@ Custom variables `password-cache' and `password-cache-expiry'
regulate cache behavior."
(and password-cache
key
- (symbol-value (intern-soft key password-data))))
+ (gethash key password-data)))
;;;###autoload
(defun password-in-cache-p (key)
"Check if KEY is in the cache."
(and password-cache
key
- (intern-soft key password-data)))
+ (gethash key password-data)))
(defun password-read (prompt &optional key)
"Read password, for use with KEY, from user, or from cache if wanted.
KEY indicate the purpose of the password, so the cache can
-separate passwords. The cache is not used if KEY is nil. It is
-typically a string.
+separate passwords. The cache is not used if KEY is nil.
+KEY is typically a string but can be anything (compared via `equal').
The variable `password-cache' control whether the cache is used."
(or (password-read-from-cache key)
(read-passwd prompt)))
@@ -115,29 +115,27 @@ but can be invoked at any time to forcefully remove passwords
from the cache. This may be useful when it has been detected
that a password is invalid, so that `password-read' query the
user again."
- (let ((sym (intern-soft key password-data)))
- (when sym
- (let ((password (symbol-value sym)))
- (when (stringp password)
- (if (fboundp 'clear-string)
- (clear-string password)
- (fillarray password ?_)))
- (unintern key password-data)))))
+ (let ((password (gethash key password-data)))
+ (when (stringp password)
+ (if (fboundp 'clear-string)
+ (clear-string password)
+ (fillarray password ?_)))
+ (remhash key password-data)))
(defun password-cache-add (key password)
"Add password to cache.
The password is removed by a timer after `password-cache-expiry' seconds."
- (when (and password-cache-expiry (null (intern-soft key password-data)))
+ (when (and password-cache-expiry (null (gethash key password-data)))
(run-at-time password-cache-expiry nil
#'password-cache-remove
key))
- (set (intern key password-data) password)
+ (puthash key password password-data)
nil)
(defun password-reset ()
"Clear the password cache."
(interactive)
- (fillarray password-data 0))
+ (clrhash password-data))
(provide 'password-cache)
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."
(goto-char match-pos)
(backward-char)
(c-backward-token-2)
- (or (looking-at c-block-stmt-2-key)
- (looking-at c-block-stmt-1-2-key)
- (looking-at c-typeof-key))))
- (cons nil t))
+ (cond
+ ((looking-at c-paren-stmt-key)
+ ;; Allow comma separated <> arglists in for statements.
+ (cons nil nil))
+ ((or (looking-at c-block-stmt-2-key)
+ (looking-at c-block-stmt-1-2-key)
+ (looking-at c-typeof-key))
+ (cons nil t))
+ (t nil)))))
;; Near BOB.
((<= match-pos (point-min))
(cons 'arglist t))
@@ -1226,13 +1231,16 @@ casts and declarations are fontified. Used on level 2 and higher."
;; Got a cached hit in some other type of arglist.
(type
(cons 'arglist t))
- (not-front-decl
+ ((and not-front-decl
;; The point is within the range of a previously
;; encountered type decl expression, so the arglist
;; is probably one that contains declarations.
;; However, if `c-recognize-paren-inits' is set it
;; might also be an initializer arglist.
- ;;
+ (or (not c-recognize-paren-inits)
+ (save-excursion
+ (goto-char match-pos)
+ (not (c-back-over-member-initializers)))))
;; The result of this check is cached with a char
;; property on the match token, so that we can look
;; it up again when refontifying single lines in a
@@ -1243,17 +1251,21 @@ casts and declarations are fontified. Used on level 2 and higher."
;; Got an open paren preceded by an arith operator.
((and (eq (char-before match-pos) ?\()
(save-excursion
+ (goto-char match-pos)
(and (zerop (c-backward-token-2 2))
(looking-at c-arithmetic-op-regexp))))
(cons nil nil))
;; In a C++ member initialization list.
((and (eq (char-before match-pos) ?,)
(c-major-mode-is 'c++-mode)
- (save-excursion (c-back-over-member-initializers)))
+ (save-excursion
+ (goto-char match-pos)
+ (c-back-over-member-initializers)))
(c-put-char-property (1- match-pos) 'c-type 'c-not-decl)
(cons 'not-decl nil))
;; At start of a declaration inside a declaration paren.
((save-excursion
+ (goto-char match-pos)
(and (memq (char-before match-pos) '(?\( ?\,))
(c-go-up-list-backward match-pos)
(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....\".")
(setq new-pos capture-opener))
(and (/= new-pos pos) new-pos)))
+(defun c-fl-decl-end (pos)
+ ;; If POS is inside a declarator, return the end of the token that follows
+ ;; the declarator, otherwise return nil.
+ (goto-char pos)
+ (let ((lit-start (c-literal-start))
+ pos1)
+ (if lit-start (goto-char lit-start))
+ (c-backward-syntactic-ws)
+ (when (setq pos1 (c-on-identifier))
+ (goto-char pos1)
+ (when (and (c-forward-declarator)
+ (eq (c-forward-token-2) 0))
+ (c-backward-syntactic-ws)
+ (point)))))
+
(defun c-change-expand-fl-region (_beg _end _old-len)
;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock
;; 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....\".")
(setq c-new-BEG
(or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG))
c-new-END
- (save-excursion
- (goto-char c-new-END)
- (if (bolp)
- (point)
- (c-point 'bonl c-new-END))))))
+ (or (c-fl-decl-end c-new-END)
+ (c-point 'bonl (max (1- c-new-END) (point-min)))))))
(defun c-context-expand-fl-region (beg end)
;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a
;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is
;; in. NEW-END is beginning of the line after the one END is in.
- (cons (or (c-fl-decl-start beg) (c-point 'bol beg))
- (c-point 'bonl end)))
+ (c-save-buffer-state ()
+ (cons (or (c-fl-decl-start beg) (c-point 'bol beg))
+ (or (c-fl-decl-end end) (c-point 'bonl (1- end))))))
(defun c-before-context-fl-expand-region (beg end)
;; Expand the region (BEG END) as specified by
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 2ddaf884bce..466b524c79d 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -31,7 +31,6 @@
(require 'compile)
-
(defgroup grep nil
"Run `grep' and display the results."
:group 'tools
@@ -366,53 +365,44 @@ A grep buffer becomes most recent when you select Grep mode in it.
Notice that using \\[next-error] or \\[compile-goto-error] modifies
`compilation-last-buffer' rather than `grep-last-buffer'.")
-(defconst grep--regexp-alist-column
- ;; Calculate column positions (col . end-col) of first grep match on a line
- (cons
- (lambda ()
- (when grep-highlight-matches
- (let* ((beg (match-end 0))
- (end (save-excursion (goto-char beg) (line-end-position)))
- (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face)))
- (when mbeg
- (- mbeg beg)))))
- (lambda ()
- (when grep-highlight-matches
- (let* ((beg (match-end 0))
- (end (save-excursion (goto-char beg) (line-end-position)))
- (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face))
- (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end))))
- (when mend
- (- mend beg)))))))
-(defconst grep--regexp-alist-bin-matcher
- '("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
-(defconst grep-with-null-regexp-alist
- `(("^\\([^\0]+\\)\\(\0\\)\\([0-9]+\\):" 1 3 ,grep--regexp-alist-column nil nil
- (2 '(face unspecified display ":")))
- ,grep--regexp-alist-bin-matcher)
- "Regexp used to match grep hits.
-See `compilation-error-regexp-alist'.")
-(defconst grep-fallback-regexp-alist
- `(;; Use a tight regexp to handle weird file names (with colons
- ;; in them) as well as possible. E.g., use [1-9][0-9]* rather
- ;; than [0-9]+ so as to accept ":034:" in file names.
- ("^\\(.*?[^/\n]\\):[ \t]*\\([1-9][0-9]*\\)[ \t]*:"
- 1 2 ,grep--regexp-alist-column)
- ,grep--regexp-alist-bin-matcher)
- "Regexp used to match grep hits when `--null' is not supported.
-See `compilation-error-regexp-alist'.")
-
-(defvaralias 'grep-regex-alist 'grep-with-null-regexp-alist)
-(make-obsolete-variable
- 'grep-regex-alist "Call `grep-regexp-alist' instead." "26.1")
-
;;;###autoload
-(defun grep-regexp-alist ()
- "Return a regexp alist to match grep hits.
-The regexp used depends on `grep-use-null-filename-separator'.
-See `compilation-error-regexp-alist' for format details."
- (if grep-use-null-filename-separator
- grep-with-null-regexp-alist grep-fallback-regexp-alist))
+(defconst grep-regexp-alist
+ `((,(concat "^\\(?:"
+ ;; Parse using NUL characters when `--null' is used.
+ ;; Note that we must still assume no newlines in
+ ;; filenames due to "foo: Is a directory." type
+ ;; messages.
+ "\\(?1:[^\0\n]+\\)\\(?3:\0\\)\\(?2:[0-9]+\\):"
+ "\\|"
+ ;; Fallback if `--null' is not used, use a tight regexp
+ ;; to handle weird file names (with colons in them) as
+ ;; well as possible. E.g., use [1-9][0-9]* rather than
+ ;; [0-9]+ so as to accept ":034:" in file names.
+ "\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?2:[1-9][0-9]*\\)[\t ]*:"
+ "\\)")
+ 1 2
+ ;; Calculate column positions (col . end-col) of first grep match on a line
+ (,(lambda ()
+ (when grep-highlight-matches
+ (let* ((beg (match-end 0))
+ (end (save-excursion (goto-char beg) (line-end-position)))
+ (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face)))
+ (when mbeg
+ (- mbeg beg)))))
+ .
+ ,(lambda ()
+ (when grep-highlight-matches
+ (let* ((beg (match-end 0))
+ (end (save-excursion (goto-char beg) (line-end-position)))
+ (mbeg (text-property-any beg end 'font-lock-face 'grep-match-face))
+ (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end))))
+ (when mend
+ (- mend beg))))))
+ nil nil
+ (3 '(face nil display ":")))
+ ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
+ "Regexp used to match grep hits.
+See `compilation-error-regexp-alist' for format details.")
(defvar grep-first-column 0 ; bug#10594
"Value to use for `compilation-first-column' in grep buffers.")
@@ -451,7 +441,9 @@ See `compilation-error-regexp-alist' for format details."
(2 grep-error-face nil t))
;; "filename-linenumber-" format is used for context lines in GNU grep,
;; "filename=linenumber=" for lines with function names in "git grep -p".
- ("^.+?[-=][0-9]+[-=].*\n" (0 grep-context-face)))
+ ("^.+?\\([-=\0]\\)[0-9]+\\([-=]\\).*\n" (0 grep-context-face)
+ (1 (if (eq (char-after (match-beginning 1)) ?\0)
+ `(face nil display ,(match-string 2))))))
"Additional things to highlight in grep output.
This gets tacked on the end of the generated expressions.")
@@ -781,7 +773,7 @@ This function is called from `compilation-filter-hook'."
(set (make-local-variable 'compilation-error-face)
grep-hit-face)
(set (make-local-variable 'compilation-error-regexp-alist)
- (grep-regexp-alist))
+ grep-regexp-alist)
;; compilation-directory-matcher can't be nil, so we set it to a regexp that
;; can never match.
(set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`"))
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."
((string-match "[.]sh\\>" buffer-file-name) "sh")
((string-match "[.]bash\\>" buffer-file-name) "bash")
((string-match "[.]ksh\\>" buffer-file-name) "ksh")
+ ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index cc9b794c5a0..35a5c8862f4 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -929,7 +929,7 @@ IGNORES is a list of glob patterns."
(expand-file-name dir)
ignores))
(buf (get-buffer-create " *xref-grep*"))
- (`(,grep-re ,file-group ,line-group . ,_) (car (grep-regexp-alist)))
+ (`(,grep-re ,file-group ,line-group . ,_) (car grep-regexp-alist))
(status nil)
(hits nil))
(with-current-buffer buf
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."
help-chars)
(unless (get-buffer-window buffer)
(register-preview buffer 'show-empty)))
+ (when (or (eq ?\C-g last-input-event)
+ (eq 'escape last-input-event)
+ (eq ?\C-\[ last-input-event))
+ (keyboard-quit))
(if (characterp last-input-event) last-input-event
(error "Non-character input-event")))
(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'."
"Show all lines in the current buffer containing a match for REGEXP.
If a match spreads across multiple lines, all those lines are shown.
+Each match is extended to include complete lines. Only non-overlapping
+matches are considered. (Note that extending matches to complete
+lines could cause some of the matches to overlap; if so, they will not
+be shown as separate matches.)
+
Each line is displayed with NLINES lines before and after, or -NLINES
before if NLINES is negative.
NLINES defaults to `list-matching-lines-default-context-lines'.
diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 7b0588dfead..16277973d60 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -304,7 +304,10 @@ or remove a tab stop. \\[ruler-mode-toggle-show-tab-stops] or
(defsubst ruler-mode-window-col (n)
"Return a column number relative to the selected window.
-N is a column number relative to selected frame."
+N is a column number relative to selected frame.
+If required, account for screen estate taken by `display-line-numbers'."
+ (if display-line-numbers
+ (setq n (- n (line-number-display-width) 2)))
(- n
(or (car (window-margins)) 0)
(fringe-columns 'left)
@@ -665,7 +668,7 @@ Optional argument PROPS specifies other text properties to apply."
(let* ((w (ruler-mode-text-scaled-window-width))
(m (window-margins))
(f (window-fringes))
- (i 0)
+ (i (if display-line-numbers (+ (line-number-display-width) 2) 0))
(j (ruler-mode-text-scaled-window-hscroll))
;; Setup the scrollbar, fringes, and margins areas.
(lf (ruler-mode-space
@@ -696,8 +699,20 @@ Optional argument PROPS specifies other text properties to apply."
;; Create an "clean" ruler.
(ruler
(propertize
+ ;; FIXME: `make-string' returns a unibyte string if it's ASCII-only,
+ ;; which prevents further `aset' from inserting non-ASCII chars,
+ ;; hence the need for `string-to-multibyte'.
+ ;; http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00841.html
(string-to-multibyte
- (make-string w ruler-mode-basic-graduation-char))
+ ;; Make the part of header-line corresponding to the
+ ;; line-number display be blank, not filled with
+ ;; ruler-mode-basic-graduation-char.
+ (if display-line-numbers
+ (let* ((lndw (+ (line-number-display-width) 2))
+ (s (make-string lndw ?\s)))
+ (concat s (make-string (- w lndw)
+ ruler-mode-basic-graduation-char)))
+ (make-string w ruler-mode-basic-graduation-char)))
'face 'ruler-mode-default
'local-map ruler-mode-map
'help-echo (cond
diff --git a/lisp/shell.el b/lisp/shell.el
index c5e5cbbee7e..ea7f0beebb0 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -264,7 +264,9 @@ see the function `dirtrack-mode'."
:group 'shell-directories)
(defcustom explicit-shell-file-name nil
- "If non-nil, is file name to use for explicitly requested inferior shell."
+ "If non-nil, is file name to use for explicitly requested inferior shell.
+When nil, such interactive shell sessions fallback to using either
+the shell specified in $ESHELL or in `shell-file-name'."
:type '(choice (const :tag "None" nil) file)
:group 'shell)
diff --git a/lisp/simple.el b/lisp/simple.el
index 3d23fc35596..027ce3959a9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -996,23 +996,24 @@ instead of deleted."
:version "24.1")
(defvar region-extract-function
- (lambda (delete)
+ (lambda (method)
(when (region-beginning)
(cond
- ((eq delete 'bounds)
+ ((eq method 'bounds)
(list (cons (region-beginning) (region-end))))
- ((eq delete 'delete-only)
+ ((eq method 'delete-only)
(delete-region (region-beginning) (region-end)))
(t
- (filter-buffer-substring (region-beginning) (region-end) delete)))))
+ (filter-buffer-substring (region-beginning) (region-end) method)))))
"Function to get the region's content.
-Called with one argument DELETE.
-If DELETE is `delete-only', then only delete the region and the return value
-is undefined. If DELETE is nil, just return the content as a string.
-If DELETE is `bounds', then don't delete, but just return the
-boundaries of the region as a list of (START . END) positions.
-If anything else, delete the region and return its content as a string,
-after filtering it with `filter-buffer-substring'.")
+Called with one argument METHOD.
+If METHOD is `delete-only', then delete the region; the return value
+is undefined. If METHOD is nil, then return the content as a string.
+If METHOD is `bounds', then return the boundaries of the region
+as a list of the form (START . END).
+If METHOD is anything else, delete the region and return its content
+as a string, after filtering it with `filter-buffer-substring', which
+is called with METHOD as its 3rd argument.")
(defvar region-insert-function
(lambda (lines)
@@ -7218,6 +7219,13 @@ unless optional argument SOFT is non-nil."
;; If we're not inside a comment, just try to indent.
(t (indent-according-to-mode))))))
+(defun internal-auto-fill ()
+ "The function called by `self-insert-command' to perform auto-filling."
+ (when (or (not comment-start)
+ (not comment-auto-fill-only-comments)
+ (nth 4 (syntax-ppss)))
+ (do-auto-fill)))
+
(defvar normal-auto-fill-function 'do-auto-fill
"The function to use for `auto-fill-function' if Auto Fill mode is turned on.
Some major modes set this.")
diff --git a/lisp/subr.el b/lisp/subr.el
index 79a28d301e7..b3f9f902349 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1999,6 +1999,25 @@ If TOGGLE has a `:menu-tag', that is used for the menu item's label."
;; "Return the name of the file from which AUTOLOAD will be loaded.
;; \n\(fn AUTOLOAD)")
+(defun define-symbol-prop (symbol prop val)
+ "Define the property PROP of SYMBOL to be VAL.
+This is to `put' what `defalias' is to `fset'."
+ ;; Can't use `cl-pushnew' here (nor `push' on (cdr foo)).
+ ;; (cl-pushnew symbol (alist-get prop
+ ;; (alist-get 'define-symbol-props
+ ;; current-load-list)))
+ (let ((sps (assq 'define-symbol-props current-load-list)))
+ (unless sps
+ (setq sps (list 'define-symbol-props))
+ (push sps current-load-list))
+ (let ((ps (assq prop sps)))
+ (unless ps
+ (setq ps (list prop))
+ (setcdr sps (cons ps (cdr sps))))
+ (unless (member symbol (cdr ps))
+ (setcdr ps (cons symbol (cdr ps))))))
+ (put symbol prop val))
+
(defun symbol-file (symbol &optional type)
"Return the name of the file that defined SYMBOL.
The value is normally an absolute file name. It can also be nil,
@@ -2008,47 +2027,30 @@ file name without extension.
If TYPE is nil, then any kind of definition is acceptable. If
TYPE is `defun', `defvar', or `defface', that specifies function
-definition, variable definition, or face definition only."
+definition, variable definition, or face definition only.
+Otherwise TYPE is assumed to be a symbol property."
(if (and (or (null type) (eq type 'defun))
(symbolp symbol)
(autoloadp (symbol-function symbol)))
(nth 1 (symbol-function symbol))
- (let ((files load-history)
- file match)
- (while files
- (if (if type
- (if (eq type 'defvar)
- ;; Variables are present just as their names.
- (member symbol (cdr (car files)))
- ;; Other types are represented as (TYPE . NAME).
- (member (cons type symbol) (cdr (car files))))
- ;; We accept all types, so look for variable def
- ;; and then for any other kind.
- (or (member symbol (cdr (car files)))
- (and (setq match (rassq symbol (cdr (car files))))
- (not (eq 'require (car match))))))
- (setq file (car (car files)) files nil))
- (setq files (cdr files)))
- file)))
-
-(defun method-files (method)
- "Return a list of files where METHOD is defined by `cl-defmethod'.
-The list will have entries of the form (FILE . (METHOD ...))
-where (METHOD ...) contains the qualifiers and specializers of
-the method and is a suitable argument for
-`find-function-search-for-symbol'. Filenames are absolute."
- (let ((files load-history)
- result)
- (while files
- (let ((defs (cdr (car files))))
- (while defs
- (let ((def (car defs)))
- (if (and (eq (car-safe def) 'cl-defmethod)
- (eq (cadr def) method))
- (push (cons (car (car files)) (cdr def)) result)))
- (setq defs (cdr defs))))
- (setq files (cdr files)))
- result))
+ (catch 'found
+ (pcase-dolist (`(,file . ,elems) load-history)
+ (when (if type
+ (if (eq type 'defvar)
+ ;; Variables are present just as their names.
+ (member symbol elems)
+ ;; Many other types are represented as (TYPE . NAME).
+ (or (member (cons type symbol) elems)
+ (memq symbol (alist-get type
+ (alist-get 'define-symbol-props
+ elems)))))
+ ;; We accept all types, so look for variable def
+ ;; and then for any other kind.
+ (or (member symbol elems)
+ (let ((match (rassq symbol elems)))
+ (and match
+ (not (eq 'require (car match)))))))
+ (throw 'found file))))))
(defun locate-library (library &optional nosuffix path interactive-call)
"Show the precise file name of Emacs library LIBRARY.
diff --git a/lisp/term.el b/lisp/term.el
index 063a6ea592f..5eb7b3e8ede 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1354,8 +1354,7 @@ commands to use in that buffer.
(interactive (list (read-from-minibuffer "Run program: "
(or explicit-shell-file-name
(getenv "ESHELL")
- (getenv "SHELL")
- "/bin/sh"))))
+ shell-file-name))))
(set-buffer (make-term "terminal" program))
(term-mode)
(term-char-mode)
@@ -4149,8 +4148,7 @@ the process. Any more args are arguments to PROGRAM."
(interactive (list (read-from-minibuffer "Run program: "
(or explicit-shell-file-name
(getenv "ESHELL")
- (getenv "SHELL")
- "/bin/sh"))))
+ shell-file-name))))
;; Pick the name of the new buffer.
(setq term-ansi-buffer-name
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 4df5f0abe21..88483606550 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -774,7 +774,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
(defun ns-suspend-error ()
;; Don't allow suspending if any of the frames are NS frames.
(if (memq 'ns (mapcar 'window-system (frame-list)))
- (error "Cannot suspend Emacs while running under NS")))
+ (error "Cannot suspend Emacs while an NS GUI frame exists")))
;; Set some options to be as Nextstep-like as possible.
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 532d0395cf4..dd42dda106f 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1182,7 +1182,7 @@ as returned by `x-server-vendor'."
This returns an error if any Emacs frames are X frames."
;; Don't allow suspending if any of the frames are X frames.
(if (memq 'x (mapcar #'window-system (frame-list)))
- (error "Cannot suspend Emacs while running under X")))
+ (error "Cannot suspend Emacs while an X GUI frame exists")))
(defvar x-initialized nil
"Non-nil if the X window system has been initialized.")
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."
(select-window (posn-window (event-start last-input-event)))
(list last-input-event
(if (display-popup-menus-p)
- (x-popup-menu last-nonmenu-event artist-popup-menu-table)
+ (x-popup-menu t artist-popup-menu-table)
'no-popup-menus))))
(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',
(defface css-selector '((t :inherit font-lock-function-name-face))
"Face to use for selectors."
:group 'css)
-(defface css-property '((t :inherit font-lock-variable-name-face))
+(defface css-property '((t :inherit font-lock-keyword-face))
"Face to use for properties."
:group 'css)
(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 @@
-;;; url-cookie.el --- URL cookie support
+;;; url-cookie.el --- URL cookie support -*- lexical-binding:t -*-
;; Copyright (C) 1996-1999, 2004-2017 Free Software Foundation, Inc.
@@ -227,21 +227,17 @@ telling Microsoft that."
:group 'url-cookie)
(defun url-cookie-host-can-set-p (host domain)
- (let ((last nil)
- (case-fold-search t))
- (cond
- ((string= host domain) ; Apparently netscape lets you do this
- t)
- ((zerop (length domain))
- nil)
- (t
- ;; Remove the dot from wildcard domains before matching.
- (when (eq ?. (aref domain 0))
- (setq domain (substring domain 1)))
- (and (url-domsuf-cookie-allowed-p domain)
- ;; Need to check and make sure the host is actually _in_ the
- ;; domain it wants to set a cookie for though.
- (string-match (concat (regexp-quote domain) "$") host))))))
+ (cond
+ ((string= host domain) ; Apparently netscape lets you do this
+ t)
+ ((zerop (length domain))
+ nil)
+ (t
+ ;; Remove the dot from wildcard domains before matching.
+ (when (eq ?. (aref domain 0))
+ (setq domain (substring domain 1)))
+ (and (url-domsuf-cookie-allowed-p domain)
+ (string-suffix-p domain host 'ignore-case)))))
(defun url-cookie-handle-set-cookie (str)
(setq url-cookies-changed-since-last-save t)
@@ -380,8 +376,8 @@ instead delete all cookies that do not match REGEXP."
"Display a buffer listing the current URL cookies, if there are any.
Use \\<url-cookie-mode-map>\\[url-cookie-delete] to remove cookies."
(interactive)
- (when (and (null url-cookie-secure-storage)
- (null url-cookie-storage))
+ (unless (or url-cookie-secure-storage
+ url-cookie-storage)
(error "No cookies are defined"))
(pop-to-buffer "*url cookies*")
@@ -442,20 +438,13 @@ Use \\<url-cookie-mode-map>\\[url-cookie-delete] to remove cookies."
(forward-line 1)
(point)))))
-(defun url-cookie-quit ()
- "Kill the current buffer."
- (interactive)
- (kill-buffer (current-buffer)))
-
(defvar url-cookie-mode-map
(let ((map (make-sparse-keymap)))
- (suppress-keymap map)
- (define-key map "q" 'url-cookie-quit)
(define-key map [delete] 'url-cookie-delete)
(define-key map [(control k)] 'url-cookie-delete)
map))
-(define-derived-mode url-cookie-mode nil "URL Cookie"
+(define-derived-mode url-cookie-mode special-mode "URL Cookie"
"Mode for listing cookies.
\\{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:
- cannot use `diff -w' because the weighting causes added spaces in a line
to be represented as added copies of some line, so `diff -w' can't do the
right thing any more.
-- may in degenerate cases take a 1KB input region and turn it into a 1MB
- file to pass to diff.")
+- Is a bit more costly (may in degenerate cases use temp files that are 10x
+ larger than the refined regions).")
(defun smerge--refine-forward (n)
(let ((case-fold-search nil)
(re "[[:upper:]]?[[:lower:]]+\\|[[:upper:]]+\\|[[:digit:]]+\\|.\\|\n"))
(when (and smerge-refine-ignore-whitespace
;; smerge-refine-weight-hack causes additional spaces to
- ;; appear as additional lines as well, so even if diff ignore
+ ;; appear as additional lines as well, so even if diff ignores
;; whitespace changes, it'll report added/removed lines :-(
(not smerge-refine-weight-hack))
(setq re (concat "[ \t]*\\(?:" re "\\)")))
@@ -954,6 +954,8 @@ It has the following disadvantages:
(unless (looking-at re) (error "Smerge refine internal error"))
(goto-char (match-end 0)))))
+(defvar smerge--refine-long-words)
+
(defun smerge--refine-chopup-region (beg end file &optional preproc)
"Chopup the region into small elements, one per line.
Save the result into FILE.
@@ -976,18 +978,46 @@ chars to try and eliminate some spurious differences."
(subst-char-in-region (point-min) (point-max) ?\n ?\s))
(goto-char (point-min))
(while (not (eobp))
- (funcall smerge-refine-forward-function 1)
- (let ((s (if (prog2 (forward-char -1) (bolp) (forward-char 1))
- nil
- (buffer-substring (line-beginning-position) (point)))))
- ;; We add \n after each char except after \n, so we get
- ;; one line per text char, where each line contains
- ;; just one char, except for \n chars which are
- ;; represented by the empty line.
- (unless (eq (char-before) ?\n) (insert ?\n))
- ;; HACK ALERT!!
- (if smerge-refine-weight-hack
- (dotimes (_i (1- (length s))) (insert s "\n")))))
+ (cl-assert (bolp))
+ (let ((start (point)))
+ (funcall smerge-refine-forward-function 1)
+ (let ((len (- (point) start)))
+ (cl-assert (>= len 1))
+ ;; We add \n after each chunk except after \n, so we get
+ ;; one line per text chunk, where each line contains
+ ;; just one chunk, except for \n chars which are
+ ;; represented by the empty line.
+ (unless (bolp) (insert ?\n))
+ (when (and smerge-refine-weight-hack (> len 1))
+ (let ((s (buffer-substring-no-properties start (point))))
+ ;; The weight-hack inserts N copies of words of size N,
+ ;; so it naturally suffers from an O(N²) blow up.
+ ;; To circumvent this, we map each long word
+ ;; to a shorter (but still unique) replacement.
+ ;; Another option would be to change smerge--refine-forward
+ ;; so it chops up long words into smaller ones.
+ (when (> len 8)
+ (let ((short (gethash s smerge--refine-long-words)))
+ (unless short
+ ;; To avoid accidental conflicts with ≤8 words,
+ ;; we make sure the replacement is >8 chars. Overall,
+ ;; this should bound the blowup factor to ~10x,
+ ;; tho if those chars end up encoded as multiple bytes
+ ;; each, it could probably still reach ~30x in
+ ;; pathological cases.
+ (setq short
+ (concat (substring s 0 7)
+ " "
+ (string
+ (+ ?0
+ (hash-table-count
+ smerge--refine-long-words)))
+ "\n"))
+ (puthash s short smerge--refine-long-words))
+ (delete-region start (point))
+ (insert short)
+ (setq s short)))
+ (dotimes (_i (1- len)) (insert s)))))))
(unless (bolp) (error "Smerge refine internal error"))
(let ((coding-system-for-write 'emacs-internal))
(write-region (point-min) (point-max) file nil 'nomessage))))
@@ -1042,7 +1072,9 @@ used to replace chars to try and eliminate some spurious differences."
(let* ((pos (point))
deactivate-mark ; The code does not modify any visible buffer.
(file1 (make-temp-file "diff1"))
- (file2 (make-temp-file "diff2")))
+ (file2 (make-temp-file "diff2"))
+ (smerge--refine-long-words
+ (if smerge-refine-weight-hack (make-hash-table :test #'equal))))
(unless (markerp beg1) (setq beg1 (copy-marker beg1)))
(unless (markerp beg2) (setq beg2 (copy-marker beg2)))
;; 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."
;; also and more importantly because otherwise it
;; may happen that diff doesn't behave like
;; smerge-refine-weight-hack expects it to.
- ;; See http://thread.gmane.org/gmane.emacs.devel/82685.
+ ;; See http://thread.gmane.org/gmane.emacs.devel/82685, aka https://lists.gnu.org/archive/html/emacs-devel/2007-11/msg00401.html
"-awd" "-ad")
file1 file2))
;; 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 @@
-;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE
+;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE -*- lexical-binding: t -*-
;; Copyright (C) 2000-2017 Free Software Foundation, Inc.