commit fdf7349b1c4b0d599208761af948bd1d6f2434fd (HEAD, refs/remotes/origin/master) Author: Lars Ingebrigtsen Date: Wed Oct 9 09:45:07 2019 +0200 Protect against unlikely case of [menu-bar] not being bound * lisp/recentf.el (recentf-show-menu): (recentf-hide-menu): The [menu-bar] key may be unbound (bug#25191). diff --git a/lisp/recentf.el b/lisp/recentf.el index 2720286814..83c71a561a 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -658,15 +658,17 @@ Return nil if file NAME is not one of the ten more recent." (defun recentf-show-menu () "Show the menu of recently opened files." - (easy-menu-add-item - (recentf-menu-bar) recentf-menu-path - (list recentf-menu-title :filter 'recentf-make-menu-items) - recentf-menu-before)) + (when (keymapp (recentf-menu-bar)) + (easy-menu-add-item + (recentf-menu-bar) recentf-menu-path + (list recentf-menu-title :filter 'recentf-make-menu-items) + recentf-menu-before))) (defun recentf-hide-menu () "Hide the menu of recently opened files." - (easy-menu-remove-item (recentf-menu-bar) recentf-menu-path - recentf-menu-title)) + (when (keymapp (recentf-menu-bar)) + (easy-menu-remove-item (recentf-menu-bar) recentf-menu-path + recentf-menu-title))) ;;; Predefined menu filters ;; commit 3d0d2d1a195072d7683b88757f63e8e953988cfb Author: Lars Ingebrigtsen Date: Wed Oct 9 09:38:11 2019 +0200 Add some sanity checks to dired-x.el key bindings * lisp/dired-x.el: Ensure that prefix keys haven't be rebound to commands before adding keystrokes (bug#25190). diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 63eb028717..2a12fe0912 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -230,24 +230,27 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used." :group 'dired-x) ;;; KEY BINDINGS. +(when (keymapp (lookup-key dired-mode-map "*")) + (define-key dired-mode-map "*(" 'dired-mark-sexp) + (define-key dired-mode-map "*O" 'dired-mark-omitted) + (define-key dired-mode-map "*." 'dired-mark-extension)) + +(when (keymapp (lookup-key dired-mode-map "%")) + (define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp)) (define-key dired-mode-map "\C-x\M-o" 'dired-omit-mode) -(define-key dired-mode-map "*O" 'dired-mark-omitted) (define-key dired-mode-map "\M-(" 'dired-mark-sexp) -(define-key dired-mode-map "*(" 'dired-mark-sexp) -(define-key dired-mode-map "*." 'dired-mark-extension) (define-key dired-mode-map "\M-!" 'dired-smart-shell-command) (define-key dired-mode-map "\M-G" 'dired-goto-subdir) (define-key dired-mode-map "F" 'dired-do-find-marked-files) (define-key dired-mode-map "Y" 'dired-do-relsymlink) -(define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp) (define-key dired-mode-map "V" 'dired-do-run-mail) ;;; MENU BINDINGS (require 'easymenu) -(let ((menu (lookup-key dired-mode-map [menu-bar]))) +(when-let ((menu (lookup-key dired-mode-map [menu-bar]))) (easy-menu-add-item menu '("Operate") ["Find Files" dired-do-find-marked-files :help "Find current or marked files"] commit a6dfd9145f487ffa5e26adb1257f5e485d3ab3e7 Author: Lars Ingebrigtsen Date: Wed Oct 9 09:26:58 2019 +0200 Allow global-edebug-prefix to be nil * lisp/emacs-lisp/edebug.el (global-edebug-prefix): Allow global-edebug-prefix to be nil (if the user doesn't want that prefix) (bug#25188). diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 717026995a..cd709c77b3 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3748,8 +3748,9 @@ be installed in `emacs-lisp-mode-map'.") map) "Global map of edebug commands, available from any buffer.") -(global-unset-key global-edebug-prefix) -(global-set-key global-edebug-prefix global-edebug-map) +(when global-edebug-prefix + (global-unset-key global-edebug-prefix) + (global-set-key global-edebug-prefix global-edebug-map)) (defun edebug-help () commit 1204e7cb81093a42b781eb8c083af9d406de23e9 Author: Lars Ingebrigtsen Date: Wed Oct 9 09:22:38 2019 +0200 Fix possible initialisation error in shell-mode-map * lisp/shell.el (shell-mode-map): Comint is the parent mode, so there's no need to explicitly make it a parent map here (bug#25187). diff --git a/lisp/shell.el b/lisp/shell.el index fb2c36fa73..556330c8d5 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -331,7 +331,7 @@ Thus, this does not include the shell's current directory.") "Command used by `shell-resync-dirs' to query the shell.") (defvar shell-mode-map - (let ((map (nconc (make-sparse-keymap) comint-mode-map))) + (let ((map (make-sparse-keymap))) (define-key map "\C-c\C-f" 'shell-forward-command) (define-key map "\C-c\C-b" 'shell-backward-command) (define-key map "\t" 'completion-at-point) commit 2497a31646db4d255135c16f7b5b318421c5d845 Author: Lars Ingebrigtsen Date: Wed Oct 9 09:06:33 2019 +0200 Upcase parameters in things like "&optional (arg 3)" * lisp/help.el (help--make-usage): Upcase cl-defgeneric (etc) parameter names (bug#23517). diff --git a/lisp/help.el b/lisp/help.el index 1ae4b2c38d..3b3d1f977e 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1469,13 +1469,22 @@ the same names as used in the original source code, when possible." (defun help--make-usage (function arglist) (cons (if (symbolp function) function 'anonymous) (mapcar (lambda (arg) - (if (not (symbolp arg)) arg + (cond + ;; Parameter name. + ((symbolp arg) (let ((name (symbol-name arg))) (cond ((string-match "\\`&" name) arg) ((string-match "\\`_." name) (intern (upcase (substring name 1)))) - (t (intern (upcase name))))))) + (t (intern (upcase name)))))) + ;; Parameter with a default value (from + ;; cl-defgeneric etc). + ((and (consp arg) + (symbolp (car arg))) + (cons (intern (upcase (symbol-name (car arg)))) (cdr arg))) + ;; Something else. + (t arg))) arglist))) (define-obsolete-function-alias 'help-make-usage 'help--make-usage "25.1") commit 4fef6e68f779b12f4f639ca51896f7a950f49237 Author: Lars Ingebrigtsen Date: Wed Oct 9 07:31:24 2019 +0200 Bury the help buffer after sending a bug report * lisp/mail/emacsbug.el (report-emacs-bug-hook): Bury the help buffer after sending the bug report (bug#22712). diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 13219a4b44..1c2f11680b 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -477,7 +477,11 @@ and send the mail again%s." (not (yes-or-no-p (format-message "Is `%s' really your email address? " from))) - (error "Please edit the From address and try again")))))) + (error "Please edit the From address and try again")))) + ;; Bury the help buffer (if it's shown). + (when-let ((help (get-buffer "*Bug Help*"))) + (when (get-buffer-window help) + (quit-window nil (get-buffer-window help)))))) (provide 'emacsbug) commit 5f727c6342dff0c96d09f6c21ac99d0168569c62 Author: Hong Xu Date: Wed Oct 9 07:03:33 2019 +0200 Fix up previous visit-tags-table change * lisp/progmodes/etags.el (visit-tags-table): Reimplement `tags--find-default-tags-dir-recursively' using the much simpler `locate-dominating-file'. Following up bug#37518. diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 906ab37c6b..6784894ba8 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -274,19 +274,6 @@ buffer-local and set them to nil." (setq buffer-undo-list t) (initialize-new-tags-table)) -(defun tags--find-default-tags-dir-recursively (current-dir) - "Find the directory in which the default TAGS file lives. -It is the first directory that contains a file named TAGS -encountered when recursively searching upward from CURRENT-DIR." - (let ((tag-filename (expand-file-name "TAGS" current-dir))) - (if (file-exists-p tag-filename) - current-dir - (let ((parent-dir - (file-name-directory (directory-file-name current-dir)))) - (if (string= parent-dir current-dir) ;; root dir is reached - nil - (tags--find-default-tags-dir-recursively parent-dir)))))) - ;;;###autoload (defun visit-tags-table (file &optional local) "Tell tags commands to use tags table file FILE. @@ -301,7 +288,7 @@ in is given a local value of this variable which is the name of the tags file the tag was in." (interactive (let ((default-tag-dir - (or (tags--find-default-tags-dir-recursively default-directory) + (or (locate-dominating-file default-directory "TAGS") default-directory))) (list (read-file-name "Visit tags table (default TAGS): " commit e8dd6c9d832faf8445fccbc65f05a5e6e6d48ba7 Author: Lars Ingebrigtsen Date: Wed Oct 9 07:00:34 2019 +0200 Move point in the dired buffer with `n'/`p' in an image-mode buffer * lisp/image-mode.el (image-next-file): If the image is in a dired buffer, then move point in that buffer when advancing (bug#21752). This makes it easier to select images. diff --git a/lisp/image-mode.el b/lisp/image-mode.el index a869907669..342102568c 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -982,7 +982,19 @@ replacing the current Image mode buffer." (throw 'image-visit-next-file (1+ idx))) (setq idx (1+ idx)))) (setq idx (mod (+ idx (or n 1)) (length images))) - (find-alternate-file (nth idx images)))) + (let ((image (nth idx images)) + (dir (file-name-directory buffer-file-name))) + (find-alternate-file image) + ;; If we have dired buffer(s) open to where this image is, then + ;; place point on it. + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + (when (and (derived-mode-p 'dired-mode) + (equal (file-truename dir) + (file-truename default-directory))) + (save-window-excursion + (switch-to-buffer (current-buffer) t t) + (dired-goto-file (expand-file-name image dir))))))))) (defun image-previous-file (&optional n) "Visit the preceding image in the same directory as the current file. commit 9db9b0b12d8baebcce053bd4fad9cd91f3b97179 Author: Juanma Barranquero Date: Wed Oct 9 06:15:29 2019 +0200 Fix typos in lisp/*.el * lisp/emacs-lisp/generator.el (cps--with-value-wrapper) (cps-inhibit-atomic-optimization, iter-close): * lisp/gnus/nnir.el (nnir-imap-search-arguments) (nnir-imap-search-argument-history, nnir-categorize) (nnir-ignored-newsgroups) (nnir-retrieve-headers-override-function) (nnir-imap-default-search-key, nnir-namazu-additional-switches) (gnus-group-make-nnir-group, nnir-add-result) (nnir-compose-result, nnir-run-imap, nnir-imap-make-query) (nnir-imap-query-to-imap, nnir-imap-expr-to-imap) (nnir-imap-next-term, nnir-run-swish-e, nnir-run-namazu) (nnir-read-parm, nnir-read-server-parm, nnir-search-thread): Trivial doc fixes. diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el index dd709b32b0..9dba87eaeb 100644 --- a/lisp/emacs-lisp/generator.el +++ b/lisp/emacs-lisp/generator.el @@ -123,7 +123,7 @@ to the current stack of such wrappers. WRAPPER is a function that takes a form and returns a wrapped form. Whenever we generate an atomic form (i.e., a form that can't -iter-yield), we first (before actually inserting that form in our +`iter-yield'), we first (before actually inserting that form in our generated code) pass that form through all the transformer functions. We use this facility to wrap forms that can transfer control flow non-locally in goo that diverts this control flow to @@ -170,7 +170,7 @@ DYNAMIC-VAR bound to STATIC-VAR." (and (fboundp handler) handler))) (defvar cps-inhibit-atomic-optimization nil - "When t, always rewrite forms into cps even when they + "When non-nil, always rewrite forms into cps even when they don't yield.") (defvar cps--yield-seen) @@ -715,7 +715,7 @@ iterator cannot supply more values." (defun iter-close (iterator) "Terminate an iterator early. -Run any unwind-protect handlers in scope at the point ITERATOR +Run any unwind-protect handlers in scope at the point ITERATOR is blocked." (funcall iterator :close nil)) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 3625302841..1041373a05 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -204,7 +204,7 @@ ("from" . "FROM") ("body" . "BODY") ("imap" . "")) - "Mapping from user readable keys to IMAP search items for use in nnir") + "Mapping from user readable keys to IMAP search items for use in nnir.") (defvar nnir-imap-search-other "HEADER %S" "The IMAP search item to use for anything other than @@ -212,7 +212,7 @@ email header field.") (defvar nnir-imap-search-argument-history () - "The history for querying search options in nnir") + "The history for querying search options in nnir.") ;;; Helper macros @@ -256,12 +256,12 @@ email header field.") (cons article (nnir-article-number article))) (defmacro nnir-categorize (sequence keyfunc &optional valuefunc) - "Sort a sequence into categories and returns a list of the form + "Sort a SEQUENCE into categories and returns a list of the form `((key1 (element11 element12)) (key2 (element21 element22))'. The category key for a member of the sequence is obtained -as `(keyfunc member)' and the corresponding element is just -`member'. If `valuefunc' is non-nil, the element of the list -is `(valuefunc member)'." +as `(KEYFUNC member)' and the corresponding element is just +`member'. If VALUEFUNC is non-nil, the element of the list +is `(VALUEFUNC member)'." `(unless (null ,sequence) (let (value) (mapc @@ -294,7 +294,7 @@ is `(valuefunc member)'." (defcustom nnir-ignored-newsgroups "" "A regexp to match newsgroups in the active file that should - be skipped when searching." +be skipped when searching." :version "24.1" :type '(regexp) :group 'nnir) @@ -320,16 +320,16 @@ and populates the `nntp-server-buffer' with the retrieved headers. Must return either 'nov or 'headers indicating the retrieved header format. -If this variable is nil, or if the provided function returns nil for a search -result, `gnus-retrieve-headers' will be called instead." +If this variable is nil, or if the provided function returns nil for +a search result, `gnus-retrieve-headers' will be called instead." :version "24.1" :type '(choice (const :tag "gnus-retrieve-headers" nil) function) :group 'nnir) (defcustom nnir-imap-default-search-key "whole message" "The default IMAP search key for an nnir search. Must be one of - the keys in `nnir-imap-search-arguments'. To use raw imap queries - by default set this to \"imap\"." +the keys in `nnir-imap-search-arguments'. To use raw imap queries +by default set this to \"imap\"." :version "24.1" :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem))) nnir-imap-search-arguments)) @@ -467,8 +467,8 @@ arrive at the correct group name, \"mail.misc\"." (defcustom nnir-namazu-additional-switches '() "A list of strings, to be given as additional arguments to namazu. -The switches `-q', `-a', and `-s' are always used, very few other switches -make any sense in this context. +The switches `-q', `-a', and `-s' are always used, very few other +switches make any sense in this context. Note that this should be a list. I.e., do NOT use the following: (setq nnir-namazu-additional-switches \"-i -w\") ; wrong @@ -597,15 +597,15 @@ Add an entry here when adding a new search engine.") (topic &optional level all lowest recursive)) (defun gnus-group-make-nnir-group (nnir-extra-parms &optional specs) - "Create an nnir group. Prompt for a search query and determine -the groups to search as follows: if called from the *Server* -buffer search all groups belonging to the server on the current -line; if called from the *Group* buffer search any marked groups, -or the group on the current line, or all the groups under the -current topic. Calling with a prefix-arg prompts for additional -search-engine specific constraints. A non-nil `specs' arg must be -an alist with `nnir-query-spec' and `nnir-group-spec' keys, and -skips all prompting." + "Create an nnir group. +Prompt for a search query and determine the groups to search as +follows: if called from the *Server* buffer search all groups +belonging to the server on the current line; if called from the +*Group* buffer search any marked groups, or the group on the current +line, or all the groups under the current topic. Calling with a +prefix-arg prompts for additional search-engine specific constraints. +A non-nil `specs' arg must be an alist with `nnir-query-spec' and +`nnir-group-spec' keys, and skips all prompting." (interactive "P") (let* ((group-spec (or (cdr (assq 'nnir-group-spec specs)) @@ -929,7 +929,7 @@ skips all prompting." (defmacro nnir-add-result (dirnam artno score prefix server artlist) "Ask `nnir-compose-result' to construct a result vector, -and if it is non-nil, add it to artlist." +and if it is non-nil, add it to ARTLIST." `(let ((result (nnir-compose-result ,dirnam ,artno ,score ,prefix ,server))) (when (not (null result)) (push result ,artlist)))) @@ -939,7 +939,7 @@ and if it is non-nil, add it to artlist." ;; Helper function currently used by the Swish++ and Namazu backends; ;; perhaps useful for other backends as well (defun nnir-compose-result (dirnam article score prefix server) - "Extract the group from dirnam, and create a result vector + "Extract the group from DIRNAM, and create a result vector ready to be added to the list of search results." ;; remove nnir-*-remove-prefix from beginning of dirnam filename @@ -977,8 +977,8 @@ ready to be added to the list of search results." ;; imap interface (defun nnir-run-imap (query srv &optional groups) "Run a search against an IMAP back-end server. -This uses a custom query language parser; see `nnir-imap-make-query' for -details on the language and supported extensions." +This uses a custom query language parser; see `nnir-imap-make-query' +for details on the language and supported extensions." (save-excursion (let ((qstring (cdr (assq 'query query))) (server (cadr (gnus-server-to-method srv))) @@ -1027,28 +1027,30 @@ details on the language and supported extensions." "Parse the query string and criteria into an appropriate IMAP search expression, returning the string query to make. -This implements a little language designed to return the expected results -to an arbitrary query string to the end user. +This implements a little language designed to return the expected +results to an arbitrary query string to the end user. -The search is always case-insensitive, as defined by RFC2060, and supports -the following features (inspired by the Google search input language): +The search is always case-insensitive, as defined by RFC2060, and +supports the following features (inspired by the Google search input +language): Automatic \"and\" queries - If you specify multiple words then they will be treated as an \"and\" - expression intended to match all components. + If you specify multiple words then they will be treated as an + \"and\" expression intended to match all components. Phrase searches - If you wrap your query in double-quotes then it will be treated as a - literal string. + If you wrap your query in double-quotes then it will be treated + as a literal string. Negative terms If you precede a term with \"-\" then it will negate that. \"OR\" queries - If you include an upper-case \"OR\" in your search it will cause the - term before it and the term after it to be treated as alternatives. + If you include an upper-case \"OR\" in your search it will cause + the term before it and the term after it to be treated as + alternatives. -In future the following will be added to the language: +In the future the following will be added to the language: * support for date matches * support for location of text matching within the query * from/to/etc headers @@ -1060,7 +1062,7 @@ In future the following will be added to the language: (defun nnir-imap-query-to-imap (criteria query) - "Turn a s-expression format query into IMAP." + "Turn an s-expression format QUERY into IMAP." (mapconcat ;; Turn the expressions into IMAP text (lambda (item) @@ -1072,7 +1074,7 @@ In future the following will be added to the language: (defun nnir-imap-expr-to-imap (criteria expr) - "Convert EXPR into an IMAP search expression on CRITERIA" + "Convert EXPR into an IMAP search expression on CRITERIA." ;; What sort of expression is this, eh? (cond ;; Simple string term @@ -1126,7 +1128,7 @@ that the search language can then understand and use." (defun nnir-imap-next-term (&optional count) - "Return the next TERM from the current buffer." + "Return the next term from the current buffer." (let ((term (nnir-imap-next-symbol count))) ;; What sort of term is this? (cond @@ -1294,7 +1296,7 @@ Windows NT 4.0." ;; Swish-E interface. (defun nnir-run-swish-e (query server &optional _group) - "Run given query against swish-e. + "Run given QUERY against swish-e. Returns a vector of (group name, file name) pairs (also vectors, actually). @@ -1460,7 +1462,7 @@ Tested with swish-e-2.0.1 on Windows NT 4.0." ;; Namazu interface (defun nnir-run-namazu (query server &optional _group) - "Run given query against Namazu. + "Run given QUERY against Namazu. Returns a vector of (group name, file name) pairs (also vectors, actually). @@ -1713,7 +1715,7 @@ construct path: search terms (see the variable (defun nnir-read-parm (parmspec) "Read a single search parameter. -`parmspec' is a cons cell, the car is a symbol, the cdr is a prompt." +PARMSPEC is a cons cell, the car is a symbol, the cdr is a prompt." (let ((sym (car parmspec)) (prompt (cdr parmspec))) (if (listp prompt) @@ -1742,9 +1744,9 @@ construct path: search terms (see the variable nnir-method-default-engines)))) (defun nnir-read-server-parm (key server &optional not-global) - "Return the parameter value corresponding to `key' for `server'. + "Return the parameter value corresponding to KEY for SERVER. If no server-specific value is found consult the global -environment unless `not-global' is non-nil." +environment unless NOT-GLOBAL is non-nil." (let ((method (gnus-server-to-method server))) (cond ((and method (assq key (cddr method))) (nth 1 (assq key (cddr method)))) @@ -1767,10 +1769,10 @@ environment unless `not-global' is non-nil." (declare-function gnus-registry-get-id-key "gnus-registry" (id key)) (defun nnir-search-thread (header) - "Make an nnir group based on the thread containing the article -header. The current server will be searched. If the registry is -installed, the server that the registry reports the current -article came from is also searched." + "Make an nnir group based on the thread containing the article HEADER. +The current server will be searched. If the registry is installed, +the server that the registry reports the current article came from +is also searched." (let* ((query (list (cons 'query (nnimap-make-thread-query header)) (cons 'criteria ""))) commit 489a106b1c16f422989e20471c3c2f26b2149309 Author: Lars Ingebrigtsen Date: Wed Oct 9 06:06:24 2019 +0200 Document `letrec' * doc/lispref/variables.texi (Local Variables): Document letrec (bug#21048). * lisp/subr.el (letrec): Expand the doc string slightly. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index b49874f9eb..8d6cc29380 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -265,6 +265,15 @@ Compare the following example with the example above for @code{let}. @result{} (1 1) @end group @end example +@end defspec + +@defspec letrec (bindings@dots{}) forms@dots{} +This special form is like @code{let}, but all the variables are bound +before any of the local values are computed. The values are then +assigned to the locally bound variables. This is only useful when +lexical binding is in effect, and you want to create closures that +refer to bindings that would otherwise not yet be in effect when using +@code{let}. @end defspec Here is a complete list of the other facilities that create local diff --git a/lisp/subr.el b/lisp/subr.el index b0a9a83958..e361b8324f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1739,7 +1739,9 @@ the hook's buffer-local value rather than its default value." The value of the last form in BODY is returned. Each element of BINDERS is a list (SYMBOL VALUEFORM) which binds SYMBOL to the value of VALUEFORM. -All symbols are bound before the VALUEFORMs are evalled." + +The main difference between this macro and `let'/`let*' is that +all symbols are bound before any of the VALUEFORMs are evalled." ;; Only useful in lexical-binding mode. ;; As a special-form, we could implement it more efficiently (and cleanly, ;; making the vars actually unbound during evaluation of the binders). commit 43310f438734278f12e1ce68835f3c1685a8f663 Author: Lars Ingebrigtsen Date: Wed Oct 9 05:27:03 2019 +0200 Make menu bar entries only point to named functions, not lambdas * lisp/menu-bar.el () (menu-bar--display-line-numbers-mode-visual) (menu-bar--display-line-numbers-mode-relative) (menu-bar--display-line-numbers-mode-absolute) (menu-bar--display-line-numbers-mode-none) (menu-bar--visual-line-mode-enable) (menu-bar--toggle-truncate-long-lines) (menu-bar--wrap-long-lines-window-edge): Make lambdas into trivial wrapper functions so that `C-h k' on the menu items work (bug#13841). (menu-bar-showhide-line-numbers-menu) (menu-bar-line-wrapping-menu): Use them. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index b7967b858a..c404145dff 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1118,46 +1118,58 @@ The selected font will be the default on both the existing and future frames." (global-display-line-numbers-mode) (display-line-numbers-mode))) +(defun menu-bar--display-line-numbers-mode-visual () + "Turn on visual line number mode." + (interactive) + (menu-bar-display-line-numbers-mode 'visual) + (message "Visual line numbers enabled")) + +(defun menu-bar--display-line-numbers-mode-relative () + "Turn on relative line number mode." + (interactive) + (menu-bar-display-line-numbers-mode 'relative) + (message "Relative line numbers enabled")) + +(defun menu-bar--display-line-numbers-mode-absolute () + "Turn on absolute line number mode." + (interactive) + (menu-bar-display-line-numbers-mode t) + (setq display-line-numbers t) + (message "Absolute line numbers enabled")) + +(defun menu-bar--display-line-numbers-mode-none () + "Disable line numbers." + (interactive) + (menu-bar-display-line-numbers-mode nil) + (message "Line numbers disabled")) + (defvar menu-bar-showhide-line-numbers-menu (let ((menu (make-sparse-keymap "Line Numbers"))) (bindings--define-key menu [visual] - `(menu-item "Visual Line Numbers" - ,(lambda () - (interactive) - (menu-bar-display-line-numbers-mode 'visual) - (message "Visual line numbers enabled")) + '(menu-item "Visual Line Numbers" + menu-bar--display-line-numbers-mode-visual :help "Enable visual line numbers" :button (:radio . (eq display-line-numbers 'visual)) :visible (menu-bar-menu-frame-live-and-visible-p))) (bindings--define-key menu [relative] - `(menu-item "Relative Line Numbers" - ,(lambda () - (interactive) - (menu-bar-display-line-numbers-mode 'relative) - (message "Relative line numbers enabled")) + '(menu-item "Relative Line Numbers" + menu-bar--display-line-numbers-mode-relative :help "Enable relative line numbers" :button (:radio . (eq display-line-numbers 'relative)) :visible (menu-bar-menu-frame-live-and-visible-p))) (bindings--define-key menu [absolute] - `(menu-item "Absolute Line Numbers" - ,(lambda () - (interactive) - (menu-bar-display-line-numbers-mode t) - (setq display-line-numbers t) - (message "Absolute line numbers enabled")) + '(menu-item "Absolute Line Numbers" + menu-bar--display-line-numbers-mode-absolute :help "Enable absolute line numbers" :button (:radio . (eq display-line-numbers t)) :visible (menu-bar-menu-frame-live-and-visible-p))) (bindings--define-key menu [none] - `(menu-item "No Line Numbers" - ,(lambda () - (interactive) - (menu-bar-display-line-numbers-mode nil) - (message "Line numbers disabled")) + '(menu-item "No Line Numbers" + menu-bar--display-line-numbers-mode-none :help "Disable line numbers" :button (:radio . (null display-line-numbers)) :visible (menu-bar-menu-frame-live-and-visible-p))) @@ -1266,16 +1278,33 @@ mail status in mode line")) 'tool-bar-lines)))))) menu)) +(defun menu-bar--visual-line-mode-enable () + "Enable visual line mode." + (interactive) + (unless visual-line-mode + (visual-line-mode 1)) + (message "Visual-Line mode enabled")) + +(defun menu-bar--toggle-truncate-long-lines () + "Toggle long lines mode." + (interactive) + (if visual-line-mode (visual-line-mode 0)) + (setq word-wrap nil) + (toggle-truncate-lines 1)) + +(defun menu-bar--wrap-long-lines-window-edge () + "Wrap long lines at window edge." + (interactive) + (if visual-line-mode (visual-line-mode 0)) + (setq word-wrap nil) + (if truncate-lines (toggle-truncate-lines -1))) + (defvar menu-bar-line-wrapping-menu (let ((menu (make-sparse-keymap "Line Wrapping"))) (bindings--define-key menu [word-wrap] - `(menu-item "Word Wrap (Visual Line mode)" - ,(lambda () - (interactive) - (unless visual-line-mode - (visual-line-mode 1)) - (message "Visual-Line mode enabled")) + '(menu-item "Word Wrap (Visual Line mode)" + menu-bar--visual-line-mode-enable :help "Wrap long lines at word boundaries" :button (:radio . (and (null truncate-lines) @@ -1284,12 +1313,8 @@ mail status in mode line")) :visible (menu-bar-menu-frame-live-and-visible-p))) (bindings--define-key menu [truncate] - `(menu-item "Truncate Long Lines" - ,(lambda () - (interactive) - (if visual-line-mode (visual-line-mode 0)) - (setq word-wrap nil) - (toggle-truncate-lines 1)) + '(menu-item "Truncate Long Lines" + menu-bar--toggle-truncate-long-lines :help "Truncate long lines at window edge" :button (:radio . (or truncate-lines (truncated-partial-width-window-p))) @@ -1297,11 +1322,8 @@ mail status in mode line")) :enable (not (truncated-partial-width-window-p)))) (bindings--define-key menu [window-wrap] - `(menu-item "Wrap at Window Edge" - ,(lambda () (interactive) - (if visual-line-mode (visual-line-mode 0)) - (setq word-wrap nil) - (if truncate-lines (toggle-truncate-lines -1))) + '(menu-item "Wrap at Window Edge" + menu-bar--wrap-long-lines-window-edge :help "Wrap long lines at window edge" :button (:radio . (and (null truncate-lines) commit f2cbc7214f04d51e9eae2636d68b7052aa5c1a6d Author: Lars Ingebrigtsen Date: Wed Oct 9 05:13:07 2019 +0200 Add more sanity checks to help-fns--globalized-minor-mode * lisp/help-fns.el (help-fns--globalized-minor-mode): FUNCTION can be a lambda, so protect against that. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index e9e2818d98..06b15a30f9 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -559,7 +559,8 @@ suitable file is found, return nil." (add-hook 'help-fns-describe-function-functions #'help-fns--globalized-minor-mode) (defun help-fns--globalized-minor-mode (function) - (when (get function 'globalized-minor-mode) + (when (and (symbolp function) + (get function 'globalized-minor-mode)) (help-fns--customize-variable function " the global mode variable.") (terpri))) commit 967eed75968571edc503a770b8a631a4477c9b4d Author: Lars Ingebrigtsen Date: Wed Oct 9 05:08:32 2019 +0200 Make add-face-text-property not be destructive on strings * src/textprop.c (add_properties): Take a parameter to say whether it's allowed to be destructive or not (bug#20153). (add_text_properties_1): Ditto. (Fadd_face_text_property): Use this to say that it shouldn't modify face properties on strings destructively. This avoids altering the face properties of one string when altering them on a copy of the string. diff --git a/src/textprop.c b/src/textprop.c index d36b9e14a6..13cd87ac47 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -358,12 +358,15 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object) OBJECT should be the string or buffer the interval is in. + If DESTRUCTIVE, the function is allowed to reuse list values in the + properties. + Return true if this changes I (i.e., if any members of PLIST are actually added to I's plist) */ static bool add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object, - enum property_set_type set_type) + enum property_set_type set_type, bool destructive) { Lisp_Object tail1, tail2, sym1, val1; bool changed = false; @@ -414,7 +417,15 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object, if (set_type == TEXT_PROPERTY_PREPEND) Fsetcar (this_cdr, Fcons (val1, Fcar (this_cdr))); else - nconc2 (Fcar (this_cdr), list1 (val1)); + { + /* Appending. */ + if (destructive) + nconc2 (Fcar (this_cdr), list1 (val1)); + else + Fsetcar (this_cdr, CALLN (Fappend, + Fcar (this_cdr), + list1 (val1))); + } else { /* The previous value is a single value, so make it into a list. */ @@ -1140,7 +1151,8 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) static Lisp_Object add_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object, - enum property_set_type set_type) { + enum property_set_type set_type, + bool destructive) { /* Ensure we run the modification hooks for the right buffer, without switching buffers twice (bug 36190). FIXME: Switching buffers is slow and often unnecessary. */ @@ -1150,7 +1162,8 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end, record_unwind_current_buffer (); set_buffer_internal (XBUFFER (object)); return unbind_to (count, add_text_properties_1 (start, end, properties, - object, set_type)); + object, set_type, + destructive)); } INTERVAL i, unchanged; @@ -1236,7 +1249,7 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end, if (LENGTH (i) == len) { - add_properties (properties, i, object, set_type); + add_properties (properties, i, object, set_type, destructive); if (BUFFERP (object)) signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM (start), XFIXNUM (end) - XFIXNUM (start)); @@ -1247,7 +1260,7 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end, unchanged = i; i = split_interval_left (unchanged, len); copy_properties (unchanged, i); - add_properties (properties, i, object, set_type); + add_properties (properties, i, object, set_type, destructive); if (BUFFERP (object)) signal_after_change (XFIXNUM (start), XFIXNUM (end) - XFIXNUM (start), XFIXNUM (end) - XFIXNUM (start)); @@ -1255,7 +1268,7 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end, } len -= LENGTH (i); - modified |= add_properties (properties, i, object, set_type); + modified |= add_properties (properties, i, object, set_type, destructive); i = next_interval (i); } } @@ -1275,7 +1288,7 @@ Return t if any property value actually changed, nil otherwise. */) Lisp_Object object) { return add_text_properties_1 (start, end, properties, object, - TEXT_PROPERTY_REPLACE); + TEXT_PROPERTY_REPLACE, true); } /* Callers note, this can GC when OBJECT is a buffer (or nil). */ @@ -1337,7 +1350,8 @@ into it. */) add_text_properties_1 (start, end, properties, object, (NILP (append) ? TEXT_PROPERTY_PREPEND - : TEXT_PROPERTY_APPEND)); + : TEXT_PROPERTY_APPEND), + !STRINGP (object)); return Qnil; } commit 534783c526000a3320f1d4c0a42d26c39fff6bd0 Author: Lars Ingebrigtsen Date: Wed Oct 9 04:10:41 2019 +0200 Make `info-display-manual' pop up the correct frame * lisp/info.el (info-display-manual): If the buffer is already in a window, use that window (bug#20020). diff --git a/lisp/info.el b/lisp/info.el index 02f3ea580b..fc0d58068a 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -5338,7 +5338,16 @@ completion alternatives to currently visited manuals." (setq found buffer blist nil)))) (if found - (switch-to-buffer found) + (let ((window (get-buffer-window found t))) + ;; If the buffer is already displayed in a window somewhere, + ;; then select that window (and pop its frame to the top). + (if window + (progn + (raise-frame (window-frame window)) + (select-frame-set-input-focus (window-frame window)) + (select-window window)) + (switch-to-buffer found))) + ;; The buffer doesn't exist; create it. (info-initialize) (info (Info-find-file manual) (generate-new-buffer-name "*info*"))))) commit cca2ba5532d1e274f7d27c62a97bb9ed18f2d356 Author: Lars Ingebrigtsen Date: Wed Oct 9 03:55:09 2019 +0200 Make a nil parameter switch variable-pitch-mode on * lisp/face-remap.el (variable-pitch-mode): Make a nil parameter switch the mode on instead of toggling (bug#19384). diff --git a/lisp/face-remap.el b/lisp/face-remap.el index 1a0cc646c3..5cdecb92ee 100644 --- a/lisp/face-remap.el +++ b/lisp/face-remap.el @@ -474,7 +474,7 @@ may be more appropriate." An interface to `buffer-face-mode' which uses the `variable-pitch' face. Besides the choice of face, it is the same as `buffer-face-mode'." (interactive (list (or current-prefix-arg 'toggle))) - (buffer-face-mode-invoke 'variable-pitch arg + (buffer-face-mode-invoke 'variable-pitch (or arg t) (called-interactively-p 'interactive))) commit 9365ff0527c27adb1c66e11ceee129f5e932a98d Author: Lars Ingebrigtsen Date: Wed Oct 9 03:11:15 2019 +0200 Remove XEmacs compat code from prolog.el * lisp/progmodes/prolog.el (prolog-mode-syntax-table) (prolog-help-info, prolog-Info-follow-nearest-node) (prolog-menu-help, prolog-edit-menu-runtime) (prolog-inferior-menu-all): Remove XEmacs compat code. diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 780eff2d8a..4665500349 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -788,15 +788,8 @@ This is really kludgy, and unneeded (i.e. obsolete) in Emacs>=24." (modify-syntax-entry ?% "<" table) (modify-syntax-entry ?\n ">" table) - (if (featurep 'xemacs) - (progn - (modify-syntax-entry ?* ". 67" table) - (modify-syntax-entry ?/ ". 58" table) - ) - ;; Emacs wants to see this it seems: - (modify-syntax-entry ?* ". 23b" table) - (modify-syntax-entry ?/ ". 14" table) - ) + (modify-syntax-entry ?* ". 23b" table) + (modify-syntax-entry ?/ ". 14" table) table)) (defconst prolog-atom-char-regexp @@ -2424,17 +2417,14 @@ In effect it sets the `fill-prefix' when inside comments and then calls ;; Single match (re-search-backward "[^ /]" nil t)) - ;; (Info-follow-nearest-node (point)) - (prolog-Info-follow-nearest-node) + (Info-follow-nearest-node) (re-search-forward (concat "^`" (regexp-quote predicate)) nil t) (beginning-of-line) (recenter 0) (pop-to-buffer buffer))) -(defun prolog-Info-follow-nearest-node () - (if (featurep 'xemacs) - (Info-follow-nearest-node (point)) - (Info-follow-nearest-node))) +(define-obsolete-function-alias 'prolog-Info-follow-nearest-node + #'Info-follow-nearest-node "27.1") (defun prolog-help-online (predicate) (prolog-ensure-process) @@ -3337,11 +3327,7 @@ PREFIX is the prefix of the search regexp." prolog-menu-help (list prolog-mode-map prolog-inferior-mode-map) "Help menu for the Prolog mode." ;; FIXME: Does it really deserve a whole menu to itself? - `(,(if (featurep 'xemacs) "Help" - ;; Not sure it's worth the trouble. --Stef - ;; (add-to-list 'menu-bar-final-items - ;; (easy-menu-intern "Prolog-Help")) - "Prolog-help") + `("Prolog-help" ["On predicate" prolog-help-on-predicate prolog-help-function-i] ["Apropos" prolog-help-apropos (eq prolog-system 'swi)] "---" @@ -3353,11 +3339,9 @@ PREFIX is the prefix of the search regexp." ;; FIXME: Don't use a whole menu for just "Run Mercury". --Stef `("System" ;; Runtime menu name. - ,@(unless (featurep 'xemacs) - '(:label (cond ((eq prolog-system 'eclipse) "ECLiPSe") - ((eq prolog-system 'mercury) "Mercury") - (t "System")))) - + :label (cond ((eq prolog-system 'eclipse) "ECLiPSe") + ((eq prolog-system 'mercury) "Mercury") + (t "System")) ;; Consult items, NIL for mercury. ["Consult file" prolog-consult-file :included (not (eq prolog-system 'mercury))] @@ -3369,8 +3353,7 @@ PREFIX is the prefix of the search regexp." :included (not (eq prolog-system 'mercury))] ;; Compile items, NIL for everything but SICSTUS. - ,(if (featurep 'xemacs) "---" - ["---" nil :included (eq prolog-system 'sicstus)]) + ["---" nil :included (eq prolog-system 'sicstus)] ["Compile file" prolog-compile-file :included (eq prolog-system 'sicstus)] ["Compile buffer" prolog-compile-buffer @@ -3381,8 +3364,7 @@ PREFIX is the prefix of the search regexp." :included (eq prolog-system 'sicstus)] ;; Debug items, NIL for Mercury. - ,(if (featurep 'xemacs) "---" - ["---" nil :included (not (eq prolog-system 'mercury))]) + ["---" nil :included (not (eq prolog-system 'mercury))] ;; FIXME: Could we use toggle or radio buttons? --Stef ["Debug" prolog-debug-on :included (not (eq prolog-system 'mercury))] ["Debug off" prolog-debug-off @@ -3465,14 +3447,11 @@ PREFIX is the prefix of the search regexp." "Menu for the inferior Prolog buffer." `("Prolog" ;; Runtime menu name. - ,@(unless (featurep 'xemacs) - '(:label (cond ((eq prolog-system 'eclipse) "ECLiPSe") - ((eq prolog-system 'mercury) "Mercury") - (t "Prolog")))) - + :label (cond ((eq prolog-system 'eclipse) "ECLiPSe") + ((eq prolog-system 'mercury) "Mercury") + (t "Prolog")) ;; Debug items, NIL for Mercury. - ,(if (featurep 'xemacs) "---" - ["---" nil :included (not (eq prolog-system 'mercury))]) + ["---" nil :included (not (eq prolog-system 'mercury))] ;; FIXME: Could we use toggle or radio buttons? --Stef ["Debug" prolog-debug-on :included (not (eq prolog-system 'mercury))] ["Debug off" prolog-debug-off commit 11d3e309b3a93e864886e8b4a8246b8f6cb7934a Author: Lars Ingebrigtsen Date: Wed Oct 9 02:53:11 2019 +0200 Remove some XEmacs compat code from tree-widget.el * lisp/tree-widget.el (tree-widget-themes-load-path) (tree-widget-use-image-p, tree-widget-create-image) (tree-widget-image-formats, tree-widget-image-properties) (tree-widget-lookup-image): Remove XEmacs compat code. diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el index b28448654c..e4f73d4e94 100644 --- a/lisp/tree-widget.el +++ b/lisp/tree-widget.el @@ -131,20 +131,15 @@ (defvar tree-widget-themes-load-path '(load-path - (let ((dir (if (fboundp 'locate-data-directory) - (locate-data-directory "tree-widget") ;; XEmacs - data-directory))) - (and dir (list dir (expand-file-name "images" dir)))) - ) + (let ((dir data-directory)) + (and dir (list dir (expand-file-name "images" dir))))) "List of locations in which to search for the themes sub-directory. Each element is an expression that will be recursively evaluated until it returns a single directory or a list of directories. The default is to search in the `load-path' first, then in the \"images\" sub directory in the data directory, then in the data directory. -The data directory is the value of the variable `data-directory' on -Emacs, and what `(locate-data-directory \"tree-widget\")' returns on -XEmacs.") +The data directory is the value of the variable `data-directory'.") (defcustom tree-widget-themes-directory "tree-widget" "Name of the directory in which to look for an image theme. @@ -215,49 +210,26 @@ See Info node `(elisp)Specified Space'." ;;; Image support ;; -(eval-and-compile ;; Emacs/XEmacs compatibility stuff - (cond - ;; XEmacs - ((featurep 'xemacs) - (defsubst tree-widget-use-image-p () - "Return non-nil if image support is currently enabled." - (and tree-widget-image-enable - widget-glyph-enable - (console-on-window-system-p))) - (defsubst tree-widget-create-image (type file &optional props) - "Create an image of type TYPE from FILE, and return it. +(defsubst tree-widget-use-image-p () + "Return non-nil if image support is currently enabled." + (and tree-widget-image-enable + widget-image-enable + (display-images-p))) + +(defsubst tree-widget-create-image (type file &optional props) + "Create an image of type TYPE from FILE, and return it. Give the image the specified properties PROPS." - (apply 'make-glyph `([,type :file ,file ,@props]))) - (defsubst tree-widget-image-formats () - "Return the alist of image formats/file name extensions. -See also the option `widget-image-file-name-suffixes'." - (delq nil - (mapcar - #'(lambda (fmt) - (and (valid-image-instantiator-format-p (car fmt)) fmt)) - widget-image-file-name-suffixes))) - ) - ;; Emacs - (t - (defsubst tree-widget-use-image-p () - "Return non-nil if image support is currently enabled." - (and tree-widget-image-enable - widget-image-enable - (display-images-p))) - (defsubst tree-widget-create-image (type file &optional props) - "Create an image of type TYPE from FILE, and return it. -Give the image the specified properties PROPS." - (apply 'create-image `(,file ,type nil ,@props))) - (defsubst tree-widget-image-formats () - "Return the alist of image formats/file name extensions. + (declare (obsolete create-image "27.1")) + (apply 'create-image `(,file ,type nil ,@props))) + +(defsubst tree-widget-image-formats () + "Return the alist of image formats/file name extensions. See also the option `widget-image-conversion'." - (delq nil - (mapcar - #'(lambda (fmt) - (and (image-type-available-p (car fmt)) fmt)) - widget-image-conversion))) - )) - ) + (delq nil + (mapcar + #'(lambda (fmt) + (and (image-type-available-p (car fmt)) fmt)) + widget-image-conversion))) ;; Buffer local cache of theme data. (defvar tree-widget--theme nil) @@ -391,9 +363,7 @@ XEmacs in the variables `tree-widget-image-properties-emacs', and (cons :pointer (cons (or (cdr (assoc name tree-widget--cursors)) 'hand) (tree-widget-set-image-properties - (if (featurep 'xemacs) - tree-widget-image-properties-xemacs - tree-widget-image-properties-emacs))))) + tree-widget-image-properties-emacs)))) (defun tree-widget-lookup-image (name) "Look up in current theme for an image with NAME. @@ -411,9 +381,9 @@ found." (and (file-readable-p file) (file-regular-p file) (throw 'found - (tree-widget-create-image - (car fmt) file - (tree-widget-image-properties name)))))))) + (apply #'create-image + (car fmt) file nil + (tree-widget-image-properties name)))))))) nil))) (defun tree-widget-find-image (name) commit 97702f5292307c71c9c124604bf85b6c629f3bb6 Author: Lars Ingebrigtsen Date: Wed Oct 9 02:46:17 2019 +0200 Remove some XEmacs compat code from newst*.el * lisp/net/newst-plainview.el (newsticker--plainview-tool-bar-map): Remove XEmacs support. * lisp/net/newst-treeview.el (newsticker-treeview-tool-bar-map): diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el index 58bca31aba..e1e97801a0 100644 --- a/lisp/net/newst-plainview.el +++ b/lisp/net/newst-plainview.el @@ -273,69 +273,67 @@ images." ;; ====================================================================== (defvar newsticker--plainview-tool-bar-map - (if (featurep 'xemacs) - nil - (if (boundp 'tool-bar-map) - (let ((tool-bar-map (make-sparse-keymap))) - (tool-bar-add-item "newsticker/prev-feed" - 'newsticker-previous-feed - 'newsticker-previous-feed - :help "Go to previous feed" - :enable '(newsticker-previous-feed-available-p)) - (tool-bar-add-item "newsticker/prev-item" - 'newsticker-previous-item - 'newsticker-previous-item - :help "Go to previous item" - :enable '(newsticker-previous-item-available-p)) - (tool-bar-add-item "newsticker/next-item" - 'newsticker-next-item - 'newsticker-next-item - :help "Go to next item" - :enable '(newsticker-next-item-available-p)) - (tool-bar-add-item "newsticker/next-feed" - 'newsticker-next-feed - 'newsticker-next-feed - :help "Go to next feed" - :enable '(newsticker-next-feed-available-p)) - (tool-bar-add-item "newsticker/narrow" - 'newsticker-toggle-auto-narrow-to-feed - 'newsticker-toggle-auto-narrow-to-feed - :help "Toggle visibility of other feeds") - (tool-bar-add-item "newsticker/mark-immortal" - 'newsticker-mark-item-at-point-as-immortal - 'newsticker-mark-item-at-point-as-immortal - :help "Mark current item as immortal" - :enable '(newsticker-item-not-immortal-p)) - (tool-bar-add-item "newsticker/mark-read" - 'newsticker-mark-item-at-point-as-read - 'newsticker-mark-item-at-point-as-read - :help "Mark current item as read" - :enable '(newsticker-item-not-old-p)) - (tool-bar-add-item "newsticker/get-all-news" - 'newsticker-get-all-news - 'newsticker-get-all-news - :help "Get news for all feeds") - (tool-bar-add-item "newsticker/update" - 'newsticker-buffer-force-update - 'newsticker-buffer-force-update - :help "Update newsticker buffer" - :enable '(not newsticker--buffer-uptodate-p)) - (tool-bar-add-item "newsticker/browse-url" - 'newsticker-browse-url - 'newsticker-browse-url - :help "Browse URL for item at point") - ;; standard icons / actions - (define-key tool-bar-map [newsticker-sep-1] - (list 'menu-item "--double-line")) - (tool-bar-add-item "close" - 'newsticker-close-buffer - 'newsticker-close-buffer - :help "Close newsticker buffer") - (tool-bar-add-item "preferences" - 'newsticker-customize - 'newsticker-customize - :help "Customize newsticker") - tool-bar-map)))) + (when (boundp 'tool-bar-map) + (let ((tool-bar-map (make-sparse-keymap))) + (tool-bar-add-item "newsticker/prev-feed" + 'newsticker-previous-feed + 'newsticker-previous-feed + :help "Go to previous feed" + :enable '(newsticker-previous-feed-available-p)) + (tool-bar-add-item "newsticker/prev-item" + 'newsticker-previous-item + 'newsticker-previous-item + :help "Go to previous item" + :enable '(newsticker-previous-item-available-p)) + (tool-bar-add-item "newsticker/next-item" + 'newsticker-next-item + 'newsticker-next-item + :help "Go to next item" + :enable '(newsticker-next-item-available-p)) + (tool-bar-add-item "newsticker/next-feed" + 'newsticker-next-feed + 'newsticker-next-feed + :help "Go to next feed" + :enable '(newsticker-next-feed-available-p)) + (tool-bar-add-item "newsticker/narrow" + 'newsticker-toggle-auto-narrow-to-feed + 'newsticker-toggle-auto-narrow-to-feed + :help "Toggle visibility of other feeds") + (tool-bar-add-item "newsticker/mark-immortal" + 'newsticker-mark-item-at-point-as-immortal + 'newsticker-mark-item-at-point-as-immortal + :help "Mark current item as immortal" + :enable '(newsticker-item-not-immortal-p)) + (tool-bar-add-item "newsticker/mark-read" + 'newsticker-mark-item-at-point-as-read + 'newsticker-mark-item-at-point-as-read + :help "Mark current item as read" + :enable '(newsticker-item-not-old-p)) + (tool-bar-add-item "newsticker/get-all-news" + 'newsticker-get-all-news + 'newsticker-get-all-news + :help "Get news for all feeds") + (tool-bar-add-item "newsticker/update" + 'newsticker-buffer-force-update + 'newsticker-buffer-force-update + :help "Update newsticker buffer" + :enable '(not newsticker--buffer-uptodate-p)) + (tool-bar-add-item "newsticker/browse-url" + 'newsticker-browse-url + 'newsticker-browse-url + :help "Browse URL for item at point") + ;; standard icons / actions + (define-key tool-bar-map [newsticker-sep-1] + (list 'menu-item "--double-line")) + (tool-bar-add-item "close" + 'newsticker-close-buffer + 'newsticker-close-buffer + :help "Close newsticker buffer") + (tool-bar-add-item "preferences" + 'newsticker-customize + 'newsticker-customize + :help "Customize newsticker") + tool-bar-map))) ;; ====================================================================== ;;; Newsticker mode diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el index ece728a835..2a6a64de46 100644 --- a/lisp/net/newst-treeview.el +++ b/lisp/net/newst-treeview.el @@ -1093,71 +1093,69 @@ Arguments are ignored." ;;; Toolbar ;; ====================================================================== (defvar newsticker-treeview-tool-bar-map - (if (featurep 'xemacs) - nil - (if (boundp 'tool-bar-map) - (let ((tool-bar-map (make-sparse-keymap))) - (tool-bar-add-item "newsticker/prev-feed" - 'newsticker-treeview-prev-feed - 'newsticker-treeview-prev-feed - :help "Go to previous feed" - ;;:enable '(newsticker-previous-feed-available-p) FIXME - ) - (tool-bar-add-item "newsticker/prev-item" - 'newsticker-treeview-prev-item - 'newsticker-treeview-prev-item - :help "Go to previous item" - ;;:enable '(newsticker-previous-item-available-p) FIXME - ) - (tool-bar-add-item "newsticker/next-item" - 'newsticker-treeview-next-item - 'newsticker-treeview-next-item - :visible t - :help "Go to next item" - ;;:enable '(newsticker-next-item-available-p) FIXME - ) - (tool-bar-add-item "newsticker/next-feed" - 'newsticker-treeview-next-feed - 'newsticker-treeview-next-feed - :help "Go to next feed" - ;;:enable '(newsticker-next-feed-available-p) FIXME - ) - (tool-bar-add-item "newsticker/mark-immortal" - 'newsticker-treeview-toggle-item-immortal - 'newsticker-treeview-toggle-item-immortal - :help "Toggle current item as immortal" - ;;:enable '(newsticker-item-not-immortal-p) FIXME - ) - (tool-bar-add-item "newsticker/mark-read" - 'newsticker-treeview-mark-item-old - 'newsticker-treeview-mark-item-old - :help "Mark current item as read" - ;;:enable '(newsticker-item-not-old-p) FIXME - ) - (tool-bar-add-item "newsticker/get-all" - 'newsticker-get-all-news - 'newsticker-get-all-news - :help "Get news for all feeds") - (tool-bar-add-item "newsticker/update" - 'newsticker-treeview-update - 'newsticker-treeview-update - :help "Update newsticker buffer") - (tool-bar-add-item "newsticker/browse-url" - 'newsticker-browse-url - 'newsticker-browse-url - :help "Browse URL for item at point") - ;; standard icons / actions - (define-key tool-bar-map [newsticker-sep-1] - (list 'menu-item "--double-line")) - (tool-bar-add-item "close" - 'newsticker-treeview-quit - 'newsticker-treeview-quit - :help "Close newsticker") - (tool-bar-add-item "preferences" - 'newsticker-customize - 'newsticker-customize - :help "Customize newsticker") - tool-bar-map)))) + (when (boundp 'tool-bar-map) + (let ((tool-bar-map (make-sparse-keymap))) + (tool-bar-add-item "newsticker/prev-feed" + 'newsticker-treeview-prev-feed + 'newsticker-treeview-prev-feed + :help "Go to previous feed" + ;;:enable '(newsticker-previous-feed-available-p) FIXME + ) + (tool-bar-add-item "newsticker/prev-item" + 'newsticker-treeview-prev-item + 'newsticker-treeview-prev-item + :help "Go to previous item" + ;;:enable '(newsticker-previous-item-available-p) FIXME + ) + (tool-bar-add-item "newsticker/next-item" + 'newsticker-treeview-next-item + 'newsticker-treeview-next-item + :visible t + :help "Go to next item" + ;;:enable '(newsticker-next-item-available-p) FIXME + ) + (tool-bar-add-item "newsticker/next-feed" + 'newsticker-treeview-next-feed + 'newsticker-treeview-next-feed + :help "Go to next feed" + ;;:enable '(newsticker-next-feed-available-p) FIXME + ) + (tool-bar-add-item "newsticker/mark-immortal" + 'newsticker-treeview-toggle-item-immortal + 'newsticker-treeview-toggle-item-immortal + :help "Toggle current item as immortal" + ;;:enable '(newsticker-item-not-immortal-p) FIXME + ) + (tool-bar-add-item "newsticker/mark-read" + 'newsticker-treeview-mark-item-old + 'newsticker-treeview-mark-item-old + :help "Mark current item as read" + ;;:enable '(newsticker-item-not-old-p) FIXME + ) + (tool-bar-add-item "newsticker/get-all" + 'newsticker-get-all-news + 'newsticker-get-all-news + :help "Get news for all feeds") + (tool-bar-add-item "newsticker/update" + 'newsticker-treeview-update + 'newsticker-treeview-update + :help "Update newsticker buffer") + (tool-bar-add-item "newsticker/browse-url" + 'newsticker-browse-url + 'newsticker-browse-url + :help "Browse URL for item at point") + ;; standard icons / actions + (define-key tool-bar-map [newsticker-sep-1] + (list 'menu-item "--double-line")) + (tool-bar-add-item "close" + 'newsticker-treeview-quit + 'newsticker-treeview-quit + :help "Close newsticker") + (tool-bar-add-item "preferences" + 'newsticker-customize + 'newsticker-customize + :help "Customize newsticker") + tool-bar-map))) ;; ====================================================================== ;;; actions commit f96b8fd27c382a941c52c2938544b9b0e3a2fb0e Author: Federico Tedin Date: Thu Sep 26 19:18:58 2019 +0200 Filter packages by name in list-packages. (Bug#36981) * lisp/emacs-lisp/package.el (package-menu-filter-by-name): New function to filter packages by name. (package-menu-clear-filter): New function to clear applied filters. (package-menu-filter-by-keyword): Rename function from package-menu-filter. (package-menu--generate): Don't change 'q' binding anymore. (package-menu-mode-map): Bind '/ n' to package-menu-filter-by-name, '/ k' to package-menu-filter-by-keyword and '/ /' to package-menu-clear-filter. (package-menu-mode-menu): Update menu entries for the three functions. * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name) (package-test-list-clear-filter): New tests. * doc/emacs/package.texi: Document usage of package-menu-filter-by-name, package-menu-clear-filter and update reference to package-menu-filter-by-keyword. * etc/NEWS: Announce changes. diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 2c09ca8902..d97648af1b 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -136,11 +136,20 @@ Refresh the package list (@code{package-menu-refresh}). This fetches the list of available packages from the package archive again, and recomputes the package list. -@item f -Filter the package list (@code{package-menu-filter}). This prompts -for a keyword (e.g., @samp{games}), then shows only the packages -that relate to that keyword. To restore the full package list, -type @kbd{q}. +@item / k +Filter the package list by keyword +(@code{package-menu-filter-by-keyword}). This prompts for a keyword +(e.g., @samp{games}), then shows only the packages that relate to that +keyword. + +@item / n +Filter the package list by name (@code{package-menu-filter-by-name}). +This prompts for a string, then shows only the packages whose names +match a regexp with that value. + +@item / / +Clear filter currently applied to the package list +(@code{package-menu-clear-filter}). @item H Permanently hide packages that match a regexp diff --git a/etc/NEWS b/etc/NEWS index 906dc912d6..2ca681ff9b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1006,6 +1006,16 @@ early init file. *** New function 'package-activate-all'. ++++ +*** New functions for filtering packages list. +A new function has been added which allows users to filter the +packages list by name: 'package-menu-filter-by-name'. By default, it +is bound to '/ n'. Additionally, the function +'package-menu-fiter-by-keyword' has been renamed from +'package-menu-filter'. Its keybinding has also been changed to '/ k' +(from 'f'). To clear any of the two filters, the user can now call +the 'package-menu-clear-filter' function, bound to '/ /' by default. + --- *** Imenu support has been added to 'package-menu-mode'. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 0b2dc24ebb..20462064af 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2685,7 +2685,9 @@ either a full name or nil, and EMAIL is a valid email address." (define-key map "i" 'package-menu-mark-install) (define-key map "U" 'package-menu-mark-upgrades) (define-key map "r" 'package-menu-refresh) - (define-key map "f" 'package-menu-filter) + (define-key map (kbd "/ k") 'package-menu-filter-by-keyword) + (define-key map (kbd "/ n") 'package-menu-filter-by-name) + (define-key map (kbd "/ /") 'package-menu-clear-filter) (define-key map "~" 'package-menu-mark-obsolete-for-deletion) (define-key map "x" 'package-menu-execute) (define-key map "h" 'package-menu-quick-help) @@ -2717,7 +2719,11 @@ either a full name or nil, and EMAIL is a valid email address." ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] "--" - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] + ("Filter Packages" + ["Filter by Keyword" package-menu-filter-by-keyword :help "Filter packages by keyword"] + ["Filter by Name" package-menu-filter-by-name :help "Filter packages by name"] + ["Clear Filter" package-menu-clear-filter :help "Clear package list filter"]) + ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all packages matching a regexp"] ["Display Older Versions" package-menu-toggle-hiding :style toggle :selected (not package-menu--hide-packages) @@ -3028,9 +3034,6 @@ shown." (let ((filters (mapconcat #'identity keywords ","))) (concat "Package[" filters "]")) "Package")) - (if keywords - (define-key package-menu-mode-map "q" 'package-show-package-list) - (define-key package-menu-mode-map "q" 'quit-window)) (tabulated-list-init-header) (tabulated-list-print remember-pos)) @@ -3660,10 +3663,8 @@ shown." (select-window win) (switch-to-buffer buf)))) -;; package-menu--generate rebinds "q" on the fly, so we have to -;; hard-code the binding in the doc-string here. -(defun package-menu-filter (keyword) - "Filter the *Packages* buffer. +(defun package-menu-filter-by-keyword (keyword) + "Filter the \"*Packages*\" buffer by KEYWORD. Show only those items that relate to the specified KEYWORD. KEYWORD can be a string or a list of strings. If it is a list, a @@ -3673,9 +3674,7 @@ Interactively, it is a list of strings separated by commas. KEYWORD can also be used to filter by status or archive name by using keywords like \"arc:gnu\" and \"status:available\". Statuses available include \"incompat\", \"available\", -\"built-in\" and \"installed\". - -To restore the full package list, type `q'." +\"built-in\" and \"installed\"." (interactive (list (completing-read-multiple "Keywords (comma separated): " (package-all-keywords)))) @@ -3683,6 +3682,30 @@ To restore the full package list, type `q'." (list keyword) keyword))) +(defun package-menu-filter-by-name (name) + "Filter the \"*Packages*\" buffer by NAME. +Show only those items whose name matches the regular expression +NAME. If NAME is nil or the empty string, show all packages." + (interactive (list (read-from-minibuffer "Filter by name (regexp): "))) + (if (or (not name) (string-empty-p name)) + (package-show-package-list t nil) + ;; Update `tabulated-list-entries' so that it contains all + ;; packages before searching. + (package-menu--refresh t nil) + (let (matched) + (dolist (entry tabulated-list-entries) + (let* ((pkg-name (package-desc-name (car entry)))) + (when (string-match name (symbol-name pkg-name)) + (push pkg-name matched)))) + (if matched + (package-show-package-list matched nil) + (user-error "No packages found"))))) + +(defun package-menu-clear-filter () + "Clear any filter currently applied to the \"*Packages*\" buffer." + (interactive) + (package-menu--generate t t)) + (defun package-list-packages-no-fetch () "Display a list of packages. Does not fetch the updated list of packages before displaying. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 0edb81d6a1..8670e6f3fa 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -365,6 +365,28 @@ Must called from within a `tar-mode' buffer." (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) +(ert-deftest package-test-list-filter-by-name () + "Ensure package list is filtered correctly by package name." + (with-package-test () + (let ((buf (package-list-packages))) + (package-menu-filter-by-name "tetris") + (goto-char (point-min)) + (should (re-search-forward "^\\s-+tetris" nil t)) + (should (= (count-lines (point-min) (point-max)) 1)) + (kill-buffer buf)))) + +(ert-deftest package-test-list-clear-filter () + "Ensure package list filter is cleared correctly." + (with-package-test () + (let ((buf (package-list-packages))) + (let ((num-packages (count-lines (point-min) (point-max)))) + (should (> num-packages 1)) + (package-menu-filter-by-name "tetris") + (should (= (count-lines (point-min) (point-max)) 1)) + (package-menu-clear-filter) + (should (= (count-lines (point-min) (point-max)) num-packages))) + (kill-buffer buf)))) + (ert-deftest package-test-update-archives () "Test updating package archives." (with-package-test () commit ba57f1a4273cabb53cbae86ad34b0a4bf01e1513 Author: Hong Xu Date: Tue Oct 8 18:43:47 2019 +0200 Search upward from current dir for the default TAGS file * doc/emacs/maintaining.texi (Select Tags Table): Update the doc of `visit-tags-table' (bug#37518). * lisp/progmodes/etags.el (tags--find-default-tags-dir-recursively) (visit-tags-table): Search upward from current dir for the default TAGS file. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 519667dfbe..ef448dd595 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -2666,11 +2666,12 @@ etags --language=none \ @subsection Selecting a Tags Table @findex visit-tags-table - Emacs has at any time at most one @dfn{selected} tags table. All the -commands for working with tags tables use the selected one. To select -a tags table, type @kbd{M-x visit-tags-table}, which reads the tags -table file name as an argument, with @file{TAGS} in the default -directory as the default. + Emacs has at any time at most one @dfn{selected} tags table. All +the commands for working with tags tables use the selected one. To +select a tags table, type @kbd{M-x visit-tags-table}, which reads the +tags table file name as an argument, with @file{TAGS} defaulting to +the first directory that contains a file named @file{TAGS} encountered +when recursively searching upward from the default directory. @vindex tags-file-name Emacs does not actually read in the tags table contents until you diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index c40422dbc5..906ab37c6b 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -274,6 +274,19 @@ buffer-local and set them to nil." (setq buffer-undo-list t) (initialize-new-tags-table)) +(defun tags--find-default-tags-dir-recursively (current-dir) + "Find the directory in which the default TAGS file lives. +It is the first directory that contains a file named TAGS +encountered when recursively searching upward from CURRENT-DIR." + (let ((tag-filename (expand-file-name "TAGS" current-dir))) + (if (file-exists-p tag-filename) + current-dir + (let ((parent-dir + (file-name-directory (directory-file-name current-dir)))) + (if (string= parent-dir current-dir) ;; root dir is reached + nil + (tags--find-default-tags-dir-recursively parent-dir)))))) + ;;;###autoload (defun visit-tags-table (file &optional local) "Tell tags commands to use tags table file FILE. @@ -286,12 +299,18 @@ from Lisp, if the optional arg LOCAL is non-nil, set the local value. When you find a tag with \\[find-tag], the buffer it finds the tag in is given a local value of this variable which is the name of the tags file the tag was in." - (interactive (list (read-file-name "Visit tags table (default TAGS): " - default-directory - (expand-file-name "TAGS" - default-directory) - t) - current-prefix-arg)) + (interactive + (let ((default-tag-dir + (or (tags--find-default-tags-dir-recursively default-directory) + default-directory))) + (list (read-file-name + "Visit tags table (default TAGS): " + ;; default to TAGS from default-directory up to root. + default-tag-dir + (expand-file-name "TAGS" default-tag-dir) + t) + current-prefix-arg))) + (or (stringp file) (signal 'wrong-type-argument (list 'stringp file))) ;; Bind tags-file-name so we can control below whether the local or ;; global value gets set. commit 1793d4979b3a38fd9ece1412cbc9ff2d2ed3ab3f Author: Stefan Kangas Date: Tue Oct 8 18:30:39 2019 +0200 Fix title inconsistencies in elisp intro book * doc/lispintro/emacs-lisp-intro.texi: Fix title inconsistencies. (Bug#31037) diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 22ea655d59..3e43f7f09f 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -103,7 +103,7 @@ @end direntry @copying -This is an @cite{Introduction to Programming in Emacs Lisp}, for +This is @cite{An Introduction to Programming in Emacs Lisp}, for people who are not programmers. @sp 1 @iftex @@ -892,8 +892,8 @@ to read them. But I have tried to keep down the number of such paragraphs. This book is intended as an approachable hill, rather than as a daunting mountain. -This introduction to @cite{Programming in Emacs Lisp} has a companion -document, +This book, @cite{An Introduction to Programming in Emacs Lisp}, has a +companion document, @iftex @cite{The GNU Emacs Lisp Reference Manual}. @end iftex commit 759ba8d1d4553acc14ee5db552f69e08d268aa95 Author: Stefan Kangas Date: Tue Oct 8 16:42:05 2019 +0200 Add some more commands to eshell-visual-commands * lisp/eshell/em-term.el (eshell-visual-commands): Add some more commonly used commands. diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index dea90405ad..36a26e9346 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el @@ -53,22 +53,21 @@ which commands are considered visual in nature." (defcustom eshell-term-load-hook nil "A list of functions to call when loading `eshell-term'." :version "24.1" ; removed eshell-term-initialize - :type 'hook - :group 'eshell-term) + :type 'hook) (defcustom eshell-visual-commands '("vi" ; what is going on?? - "screen" "top" ; ok, a valid program... + "screen" "tmux" "top" "htop" ; ok, a valid program... "less" "more" ; M-x view-file - "lynx" "ncftp" ; w3.el, ange-ftp - "pine" "tin" "trn" "elm") ; GNUS!! + "lynx" "links" "ncftp" ; eww, ange-ftp + "mutt" "pine" "tin" "trn" "elm") ; GNUS!! "A list of commands that present their output in a visual fashion. Commands listed here are run in a term buffer. See also `eshell-visual-subcommands' and `eshell-visual-options'." :type '(repeat string) - :group 'eshell-term) + :version "27.1") (defcustom eshell-visual-subcommands nil @@ -89,8 +88,7 @@ because git shows logs and diffs using a pager by default. See also `eshell-visual-commands' and `eshell-visual-options'." :type '(repeat (cons (string :tag "Command") (repeat (string :tag "Subcommand")))) - :version "24.4" - :group 'eshell-term) + :version "24.4") (defcustom eshell-visual-options nil @@ -111,8 +109,7 @@ always uses a pager for output. See also `eshell-visual-commands' and `eshell-visual-subcommands'." :type '(repeat (cons (string :tag "Command") (repeat (string :tag "Option")))) - :version "24.4" - :group 'eshell-term) + :version "24.4") ;; If you change this from term-term-name, you need to ensure that the ;; value you choose exists in the system's terminfo database. (Bug#12485) @@ -121,8 +118,7 @@ See also `eshell-visual-commands' and `eshell-visual-subcommands'." See `term-term-name' in term.el for more information on how this is used." :version "24.3" ; eterm -> term-term-name = eterm-color - :type 'string - :group 'eshell-term) + :type 'string) (defcustom eshell-escape-control-x t "If non-nil, allow to be handled by Emacs key in visual buffers. @@ -130,16 +126,14 @@ See the variables `eshell-visual-commands', `eshell-visual-subcommands', and `eshell-visual-options'. If this variable is set to nil, will send that control character to the invoked process." - :type 'boolean - :group 'eshell-term) + :type 'boolean) (defcustom eshell-destroy-buffer-when-process-dies nil "If non-nil, term buffers are destroyed after their processes die. WARNING: Setting this to non-nil may result in unexpected behavior for short-lived processes, see bug#18108." :version "25.1" - :type 'boolean - :group 'eshell-term) + :type 'boolean) ;;; Internal Variables: commit 6469f9cd9290c2ed3317b1fd4fbb4288295b327f Author: Eli Zaretskii Date: Tue Oct 8 16:57:23 2019 +0300 Fix crashes on TTY frames due to "C-x 6 f" * src/xdisp.c (redisplay_internal): Revert the recent change regarding TTY frames' garbaged flag. It is not needed. * src/dispnew.c (adjust_frame_glyphs_for_frame_redisplay): When returning due to mismatch between the desired and actual dimensions of the glyph matrix, set the frame's garbaged flag for TTY frames. This avoids crashes when we are later called from redisplay. Reported by Ergus . diff --git a/src/dispnew.c b/src/dispnew.c index 4cf131522e..4dd5ee2a1e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2051,7 +2051,19 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f) to the frame width (from CHANGE_FRAME_SIZE_1). */ if (matrix_dim.width != FRAME_TOTAL_COLS (f) || matrix_dim.height != FRAME_TOTAL_LINES (f)) - return; + { + /* We have reallocated the frame's glyph pools, but didn't + update the glyph pointers in the frame's glyph matrices + to use the reallocated pools (that happens below, in the + call to adjust_glyph_matrix). Set the frame's garbaged + flag, so that when we are called again from + redisplay_internal, we don't erroneously call + save_current_matrix, because it will use the wrong glyph + pointers, and will most probably crash. */ + if (!FRAME_WINDOW_P (f) && pool_changed_p) + SET_FRAME_GARBAGED (f); + return; + } eassert (matrix_dim.width == FRAME_TOTAL_COLS (f) && matrix_dim.height == FRAME_TOTAL_LINES (f)); diff --git a/src/xdisp.c b/src/xdisp.c index 29d49d57df..1586a02e3d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -15684,7 +15684,7 @@ redisplay_internal (void) the frame. Don't do that on TTY frames, since we need to keep the garbaged flag in that case when the frame has been resized. */ - if (FRAME_WINDOW_P (f) && FRAME_GARBAGED_P (f)) + if (FRAME_GARBAGED_P (f)) { fset_redisplay (f); f->garbaged = false; commit 304d022a66f2c71ee643021db69c1c99d135df55 Author: Michael Albinus Date: Tue Oct 8 15:41:00 2019 +0200 * etc/PROBLEMS: Describe navigation problem from Nautilus. (Bug#37573) * lisp/userlock.el (create-lockfiles): Set `safe-local-variable' property. diff --git a/etc/PROBLEMS b/etc/PROBLEMS index c0d30ae5b4..504570e911 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1183,6 +1183,23 @@ always) doesn't insert the whitespace of the killed and yanked line. The solution is to set the GPaste "trim items" option to OFF. +*** Gnome: Navigation from Nautilus to remote files. + +If you navigate to a file, which belongs to a remote server, in +Nautilus via "Open With Emacs" you might not be able to save this file +once you have modified it in Emacs. The reasons for the failure can +vary, and for some connection methods saving the file might even succeed. + +If the remote connection in Nautilus uses ssh or sftp, you could +mitigate the problem by the following lines in your .emacs file: + +(dir-locals-set-class-variables 'gvfs '((nil . ((create-lockfiles . nil))))) +(dir-locals-set-directory-class (format "/run/user/%d/gvfs" (user-uid)) 'gvfs) + +A better approach might be to avoid navigation from Nautilus to Emacs +for such files, and instead to open the file in Emacs using Tramp +remote file name syntax. + *** KDE: When running on KDE, colors or fonts are not as specified for Emacs, or messed up. diff --git a/lisp/userlock.el b/lisp/userlock.el index f077bc9ad6..209768620c 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -34,6 +34,9 @@ (eval-when-compile (require 'cl-lib)) +;;;###autoload +(put 'create-lockfiles 'safe-local-variable 'booleanp) + (define-error 'file-locked "File is locked" 'file-error) ;;;###autoload commit b12edc61711d383819f0119d9227ad856c4556aa Author: Stefan Monnier Date: Tue Oct 8 09:36:01 2019 -0400 * lisp/emacs-lisp/package.el (package--get-deps): Fix thinko * test/lisp/emacs-lisp/package-tests.el (package-test-get-deps): Adjust test to new calling convention. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 169bcda69f..0b2dc24ebb 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1853,7 +1853,8 @@ if it is still empty." (let ((pkg-desc (cadr (assq pkg package-alist)))) (when pkg-desc (push pkg seen) - (setq pkgs (append (package-desc-reqs pkg-desc) pkgs))))))) + (setq pkgs (append (mapcar #'car (package-desc-reqs pkg-desc)) + pkgs))))))) seen)) (defun package--user-installed-p (package) diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index f450fd27c2..0edb81d6a1 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -654,25 +654,16 @@ Must called from within a `tar-mode' buffer." multi-file-desc new-pkg-desc simple-depend-desc-1 - simple-depend-desc-2)))) - (should - (equal (package--get-deps 'simple-depend) - '(simple-single))) - (should - (equal (package--get-deps 'simple-depend 'indirect) - nil)) - (should - (equal (package--get-deps 'simple-depend 'direct) - '(simple-single))) - (should - (equal (package--get-deps 'simple-depend-2) - '(simple-depend-1 multi-file simple-depend simple-single))) + simple-depend-desc-2))) + (pkg-cmp #'string-lessp)) (should - (equal (package--get-deps 'simple-depend-2 'indirect) - '(simple-depend multi-file simple-single))) + (equal (sort (package--get-deps '(simple-depend)) pkg-cmp) + (sort (list 'simple-depend 'simple-single) pkg-cmp))) (should - (equal (package--get-deps 'simple-depend-2 'direct) - '(simple-depend-1 multi-file))))) + (equal (sort (package--get-deps '(simple-depend-2)) pkg-cmp) + (sort (list 'simple-depend-2 'simple-depend-1 'multi-file + 'simple-depend 'simple-single) + pkg-cmp))))) (ert-deftest package-test-sort-by-dependence () "Test `package--sort-by-dependence' with complex structures." commit bdb04e9dd182436a08fc80d5f7bda6432439271a Author: Eli Zaretskii Date: Tue Oct 8 16:13:21 2019 +0300 Fix aborts when opening a new font after face-cache reset * src/font.c (font_open_for_lface): Make sure the default face is realized before using its height for the font to be open. (Bug#37637) diff --git a/src/font.c b/src/font.c index 935dd64e64..6bc977fd68 100644 --- a/src/font.c +++ b/src/font.c @@ -3314,6 +3314,10 @@ font_open_for_lface (struct frame *f, Lisp_Object entity, Lisp_Object *attrs, Li pt = XFIXNUM (attrs[LFACE_HEIGHT_INDEX]); else { + /* We need the default face to be valid below. */ + if (FRAME_FACE_CACHE (f)->used == 0) + recompute_basic_faces (f); + struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID); Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX]; eassert (FIXNUMP (height)); commit 005ed494950bb370598883307b801ff73cbea9db Author: Michael Albinus Date: Tue Oct 8 11:48:08 2019 +0200 * INSTALL: Describe installation of source and debug packages. (Bug#37527) diff --git a/INSTALL b/INSTALL index 86f9e0080c..d159f2ef9a 100644 --- a/INSTALL +++ b/INSTALL @@ -206,7 +206,7 @@ need to compile it. For example, to compile Emacs with support for X and graphics libraries, you may need to install the X development package(s), and development versions of the jpeg, png, etc. packages. -The names of the packages that you need varies according to the +The names of the packages that you need vary according to the GNU/Linux distribution that you use, and the options that you want to configure Emacs with. On Debian-based systems, you can install all the packages needed to build the installed version of Emacs with a command @@ -214,6 +214,42 @@ like 'apt-get build-dep emacs' (on older systems, replace 'emacs' with eg 'emacs25'). On Red Hat-based systems, the corresponding command is 'dnf builddep emacs' (on older systems, use 'yum-builddep' instead). +* GNU/Linux source and debug packages + +Many GNU/Linux systems provide separate packages containing the +sources and debug symbols of Emacs. They are useful if you want to +check the source code of Emacs primitive functions or debug Emacs on +the C level. + +The names of the packages that you need vary according to the +GNU/Linux distribution that you use. On Debian-based systems, you can +install a source package of Emacs with a command like 'apt-get source +emacs' (on older systems, replace 'emacs' with eg 'emacs25'). The +target directory for unpacking the source tree is the current +directory. On Red Hat-based systems, the corresponding command is +'dnf install emacs-debugsource', with target directory /usr/src/debug +(this requires to add the *-debuginfo repositories first, via 'dnf +config-manager --set-enabled fedora-debuginfo updates-debuginfo'). + +Once you have installed the source package, for example at +/path/to/emacs-26.1, add the following line to your startup file: + + (setq find-function-C-source-directory + "/path/to/emacs-26.1/src") + +The installation directory of the Emacs source package will contain +the exact package name and version number Emacs is installed on your +system. If a new Emacs package is installed, the source package must +be reinstalled as well, and the setting in your startup file must be +updated. + +Emacs debugging symbols are distributed by a debug package. It does +not exist for every released Emacs package, this depends on the +distribution. On Debian-based systems, you can install a debug +package of Emacs with a command like 'apt-get install emacs-dbg' (on +older systems, replace 'emacs' with eg 'emacs25'). On Red Hat-based +systems, the corresponding command is 'dnf debuginfo-install emacs'. + DETAILED BUILDING AND INSTALLATION: