commit 84b79f6a07bf45a27815f4793a7ee79a6d3610b3 (HEAD, refs/remotes/origin/master) Author: Ian Dunn Date: Thu Feb 7 12:26:04 2019 +0300 Add vc-hg-revert-switches * lisp/vc/vc-hg.el (vc-hg-revert-switches): New option. (vc-hg-revert): Use it. diff --git a/etc/NEWS b/etc/NEWS index f889a8ac3c..7ee49bf6b5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -448,6 +448,9 @@ values. *** 'C-u C-x v D' ('vc-root-version-diff') prompts for two revisions and compares their entire trees. +*** New user option 'vc-hg-revert-switches' specifies switches to pass +to hg revert. + ** Diff mode *** Hunks are now automatically refined by default. To disable it, set the new defcustom 'diff-font-lock-refine' to nil. diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index befaabd5c6..342c6d214c 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -145,6 +145,15 @@ switches." :version "25.1" :group 'vc-hg) +(defcustom vc-hg-revert-switches nil + "String or list of strings specifying switches for hg revert +under VC." + :type '(choice (const :tag "None" nil) + (string :tag "Argument String") + (repeat :tag "Argument List" :value ("") string)) + :version "27.1" + :group 'vc-hg) + (defcustom vc-hg-program "hg" "Name of the Mercurial executable (excluding any arguments)." :type 'string @@ -1161,7 +1170,11 @@ REV is the revision to check out into WORKFILE." ;; Modeled after the similar function in vc-bzr.el (defun vc-hg-revert (file &optional contents-done) (unless contents-done - (with-temp-buffer (vc-hg-command t 0 file "revert")))) + (with-temp-buffer + (apply #'vc-hg-command + t 0 file + "revert" + (append (vc-switches 'hg 'revert)))))) ;;; Hg specific functionality. commit 5e627fa5f5db8f27ea789d61148e7d5ade644956 Author: Dmitry Gutov Date: Thu Feb 7 12:20:09 2019 +0300 Rename multifile.el to fileloop.el * lisp/multifile.el: Rename to fileloop.el as discussed in https://lists.gnu.org/archive/html/emacs-devel/2018-12/msg00475.html. Update symbol prefixes and all callers diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index d97cfd355c..fd0119e98c 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1990,7 +1990,7 @@ table. @item M-x tags-query-replace @key{RET} @var{regexp} @key{RET} @var{replacement} @key{RET} Perform a @code{query-replace-regexp} on each file in the selected tags table. -@item M-x multifile-continue +@item M-x fileloop-continue Restart one of the last 2 commands above, from the current location of point. @end table @@ -2026,9 +2026,9 @@ you can follow its progress. As soon as it finds an occurrence, @code{tags-search} returns. This command requires tags tables to be available (@pxref{Tags Tables}). -@findex multifile-continue +@findex fileloop-continue Having found one match with @code{tags-search}, you probably want to -find all the rest. @kbd{M-x multifile-continue} resumes the +find all the rest. @kbd{M-x fileloop-continue} resumes the @code{tags-search}, finding one more match. This searches the rest of the current buffer, followed by the remaining files of the tags table. @@ -2051,10 +2051,10 @@ default is to use the same setting as the value of single invocation of @kbd{M-x tags-query-replace}. But often it is useful to exit temporarily, which you can do with any input event that has no special query replace meaning. You can resume the query -replace subsequently by typing @kbd{M-x multifile-continue}; this +replace subsequently by typing @kbd{M-x fileloop-continue}; this command resumes the last tags search or replace command that you did. For instance, to skip the rest of the current file, you can type -@w{@kbd{M-> M-x multifile-continue}}. +@w{@kbd{M-> M-x fileloop-continue}}. Note that the commands described above carry out much broader searches than the @code{xref-find-definitions} family. The diff --git a/etc/NEWS b/etc/NEWS index 406ed6e378..f889a8ac3c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -394,11 +394,11 @@ The mode is automatically enabled in files that start with the *** 'next-file' is now an obsolete alias of 'tags-next-file'. *** 'tags-loop-revert-buffers' is an obsolete alias of -'multifile-revert-buffers'. +'fileloop-revert-buffers'. *** The 'tags-loop-continue' function along with the 'tags-loop-operate' and 'tags-loop-scan' variables are now obsolete; -use the new 'multifile-initialize' and 'multifile-continue' functions +use the new 'fileloop-initialize' and 'fileloop-continue' functions instead. ** bibtex @@ -1085,7 +1085,7 @@ indicator instead of just the indicator (which is sometimes cryptic). * New Modes and Packages in Emacs 27.1 -** multifile.el lets one setup multifile operations like search&replace. +** fileloop.el lets one setup multifile operations like search&replace. +++ ** Emacs can now visit files in archives as if they were directories. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 7e70960146..4be93c3220 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2859,11 +2859,11 @@ is part of a file name (i.e., has the text property `dired-filename')." Stops when a match is found. To continue searching for next match, use command \\[tags-loop-continue]." (interactive "sSearch marked files (regexp): ") - (multifile-initialize-search + (fileloop-initialize-search regexp (dired-get-marked-files nil nil #'dired-nondirectory-p) 'default) - (multifile-continue)) + (fileloop-continue)) ;;;###autoload (defun dired-do-query-replace-regexp (from to &optional delimited) @@ -2881,11 +2881,11 @@ with the command \\[tags-loop-continue]." (if (and buffer (with-current-buffer buffer buffer-read-only)) (error "File `%s' is visited read-only" file)))) - (multifile-initialize-replace + (fileloop-initialize-replace from to (dired-get-marked-files nil nil #'dired-nondirectory-p) (if (equal from (downcase from)) nil 'default) delimited) - (multifile-continue)) + (fileloop-continue)) (declare-function xref--show-xrefs "xref") (declare-function xref-query-replace-in-results "xref") diff --git a/lisp/multifile.el b/lisp/fileloop.el similarity index 78% rename from lisp/multifile.el rename to lisp/fileloop.el index a40f80947f..2e77811a57 100644 --- a/lisp/multifile.el +++ b/lisp/fileloop.el @@ -1,4 +1,4 @@ -;;; multifile.el --- Operations on multiple files -*- lexical-binding: t; -*- +;;; fileloop.el --- Operations on multiple files -*- lexical-binding: t; -*- ;; Copyright (C) 2018-2019 Free Software Foundation, Inc. @@ -24,11 +24,11 @@ ;; version of etags.el. ;; TODO: -;; - Maybe it would make sense to replace the multifile--* vars with a single +;; - Maybe it would make sense to replace the fileloop--* vars with a single ;; global var holding a struct, and then stash those structs into a history -;; of past operations, so you can perform a multifile-search while in the -;; middle of a multifile-replace and later go back to that -;; multifile-replace. +;; of past operations, so you can perform a fileloop-search while in the +;; middle of a fileloop-replace and later go back to that +;; fileloop-replace. ;; - Make multi-isearch work on top of this library (might require changes ;; to this library, of course). @@ -36,12 +36,12 @@ (require 'generator) -(defgroup multifile nil +(defgroup fileloop nil "Operations on multiple files." :group 'tools) -(defcustom multifile-revert-buffers 'silent - "Whether to revert files during multifile operation. +(defcustom fileloop-revert-buffers 'silent + "Whether to revert files during fileloop operation. `silent' means to only do it if `revert-without-query' is applicable; t means to offer to do it for all applicable files; nil means never to do it" @@ -49,17 +49,17 @@ ;; FIXME: This already exists in GNU ELPA's iterator.el. Maybe it should move ;; to generator.el? -(iter-defun multifile--list-to-iterator (list) +(iter-defun fileloop--list-to-iterator (list) (while list (iter-yield (pop list)))) -(defvar multifile--iterator iter-empty) -(defvar multifile--scan-function +(defvar fileloop--iterator iter-empty) +(defvar fileloop--scan-function (lambda () (user-error "No operation in progress"))) -(defvar multifile--operate-function #'ignore) -(defvar multifile--freshly-initialized nil) +(defvar fileloop--operate-function #'ignore) +(defvar fileloop--freshly-initialized nil) ;;;###autoload -(defun multifile-initialize (files scan-function operate-function) +(defun fileloop-initialize (files scan-function operate-function) "Initialize a new round of operation on several files. FILES can be either a list of file names, or an iterator (used with `iter-next') which returns a file name at each step. @@ -69,18 +69,18 @@ OPERATE-FUNCTION is a function called with no argument; it is expected to perform the operation on the current file buffer and when done should return non-nil to mean that we should immediately continue operating on the next file and nil otherwise." - (setq multifile--iterator + (setq fileloop--iterator (if (and (listp files) (not (functionp files))) - (multifile--list-to-iterator files) + (fileloop--list-to-iterator files) files)) - (setq multifile--scan-function scan-function) - (setq multifile--operate-function operate-function) - (setq multifile--freshly-initialized t)) + (setq fileloop--scan-function scan-function) + (setq fileloop--operate-function operate-function) + (setq fileloop--freshly-initialized t)) -(defun multifile-next-file (&optional novisit) +(defun fileloop-next-file (&optional novisit) ;; FIXME: Should we provide an interactive command, like tags-next-file? (let ((next (condition-case nil - (iter-next multifile--iterator) + (iter-next fileloop--iterator) (iter-end-of-sequence nil)))) (unless next (and novisit @@ -91,9 +91,9 @@ operating on the next file and nil otherwise." (new (not buffer))) ;; Optionally offer to revert buffers ;; if the files have changed on disk. - (and buffer multifile-revert-buffers + (and buffer fileloop-revert-buffers (not (verify-visited-file-modtime buffer)) - (if (eq multifile-revert-buffers 'silent) + (if (eq fileloop-revert-buffers 'silent) (and (not (buffer-modified-p buffer)) (let ((revertible nil)) (dolist (re revert-without-query) @@ -118,7 +118,7 @@ operating on the next file and nil otherwise." (insert-file-contents new nil)) new))) -(defun multifile-continue () +(defun fileloop-continue () "Continue last multi-file operation." (interactive) (let (new @@ -131,10 +131,10 @@ operating on the next file and nil otherwise." (progn ;; Scan files quickly for the first or next interesting one. ;; This starts at point in the current buffer. - (while (or multifile--freshly-initialized file-finished + (while (or fileloop--freshly-initialized file-finished (save-restriction (widen) - (not (funcall multifile--scan-function)))) + (not (funcall fileloop--scan-function)))) ;; If nothing was found in the previous file, and ;; that file isn't in a temp buffer, restore point to ;; where it was. @@ -142,17 +142,17 @@ operating on the next file and nil otherwise." (goto-char original-point)) (setq file-finished nil) - (setq new (multifile-next-file t)) + (setq new (fileloop-next-file t)) ;; If NEW is non-nil, we got a temp buffer, ;; and NEW is the file name. (when (or messaged - (and (not multifile--freshly-initialized) + (and (not fileloop--freshly-initialized) (> baud-rate search-slow-speed) (setq messaged t))) (message "Scanning file %s..." (or new buffer-file-name))) - (setq multifile--freshly-initialized nil) + (setq fileloop--freshly-initialized nil) (setq original-point (if new nil (point))) (goto-char (point-min))) @@ -172,13 +172,13 @@ operating on the next file and nil otherwise." ;; If value is non-nil, continue to scan the next file. (save-restriction (widen) - (funcall multifile--operate-function))) + (funcall fileloop--operate-function))) (setq file-finished t)))) ;;;###autoload -(defun multifile-initialize-search (regexp files case-fold) +(defun fileloop-initialize-search (regexp files case-fold) (let ((last-buffer (current-buffer))) - (multifile-initialize + (fileloop-initialize files (lambda () (let ((case-fold-search @@ -191,16 +191,16 @@ operating on the next file and nil otherwise." nil)))) ;;;###autoload -(defun multifile-initialize-replace (from to files case-fold &optional delimited) +(defun fileloop-initialize-replace (from to files case-fold &optional delimited) "Initialize a new round of query&replace on several files. FROM is a regexp and TO is the replacement to use. -FILES describes the file, as in `multifile-initialize'. +FILES describes the file, as in `fileloop-initialize'. CASE-FOLD can be t, nil, or `default', the latter one meaning to obey the default setting of `case-fold-search'. DELIMITED if non-nil means replace only word-delimited matches." ;; FIXME: Not sure how the delimited-flag interacts with the regexp-flag in ;; `perform-replace', so I just try to mimic the old code. - (multifile-initialize + (fileloop-initialize files (lambda () (let ((case-fold-search @@ -213,5 +213,5 @@ DELIMITED if non-nil means replace only word-delimited matches." (lambda () (perform-replace from to t t delimited nil multi-query-replace-map)))) -(provide 'multifile) -;;; multifile.el ends here +(provide 'fileloop) +;;; fileloop.el ends here diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 4c5e6a4dae..b913b1bb36 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -11493,7 +11493,7 @@ argument is passed to `next-file', which see). \(fn &optional FIRST-TIME)" t nil) -(make-obsolete 'tags-loop-continue 'multifile-continue '"27.1") +(make-obsolete 'tags-loop-continue 'fileloop-continue '"27.1") (autoload 'tags-search "etags" "\ Search through all files listed in tags table for match for REGEXP. @@ -11512,7 +11512,7 @@ Do `query-replace-regexp' of FROM with TO on all files listed in tags table. Third arg DELIMITED (prefix arg) means replace only word-delimited matches. If you exit (\\[keyboard-quit], RET or q), you can resume the query replace with the command \\[tags-loop-continue]. -For non-interactive use, superceded by `multifile-initialize-replace'. +For non-interactive use, superceded by `fileloop-initialize-replace'. \(fn FROM TO &optional DELIMITED FILES)" t nil) @@ -22298,10 +22298,10 @@ QUALITY can be: ;;;*** -;;;### (autoloads nil "multifile" "multifile.el" (0 0 0 0)) -;;; Generated autoloads from multifile.el +;;;### (autoloads nil "fileloop" "fileloop.el" (0 0 0 0)) +;;; Generated autoloads from fileloop.el -(autoload 'multifile-initialize "multifile" "\ +(autoload 'fileloop-initialize "fileloop" "\ Initialize a new round of operation on several files. FILES can be either a list of file names, or an iterator (used with `iter-next') which returns a file name at each step. @@ -22314,22 +22314,22 @@ operating on the next file and nil otherwise. \(fn FILES SCAN-FUNCTION OPERATE-FUNCTION)" nil nil) -(autoload 'multifile-initialize-search "multifile" "\ +(autoload 'fileloop-initialize-search "fileloop" "\ \(fn REGEXP FILES CASE-FOLD)" nil nil) -(autoload 'multifile-initialize-replace "multifile" "\ +(autoload 'fileloop-initialize-replace "fileloop" "\ Initialize a new round of query&replace on several files. FROM is a regexp and TO is the replacement to use. -FILES describes the file, as in `multifile-initialize'. +FILES describes the file, as in `fileloop-initialize'. CASE-FOLD can be t, nil, or `default', the latter one meaning to obey the default setting of `case-fold-search'. DELIMITED if non-nil means replace only word-delimited matches. \(fn FROM TO FILES CASE-FOLD &optional DELIMITED)" nil nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "multifile" '("multifile-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "fileloop" '("fileloop-"))) ;;;*** @@ -26455,14 +26455,14 @@ recognized. (autoload 'project-search "project" "\ Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]. +To continue searching for next match, use command \\[fileloop-continue]. \(fn REGEXP)" t nil) (autoload 'project-query-replace "project" "\ Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]. +To continue searching for next match, use command \\[fileloop-continue]. \(fn FROM TO)" t nil) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 98135852d1..4ff60ed991 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -309,7 +309,7 @@ menu-bar-separator) (bindings--define-key menu [tags-continue] - '(menu-item "Continue Tags Search" multifile-continue + '(menu-item "Continue Tags Search" fileloop-continue :help "Continue last tags search operation")) (bindings--define-key menu [tags-srch] '(menu-item "Search Tagged Files..." tags-search @@ -358,7 +358,7 @@ (defvar menu-bar-replace-menu (let ((menu (make-sparse-keymap "Replace"))) (bindings--define-key menu [tags-repl-continue] - '(menu-item "Continue Replace" multifile-continue + '(menu-item "Continue Replace" fileloop-continue :help "Continue last tags replace operation")) (bindings--define-key menu [tags-repl] '(menu-item "Replace in Tagged Files..." tags-query-replace diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 2994071b15..a2392328ba 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -36,7 +36,7 @@ (require 'ring) (require 'button) (require 'xref) -(require 'multifile) +(require 'fileloop) ;;;###autoload (defvar tags-file-name nil @@ -1693,12 +1693,12 @@ Point should be just after a string that matches TAG." (let ((bol (point))) (and (search-forward "\177" (line-end-position) t) (re-search-backward re bol t))))) -(define-obsolete-variable-alias 'tags-loop-revert-buffers 'multifile-revert-buffers "27.1") +(define-obsolete-variable-alias 'tags-loop-revert-buffers 'fileloop-revert-buffers "27.1") ;;;###autoload (defalias 'next-file 'tags-next-file) (make-obsolete 'next-file - "use tags-next-file or multifile-initialize and multifile-next-file instead" "27.1") + "use tags-next-file or fileloop-initialize and fileloop-next-file instead" "27.1") ;;;###autoload (defun tags-next-file (&optional initialize novisit) "Select next file among files in current tags table. @@ -1716,7 +1716,7 @@ if the file was newly read in, the value is the filename." (interactive (list (if current-prefix-arg t))) (when initialize ;; Not the first run. (tags--compat-initialize initialize)) - (multifile-next-file novisit) + (fileloop-next-file novisit) (switch-to-buffer (current-buffer))) (defun tags--all-files () @@ -1742,11 +1742,11 @@ if the file was newly read in, the value is the filename." (mapcar #'expand-file-name (tags-table-files))))) files))) -(make-obsolete-variable 'tags-loop-operate 'multifile-initialize "27.1") +(make-obsolete-variable 'tags-loop-operate 'fileloop-initialize "27.1") (defvar tags-loop-operate nil "Form for `tags-loop-continue' to eval to change one file.") -(make-obsolete-variable 'tags-loop-scan 'multifile-initialize "27.1") +(make-obsolete-variable 'tags-loop-scan 'fileloop-initialize "27.1") (defvar tags-loop-scan '(user-error "%s" (substitute-command-keys @@ -1775,7 +1775,7 @@ Bind `case-fold-search' during the evaluation, depending on the value of (eval files)))) (defun tags--compat-initialize (initialize) - (multifile-initialize + (fileloop-initialize (tags--compat-files initialize) (if tags-loop-operate (lambda () (tags-loop-eval tags-loop-operate)) @@ -1792,11 +1792,11 @@ argument is passed to `next-file', which see)." ;; interesting (it returns non-nil if so) and `tags-loop-operate' is a form to ;; evaluate to operate on an interesting file. If the latter evaluates to ;; nil, we exit; otherwise we scan the next file. - (declare (obsolete multifile-continue "27.1")) + (declare (obsolete fileloop-continue "27.1")) (interactive) (when first-time ;; Backward compatibility. (tags--compat-initialize first-time)) - (multifile-continue)) + (fileloop-continue)) ;; We use it to detect when the last loop was a tags-search. (defvar tags--last-search-operate-function nil) @@ -1813,18 +1813,18 @@ The search will be restricted to these files. Also see the documentation of the `tags-file-name' variable." (interactive "sTags search (regexp): ") (unless (and (equal regexp "") - ;; FIXME: If some other multifile operation took place, + ;; FIXME: If some other fileloop operation took place, ;; rather than search for "", we should repeat the last search! - (eq multifile--operate-function + (eq fileloop--operate-function tags--last-search-operate-function)) - (multifile-initialize-search + (fileloop-initialize-search regexp (tags--compat-files (or files t)) tags-case-fold-search) - ;; Store it, so we can detect if some other multifile operation took + ;; Store it, so we can detect if some other fileloop operation took ;; place since the last search! - (setq tags--last-search-operate-function multifile--operate-function)) - (multifile-continue)) + (setq tags--last-search-operate-function fileloop--operate-function)) + (fileloop-continue)) ;;;###autoload (defun tags-query-replace (from to &optional delimited files) @@ -1832,15 +1832,15 @@ Also see the documentation of the `tags-file-name' variable." Third arg DELIMITED (prefix arg) means replace only word-delimited matches. If you exit (\\[keyboard-quit], RET or q), you can resume the query replace with the command \\[tags-loop-continue]. -For non-interactive use, superceded by `multifile-initialize-replace'." +For non-interactive use, superceded by `fileloop-initialize-replace'." (declare (advertised-calling-convention (from to &optional delimited) "27.1")) (interactive (query-replace-read-args "Tags query replace (regexp)" t t)) - (multifile-initialize-replace + (fileloop-initialize-replace from to (tags--compat-files (or files t)) (if (equal from (downcase from)) nil 'default) delimited) - (multifile-continue)) + (fileloop-continue)) (defun tags-complete-tags-table-file (string predicate what) ; Doc string? (save-excursion diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 8648d0047d..3906f6cb24 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -511,30 +511,30 @@ recognized." inherit-input-method))) (concat common-parent-directory res))) -(declare-function multifile-continue "multifile" ()) +(declare-function fileloop-continue "fileloop" ()) ;;;###autoload (defun project-search (regexp) "Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]." +To continue searching for next match, use command \\[fileloop-continue]." (interactive "sSearch (regexp): ") - (multifile-initialize-search + (fileloop-initialize-search regexp (project-files (project-current t)) 'default) - (multifile-continue)) + (fileloop-continue)) ;;;###autoload (defun project-query-replace (from to) "Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]." +To continue searching for next match, use command \\[fileloop-continue]." (interactive (pcase-let ((`(,from ,to) (query-replace-read-args "Query replace (regexp)" t t))) (list from to))) - (multifile-initialize-replace + (fileloop-initialize-replace from to (project-files (project-current t)) 'default) - (multifile-continue)) + (fileloop-continue)) (provide 'project) ;;; project.el ends here commit 1289ae999b85c6a8059c2f9116db4fd8dbe3b418 Author: Dmitry Gutov Date: Wed Feb 6 12:25:09 2019 +0300 ; project-ignores: Add some TODOs diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 815cc7cd3d..8648d0047d 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -146,6 +146,8 @@ Patterns can match both regular files and directories. To root an entry, start it with `./'. To match directories only, end it with `/'. DIR must be one of `project-roots' or `project-external-roots'." + ;; TODO: Document and support regexp ignores as used by Hg. + ;; TODO: Support whitelist entries. (require 'grep) (defvar grep-find-ignored-files) (nconc commit b9523857697410d55ffa50316108604a978c1d46 Author: Aurelien Aptel Date: Thu Feb 7 09:57:15 2019 +0100 Revert "Fix typo in add-hook doc string" This reverts commit 7fd2ad755e7fa599697648ac4c971e834de75bf3. diff --git a/lisp/subr.el b/lisp/subr.el index 0918b62387..122a0d8da4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1555,7 +1555,7 @@ FUNCTION is added at the end. The optional fourth argument, LOCAL, if non-nil, says to modify the hook's buffer-local value rather than its global value. -This makes the hook buffer-local, and it makes it a member of the +This makes the hook buffer-local, and it makes t a member of the buffer-local value. That acts as a flag to run the hook functions of the global value as well as in the local value. commit 94b320849e9655db110ed74ca73974c78f95428a Author: Juri Linkov Date: Mon Feb 4 22:52:25 2019 +0000 Make window choice in xref commands configurable Previously, it wasn't easy to tell xref.el commands like xref-find-definitions or xref-find-definitions-other-window how to choose a window for the *xref* buffer or how to find windows for displaying the results after choosing a candidate. This patch makes that task easier, but keeps the current behaviour intact. Co-authored-by: João Távora * lisp/progmodes/xref.el (xref--show-pos-in-buf): Simplify. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 87ce2299c5..9522d7e475 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -474,27 +474,17 @@ and finally return the window." (or (eq xref--original-window-intent 'frame) pop-up-frames)) (action - (cond ((memq - xref--original-window-intent - '(window frame)) + (cond ((eq xref--original-window-intent 'frame) t) + ((eq xref--original-window-intent 'window) + '(display-buffer-same-window)) ((and (window-live-p xref--original-window) (or (not (window-dedicated-p xref--original-window)) (eq (window-buffer xref--original-window) buf))) - `(,(lambda (buf _alist) - (set-window-buffer xref--original-window buf) - xref--original-window)))))) - (with-selected-window - (with-selected-window - ;; Just before `display-buffer', place ourselves in the - ;; original window to suggest preserving it. Of course, if - ;; user has deleted the original window, all bets are off, - ;; just use the selected one. - (or (and (window-live-p xref--original-window) - xref--original-window) - (selected-window)) - (display-buffer buf action)) + `((display-buffer-in-previous-window) + (previous-window . ,xref--original-window)))))) + (with-selected-window (display-buffer buf action) (xref--goto-char pos) (run-hooks 'xref-after-jump-hook) (let ((buf (current-buffer))) commit 6ed9d0057d9a8ef1331049c55d5df3cc4e02c5f2 Author: Robert Pluim Date: Tue Feb 5 20:38:39 2019 +0100 Add dwim function for inserting @ref variants * lisp/textmodes/texinfo.el (texinfo-insert-dwim-@ref): New function. Insert @ref variant based on surrounding context. (texinfo-mode-map): Add binding for texinfo-insert-dwim-@ref. * etc/NEWS: Describe new texinfo dwim reference functionality. diff --git a/etc/NEWS b/etc/NEWS index 72a6b385a8..406ed6e378 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -466,6 +466,15 @@ To enable it, set the new defcustom 'diff-font-lock-prettify' to t. of the file under version control if point is on an old changed line, or to the new revision of the file otherwise. +** Texinfo + ++++ +*** New function for inserting @pxref, @xref, or @ref commands. +The function 'texinfo-insert-dwim-@ref', bound to 'C-c C-c r' by +default, inserts one of three types of references based on the text +surrounding point, namely @pxref near a parenthesis, @xref at the +start of a sentence or at (point-min), else @ref. + ** Browse-url *** The function 'browse-url-emacs' can now visit a URL in selected window. diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 1a900122f9..71cdcab57e 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -470,6 +470,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.") (define-key map "\C-c\C-cu" 'texinfo-insert-@uref) (define-key map "\C-c\C-ct" 'texinfo-insert-@table) (define-key map "\C-c\C-cs" 'texinfo-insert-@samp) + (define-key map "\C-c\C-cr" 'texinfo-insert-dwim-@ref) (define-key map "\C-c\C-cq" 'texinfo-insert-@quotation) (define-key map "\C-c\C-co" 'texinfo-insert-@noindent) (define-key map "\C-c\C-cn" 'texinfo-insert-@node) @@ -825,6 +826,38 @@ Leave point after `@node'." "Insert the string `@quotation' in a Texinfo buffer." \n "@quotation" \n _ \n) +(define-skeleton texinfo-insert-dwim-@ref + "Insert appropriate `@pxref{...}', `@xref{}', or `@ref{}' command. + +Looks at text around point to decide what to insert; an unclosed +preceding open parenthesis results in '@pxref{}', point at the +beginning of a sentence or at (point-min) yields '@xref{}', any +other location (including inside a word), will result in '@ref{}' +at the nearest previous whitespace or beginning-of-line. A +numeric argument says how many words the braces should surround. +The default is not to surround any existing words with the +braces." + nil + (cond + ;; parenthesis + ((looking-back "([^)]*" (point-at-bol 0)) + "@pxref{") + ;; beginning of sentence or buffer + ((or (looking-back (sentence-end) (point-at-bol 0)) + (= (point) (point-min))) + "@xref{") + ;; bol or eol + ((looking-at "^\\|$") + "@ref{") + ;; inside word + ((not (eq (char-syntax (char-after)) ? )) + (skip-syntax-backward "^ " (point-at-bol)) + "@ref{") + ;; everything else + (t + "@ref{")) + _ "}") + (define-skeleton texinfo-insert-@samp "Insert a `@samp{...}' command in a Texinfo buffer. A numeric argument says how many words the braces should surround. commit 7fd2ad755e7fa599697648ac4c971e834de75bf3 Author: Aurelien Aptel Date: Wed Feb 6 17:44:51 2019 +0100 Fix typo in add-hook doc string * lisp/subr.el (add-hook): fix typo in doc string. diff --git a/lisp/subr.el b/lisp/subr.el index 122a0d8da4..0918b62387 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1555,7 +1555,7 @@ FUNCTION is added at the end. The optional fourth argument, LOCAL, if non-nil, says to modify the hook's buffer-local value rather than its global value. -This makes the hook buffer-local, and it makes t a member of the +This makes the hook buffer-local, and it makes it a member of the buffer-local value. That acts as a flag to run the hook functions of the global value as well as in the local value. commit b7b0cc709e6e9d3f267c471a97f58f29cc38da43 Author: Eli Zaretskii Date: Wed Feb 6 17:56:44 2019 +0200 Unbreak interactive invocation of temacs on MS-Windows * src/emacs.c (main) [WINDOWSNT]: Allow to invoke temacs interactively without the --temacs= option. diff --git a/src/emacs.c b/src/emacs.c index 869b5307f2..9277399618 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -915,10 +915,10 @@ main (int argc, char **argv) temacs and only if we are going to dump with unexec. */ bool use_dynamic_heap = false; char *temacs_str = strstr (argv[0], "temacs"); - if (temacs_str != NULL + if (temacs + && temacs_str != NULL && (temacs_str == argv[0] || IS_DIRECTORY_SEP (temacs_str[-1]))) { - eassert (temacs); /* Note that gflags are set at this point only if we have been called with the --temacs=METHOD option. We assume here that temacs is always called that way, otherwise the functions commit a03de1e2a33a35caf2715b2645aef0a52072b4b2 Author: Eli Zaretskii Date: Wed Feb 6 17:31:26 2019 +0200 Prevent segfaults when running inside docker * src/coding.c (syms_of_coding): New symbol Qus_ascii. (reset_coding_after_pdumper_load): Call set-safe-terminal-system-internal to set up safe_terminal_coding after restoring from pdump file. Reported by Philippe Vaucher . diff --git a/src/coding.c b/src/coding.c index 6de8dcd1ff..e470757f92 100644 --- a/src/coding.c +++ b/src/coding.c @@ -10831,6 +10831,7 @@ syms_of_coding (void) DEFSYM (Qundecided, "undecided"); DEFSYM (Qno_conversion, "no-conversion"); DEFSYM (Qraw_text, "raw-text"); + DEFSYM (Qus_ascii, "us-ascii"); DEFSYM (Qiso_2022, "iso-2022"); @@ -11341,4 +11342,9 @@ reset_coding_after_pdumper_load (void) setup_coding_system (CODING_ID_NAME (id), this); } } + /* In temacs the below is done by mule-conf.el, because we need to + define us-ascii first. But in dumped Emacs us-ascii is restored + by the above loop, and mule-conf.el will not be loaded, so we set + it up now; otherwise safe_terminal_coding will remain zeroed. */ + Fset_safe_terminal_coding_system_internal (Qus_ascii); }