commit 1d42f4800bc3759ac961b97b2a66d4b73e520eb5 (HEAD, refs/remotes/origin/master) Author: Jim Porter Date: Fri Apr 9 09:57:06 2021 +0200 Fix hostname completion on MS Windows * lisp/net/tramp.el (tramp-completion-file-name-regexp-default): Handle volume letter being added to paths for file name completion on W32 systems. This fixes hostname (and method) autocomplete on W32. Copyright-paperwork-exempt: yes diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b2c650f6e1..e61c3b1e44 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1078,7 +1078,13 @@ initial value is overwritten by the car of `tramp-file-name-structure'.") (defconst tramp-completion-file-name-regexp-default (concat - "\\`/\\(" + "\\`" + ;; `file-name-completion' uses absolute paths for matching. This + ;; means that on W32 systems, something like "/ssh:host:~/path" + ;; becomes "c:/ssh:host:~/path". See also `tramp-drop-volume-letter'. + (when (eq system-type 'windows-nt) + "\\(?:[[:alpha:]]:\\)?") + "/\\(" ;; Optional multi hop. "\\([^/|:]+:[^/|:]*|\\)*" ;; Last hop. commit dfdec267aece1e3b4da378d347b6d18d52366060 Author: Stefan Monnier Date: Thu Apr 8 22:55:04 2021 -0400 * test/lisp/shadowfile-tests.el: Fix recent test failures (shadow--tests-cleanup): `shadow-hashtable` is now a hash table (duh!). diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index 0c2d7123dd..7b9c2ff63b 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -117,8 +117,8 @@ (ignore-errors (delete-file shadow-info-file)) (ignore-errors (delete-file shadow-todo-file)) ;; Reset variables. + (shadow-invalidate-hashtable) (setq shadow-info-buffer nil - shadow-hashtable nil shadow-todo-buffer nil shadow-files-to-copy nil)) commit 9a604501f04a430b0b48af500b7c177e0c30d633 Author: Stefan Kangas Date: Fri Apr 9 01:42:41 2021 +0200 Revert "Load all generic-x.el modes unconditionally" This reverts commit 0161c9df6edc02db6bd8871b00df522dd0699157. diff --git a/etc/NEWS b/etc/NEWS index 8d7b3a6c46..a0f05d8cf1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2408,11 +2408,6 @@ parameter. 'previous-system-time-locale' have been removed, as they were created by mistake and were not useful to Lisp code. ---- -** Loading 'generic-x' unconditionally loads all modes. -The user option 'generic-extras-enable-list' is now obsolete, and -setting it has no effect. - --- ** The 'load-dangerous-libraries' variable is now obsolete. It was used to allow loading Lisp libraries compiled by XEmacs, a diff --git a/lisp/generic-x.el b/lisp/generic-x.el index 0f4e1ae4a6..4505d8513f 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -32,6 +32,17 @@ ;; ;; (require 'generic-x) ;; +;; You can decide which modes to load by setting the variable +;; `generic-extras-enable-list'. Its default value is platform- +;; specific. The recommended way to set this variable is through +;; customize: +;; +;; M-x customize-option RET generic-extras-enable-list RET +;; +;; This lets you select generic modes from the list of available +;; modes. If you manually set `generic-extras-enable-list' in your +;; .emacs, do it BEFORE loading generic-x with (require 'generic-x). +;; ;; You can also send in new modes; if the file types are reasonably ;; common, we would like to install them. ;; @@ -173,7 +184,88 @@ This hook will be installed if the variable ;; Other Generic modes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; If you add a generic mode to this file, put it in one of these four +;; lists as well. + +(defconst generic-default-modes + '(apache-conf-generic-mode + apache-log-generic-mode + hosts-generic-mode + java-manifest-generic-mode + java-properties-generic-mode + javascript-generic-mode + show-tabs-generic-mode + vrml-generic-mode) + "List of generic modes that are defined by default.") + +(defconst generic-mswindows-modes + '(bat-generic-mode + inf-generic-mode + ini-generic-mode + rc-generic-mode + reg-generic-mode + rul-generic-mode) + "List of generic modes that are defined by default on MS-Windows.") + +(defconst generic-unix-modes + '(alias-generic-mode + ansible-inventory-generic-mode + etc-fstab-generic-mode + etc-modules-conf-generic-mode + etc-passwd-generic-mode + etc-services-generic-mode + etc-sudoers-generic-mode + fvwm-generic-mode + inetd-conf-generic-mode + mailagent-rules-generic-mode + mailrc-generic-mode + named-boot-generic-mode + named-database-generic-mode + prototype-generic-mode + resolve-conf-generic-mode + samba-generic-mode + x-resource-generic-mode + xmodmap-generic-mode) + "List of generic modes that are defined by default on Unix.") + +(defconst generic-other-modes + '(astap-generic-mode + ibis-generic-mode + pkginfo-generic-mode + spice-generic-mode) + "List of generic modes that are not defined by default.") + +(defcustom generic-extras-enable-list + (append generic-default-modes + (if (memq system-type '(windows-nt ms-dos)) + generic-mswindows-modes + generic-unix-modes) + nil) + "List of generic modes to define. +Each entry in the list should be a symbol. If you set this variable +directly, without using customize, you must reload generic-x to put +your changes into effect." + :type (let (list) + (dolist (mode + (sort (append generic-default-modes + generic-mswindows-modes + generic-unix-modes + generic-other-modes + nil) + (lambda (a b) + (string< (symbol-name b) + (symbol-name a)))) + (cons 'set list)) + (push `(const ,mode) list))) + :set (lambda (s v) + (set-default s v) + (unless load-in-progress + (load "generic-x"))) + :version "22.1") + ;;; Apache +(when (memq 'apache-conf-generic-mode generic-extras-enable-list) + (define-generic-mode apache-conf-generic-mode '(?#) nil @@ -186,7 +278,9 @@ This hook will be installed if the variable '((nil "^\\([-A-Za-z0-9_]+\\)" 1) ("*Directories*" "^\\s-*]+\\)>" 1) ("*Locations*" "^\\s-*]+\\)>" 1))))) - "Generic mode for Apache or HTTPD configuration files.") + "Generic mode for Apache or HTTPD configuration files.")) + +(when (memq 'apache-log-generic-mode generic-extras-enable-list) (define-generic-mode apache-log-generic-mode nil @@ -197,9 +291,11 @@ This hook will be installed if the variable (2 font-lock-variable-name-face))) '("access_log\\'") nil - "Generic mode for Apache log files.") + "Generic mode for Apache log files.")) ;;; Samba +(when (memq 'samba-generic-mode generic-extras-enable-list) + (define-generic-mode samba-generic-mode '(?\; ?#) nil @@ -209,11 +305,13 @@ This hook will be installed if the variable (2 font-lock-type-face))) '("smb\\.conf\\'") '(generic-bracket-support) - "Generic mode for Samba configuration files.") + "Generic mode for Samba configuration files.")) ;;; Fvwm ;; This is pretty basic. Also, modes for other window managers could ;; be defined as well. +(when (memq 'fvwm-generic-mode generic-extras-enable-list) + (define-generic-mode fvwm-generic-mode '(?#) '("AddToMenu" @@ -232,28 +330,33 @@ This hook will be installed if the variable nil '("\\.fvwmrc\\'" "\\.fvwm2rc\\'") nil - "Generic mode for FVWM configuration files.") + "Generic mode for FVWM configuration files.")) ;;; X Resource ;; I'm pretty sure I've seen an actual mode to do this, but I don't ;; think it's standard with Emacs +(when (memq 'x-resource-generic-mode generic-extras-enable-list) + (define-generic-mode x-resource-generic-mode '(?!) nil '(("^\\([^:\n]+:\\)" 1 font-lock-variable-name-face)) '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'") nil - "Generic mode for X Resource configuration files.") + "Generic mode for X Resource configuration files.")) +(if (memq 'xmodmap-generic-mode generic-extras-enable-list) (define-generic-mode xmodmap-generic-mode '(?!) '("add" "clear" "keycode" "keysym" "remove" "pointer") nil '("[xX]modmap\\(rc\\)?\\'") nil - "Simple mode for xmodmap files.") + "Simple mode for xmodmap files.")) ;;; Hosts +(when (memq 'hosts-generic-mode generic-extras-enable-list) + (define-generic-mode hosts-generic-mode '(?#) '("localhost") @@ -261,20 +364,27 @@ This hook will be installed if the variable ("\\<\\([0-9A-Fa-f:]+\\)\\>" 1 font-lock-constant-face)) '("[hH][oO][sS][tT][sS]\\'") nil - "Generic mode for HOSTS files.") + "Generic mode for HOSTS files.")) ;;; Windows INF files +;; If i-g-m-f-f-h is defined, then so is i-g-m. +(declare-function ini-generic-mode "generic-x") + +(when (memq 'inf-generic-mode generic-extras-enable-list) + (define-generic-mode inf-generic-mode '(?\;) nil '(("^\\(\\[.*\\]\\)" 1 font-lock-constant-face)) '("\\.[iI][nN][fF]\\'") '(generic-bracket-support) - "Generic mode for MS-Windows INF files.") + "Generic mode for MS-Windows INF files.")) ;;; Windows INI files ;; Should define escape character as well! +(when (memq 'ini-generic-mode generic-extras-enable-list) + (define-generic-mode ini-generic-mode '(?\;) nil @@ -301,9 +411,13 @@ like an INI file. You can add this hook to `find-file-hook'." (goto-char (point-min)) (and (looking-at "^\\s-*\\[.*\\]") (ini-generic-mode))))) +(define-obsolete-function-alias 'generic-mode-ini-file-find-file-hook + 'ini-generic-mode-find-file-hook "28.1")) ;;; Windows REG files ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax! +(when (memq 'reg-generic-mode generic-extras-enable-list) + (define-generic-mode reg-generic-mode '(?\;) '("key" "classes_root" "REGEDIT" "REGEDIT4") @@ -314,11 +428,19 @@ like an INI file. You can add this hook to `find-file-hook'." (lambda () (setq imenu-generic-expression '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))) - "Generic mode for MS-Windows Registry files.") + "Generic mode for MS-Windows Registry files.")) + +(declare-function w32-shell-name "w32-fns" ()) + +;;; DOS/Windows BAT files +(when (memq 'bat-generic-mode generic-extras-enable-list) + (define-obsolete-function-alias 'bat-generic-mode 'bat-mode "24.4")) ;;; Mailagent ;; Mailagent is a Unix mail filtering program. Anyone wanna do a ;; generic mode for procmail? +(when (memq 'mailagent-rules-generic-mode generic-extras-enable-list) + (define-generic-mode mailagent-rules-generic-mode '(?#) '("SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT") @@ -329,9 +451,11 @@ like an INI file. You can add this hook to `find-file-hook'." (lambda () (setq imenu-generic-expression '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))) - "Generic mode for Mailagent rules files.") + "Generic mode for Mailagent rules files.")) ;; Solaris/Sys V prototype files +(when (memq 'prototype-generic-mode generic-extras-enable-list) + (define-generic-mode prototype-generic-mode '(?#) nil @@ -350,9 +474,11 @@ like an INI file. You can add this hook to `find-file-hook'." (2 font-lock-variable-name-face))) '("prototype\\'") nil - "Generic mode for Sys V prototype files.") + "Generic mode for Sys V prototype files.")) ;; Solaris/Sys V pkginfo files +(when (memq 'pkginfo-generic-mode generic-extras-enable-list) + (define-generic-mode pkginfo-generic-mode '(?#) nil @@ -361,9 +487,17 @@ like an INI file. You can add this hook to `find-file-hook'." (2 font-lock-variable-name-face))) '("pkginfo\\'") nil - "Generic mode for Sys V pkginfo files.") + "Generic mode for Sys V pkginfo files.")) + +;; Javascript mode +;; Obsolete; defer to js-mode from js.el. +(when (memq 'javascript-generic-mode generic-extras-enable-list) + (define-obsolete-function-alias 'javascript-generic-mode 'js-mode "24.3") + (define-obsolete-variable-alias 'javascript-generic-mode-hook 'js-mode-hook "24.3")) ;; VRML files +(when (memq 'vrml-generic-mode generic-extras-enable-list) + (define-generic-mode vrml-generic-mode '(?#) '("DEF" @@ -411,9 +545,11 @@ like an INI file. You can add this hook to `find-file-hook'." ("*Definitions*" "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{" 1))))) - "Generic Mode for VRML files.") + "Generic Mode for VRML files.")) ;; Java Manifests +(when (memq 'java-manifest-generic-mode generic-extras-enable-list) + (define-generic-mode java-manifest-generic-mode '(?#) '("Name" @@ -430,9 +566,11 @@ like an INI file. You can add this hook to `find-file-hook'." (2 font-lock-constant-face))) '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'") nil - "Generic mode for Java Manifest files.") + "Generic mode for Java Manifest files.")) ;; Java properties files +(when (memq 'java-properties-generic-mode generic-extras-enable-list) + (define-generic-mode java-properties-generic-mode '(?! ?#) nil @@ -458,9 +596,11 @@ like an INI file. You can add this hook to `find-file-hook'." (lambda () (setq imenu-generic-expression '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))) - "Generic mode for Java properties files.") + "Generic mode for Java properties files.")) ;; C shell alias definitions +(when (memq 'alias-generic-mode generic-extras-enable-list) + (define-generic-mode alias-generic-mode '(?#) '("alias" "unalias") @@ -473,9 +613,11 @@ like an INI file. You can add this hook to `find-file-hook'." (lambda () (setq imenu-generic-expression '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))) - "Generic mode for C Shell alias files.") + "Generic mode for C Shell alias files.")) ;; Ansible inventory files +(when (memq 'ansible-inventory-generic-mode generic-extras-enable-list) + (define-generic-mode ansible-inventory-generic-mode '(?#) nil @@ -494,10 +636,12 @@ like an INI file. You can add this hook to `find-file-hook'." (setq imenu-generic-expression '((nil "^\\s-*\\[\\(.*\\)\\]" 1) ("*Variables*" "\\s-+\\([^ =\n\r]+\\)=" 1))))) - "Generic mode for Ansible inventory files.") + "Generic mode for Ansible inventory files.")) ;;; Windows RC files ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira) +(when (memq 'rc-generic-mode generic-extras-enable-list) + (define-generic-mode rc-generic-mode ;; '(?\/) '("//") @@ -577,13 +721,15 @@ like an INI file. You can add this hook to `find-file-hook'." '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))) - '("\\.[rR][cC]\\'") - nil - "Generic mode for MS-Windows Resource files.") + '("\\.[rR][cC]\\'") + nil + "Generic mode for MS-Windows Resource files.")) ;; InstallShield RUL files ;; Contributed by Alfred.Correira@Pervasive.Com ;; Bugfixes by "Rolf Sandau" +(when (memq 'rul-generic-mode generic-extras-enable-list) + (eval-when-compile ;;; build the regexp strings using regexp-opt @@ -1226,9 +1372,11 @@ like an INI file. You can add this hook to `find-file-hook'." > "begin" \n > _ \n resume: - > "end;") + > "end;")) ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira) +(when (memq 'mailrc-generic-mode generic-extras-enable-list) + (define-generic-mode mailrc-generic-mode '(?#) '("alias" @@ -1250,9 +1398,11 @@ like an INI file. You can add this hook to `find-file-hook'." (2 font-lock-variable-name-face))) '("\\.mailrc\\'") nil - "Mode for mailrc files.") + "Mode for mailrc files.")) ;; Inetd.conf +(when (memq 'inetd-conf-generic-mode generic-extras-enable-list) + (define-generic-mode inetd-conf-generic-mode '(?#) '("stream" @@ -1267,9 +1417,11 @@ like an INI file. You can add this hook to `find-file-hook'." (list (lambda () (setq imenu-generic-expression - '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))) + '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))) ;; Services +(when (memq 'etc-services-generic-mode generic-extras-enable-list) + (define-generic-mode etc-services-generic-mode '(?#) '("tcp" @@ -1282,9 +1434,11 @@ like an INI file. You can add this hook to `find-file-hook'." (list (lambda () (setq imenu-generic-expression - '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))))) + '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))) ;; Password and Group files +(when (memq 'etc-passwd-generic-mode generic-extras-enable-list) + (define-generic-mode etc-passwd-generic-mode nil ;; No comment characters '("root") ;; Only one keyword @@ -1322,9 +1476,11 @@ like an INI file. You can add this hook to `find-file-hook'." (list (lambda () (setq imenu-generic-expression - '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))))) + '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))) ;; Fstab +(when (memq 'etc-fstab-generic-mode generic-extras-enable-list) + (define-generic-mode etc-fstab-generic-mode '(?#) '("adfs" @@ -1436,9 +1592,11 @@ like an INI file. You can add this hook to `find-file-hook'." (list (lambda () (setq imenu-generic-expression - '((nil "^\\([^# \t]+\\)\\s-+" 1)))))) + '((nil "^\\([^# \t]+\\)\\s-+" 1))))))) ;; /etc/sudoers +(when (memq 'etc-sudoers-generic-mode generic-extras-enable-list) + (define-generic-mode etc-sudoers-generic-mode '(?#) '("User_Alias" "Runas_Alias" "Host_Alias" "Cmnd_Alias" @@ -1449,9 +1607,11 @@ like an INI file. You can add this hook to `find-file-hook'." ("\\<\\(%[A-Za-z0-9_]+\\)\\>" 1 font-lock-variable-name-face)) '("/etc/sudoers\\'") nil - "Generic mode for sudoers configuration files.") + "Generic mode for sudoers configuration files.")) ;; From Jacques Duthen +(when (memq 'show-tabs-generic-mode generic-extras-enable-list) + (eval-when-compile (defconst show-tabs-generic-mode-font-lock-defaults-1 @@ -1489,12 +1649,14 @@ like an INI file. You can add this hook to `find-file-hook'." nil ;; no auto-mode-alist ;; '(show-tabs-generic-mode-hook-fun) nil - "Generic mode to show tabs and trailing spaces.") + "Generic mode to show tabs and trailing spaces.")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DNS modes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(when (memq 'named-boot-generic-mode generic-extras-enable-list) + (define-generic-mode named-boot-generic-mode ;; List of comment characters '(?\;) @@ -1510,7 +1672,9 @@ like an INI file. You can add this hook to `find-file-hook'." ;; List of additional automode-alist expressions '("/etc/named\\.boot\\'") ;; List of set up functions to call - nil) + nil)) + +(when (memq 'named-database-generic-mode generic-extras-enable-list) (define-generic-mode named-database-generic-mode ;; List of comment characters @@ -1531,7 +1695,9 @@ like an INI file. You can add this hook to `find-file-hook'." (defun named-database-print-serial () "Print a serial number based on the current date." (interactive) - (insert (format-time-string named-database-time-string))) + (insert (format-time-string named-database-time-string)))) + +(when (memq 'resolve-conf-generic-mode generic-extras-enable-list) (define-generic-mode resolve-conf-generic-mode ;; List of comment characters @@ -1543,12 +1709,14 @@ like an INI file. You can add this hook to `find-file-hook'." ;; List of additional auto-mode-alist expressions '("/etc/resolve?\\.conf\\'") ;; List of set up functions to call - nil) + nil)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Modes for spice and common electrical engineering circuit netlist formats ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(when (memq 'spice-generic-mode generic-extras-enable-list) + (define-generic-mode spice-generic-mode nil '("and" @@ -1584,7 +1752,9 @@ like an INI file. You can add this hook to `find-file-hook'." ;; Make keywords case-insensitive (lambda () (setq font-lock-defaults '(generic-font-lock-keywords nil t)))) - "Generic mode for SPICE circuit netlist files.") + "Generic mode for SPICE circuit netlist files.")) + +(when (memq 'ibis-generic-mode generic-extras-enable-list) (define-generic-mode ibis-generic-mode '(?|) @@ -1593,7 +1763,9 @@ like an INI file. You can add this hook to `find-file-hook'." ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 font-lock-variable-name-face)) '("\\.[iI][bB][sS]\\'") '(generic-bracket-support) - "Generic mode for IBIS circuit netlist files.") + "Generic mode for IBIS circuit netlist files.")) + +(when (memq 'astap-generic-mode generic-extras-enable-list) (define-generic-mode astap-generic-mode nil @@ -1627,7 +1799,9 @@ like an INI file. You can add this hook to `find-file-hook'." ;; Make keywords case-insensitive (lambda () (setq font-lock-defaults '(generic-font-lock-keywords nil t)))) - "Generic mode for ASTAP circuit netlist files.") + "Generic mode for ASTAP circuit netlist files.")) + +(when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list) (define-generic-mode etc-modules-conf-generic-mode ;; List of comment characters @@ -1669,98 +1843,7 @@ like an INI file. You can add this hook to `find-file-hook'." ;; List of additional automode-alist expressions '("/etc/modules\\.conf" "/etc/conf\\.modules") ;; List of set up functions to call - nil) - -;; Obsolete - -(define-obsolete-function-alias 'javascript-generic-mode #'js-mode "24.3") -(define-obsolete-variable-alias 'javascript-generic-mode-hook 'js-mode-hook "24.3") - -(define-obsolete-function-alias 'bat-generic-mode #'bat-mode "24.4") - -(define-obsolete-function-alias 'generic-mode-ini-file-find-file-hook - #'ini-generic-mode-find-file-hook "28.1") - -(defconst generic-default-modes - '(apache-conf-generic-mode - apache-log-generic-mode - hosts-generic-mode - java-manifest-generic-mode - java-properties-generic-mode - javascript-generic-mode - show-tabs-generic-mode - vrml-generic-mode) - "List of generic modes that are defined by default.") -(make-obsolete-variable 'generic-default-modes "no longer used." "28.1") - -(defconst generic-mswindows-modes - '(bat-generic-mode - inf-generic-mode - ini-generic-mode - rc-generic-mode - reg-generic-mode - rul-generic-mode) - "List of generic modes that are defined by default on MS-Windows.") -(make-obsolete-variable 'generic-mswindows-modes "no longer used." "28.1") - -(defconst generic-unix-modes - '(alias-generic-mode - ansible-inventory-generic-mode - etc-fstab-generic-mode - etc-modules-conf-generic-mode - etc-passwd-generic-mode - etc-services-generic-mode - etc-sudoers-generic-mode - fvwm-generic-mode - inetd-conf-generic-mode - mailagent-rules-generic-mode - mailrc-generic-mode - named-boot-generic-mode - named-database-generic-mode - prototype-generic-mode - resolve-conf-generic-mode - samba-generic-mode - x-resource-generic-mode - xmodmap-generic-mode) - "List of generic modes that are defined by default on Unix.") -(make-obsolete-variable 'generic-unix-modes "no longer used." "28.1") - -(defconst generic-other-modes - '(astap-generic-mode - ibis-generic-mode - pkginfo-generic-mode - spice-generic-mode) - "List of generic modes that are not defined by default.") -(make-obsolete-variable 'generic-other-modes "no longer used." "28.1") - -(defcustom generic-extras-enable-list - (append generic-default-modes - (if (memq system-type '(windows-nt ms-dos)) - generic-mswindows-modes - generic-unix-modes) - nil) - "List of generic modes to define. -Each entry in the list should be a symbol. If you set this variable -directly, without using customize, you must reload generic-x to put -your changes into effect." - :type (let (list) - (dolist (mode - (sort (append generic-default-modes - generic-mswindows-modes - generic-unix-modes - generic-other-modes - nil) - (lambda (a b) - (string< (symbol-name b) - (symbol-name a)))) - (cons 'set list)) - (push `(const ,mode) list))) - :set (lambda (s v) - (set-default s v) - (unless load-in-progress - (load "generic-x"))) - :version "22.1") -(make-obsolete-variable 'generic-extras-enable-list "no longer used." "28.1") + nil)) (provide 'generic-x) commit a4575655d271353a70287c497cf81efd4b8beb82 Author: Stefan Monnier Date: Thu Apr 8 19:34:57 2021 -0400 * lisp/shadowfile.el: Use lexical-binding Delete redundant `:group` args. (shadow-hashtable): Make it an actual hash-table. (shadow-shadows-of, shadow-invalidate-hashtable): Adjust accordingly. (shadow-insert-var): Strength-reduce `eval` to `symbol-value`. (shadow--save-buffers-kill-emacs): New function extracted from `shadow-save-buffers-kill-emacs`. (shadow-save-buffers-kill-emacs): Use it and use `save-buffers-kill-emacs`. (shadow-initialize, shadowfile-unload-function): Use `advice-add/remove` rather than override `save-buffers-kill-emacs` with `defalias`. diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el index b5e7d444c5..f39f17329f 100644 --- a/lisp/shadowfile.el +++ b/lisp/shadowfile.el @@ -1,4 +1,4 @@ -;;; shadowfile.el --- automatic file copying +;;; shadowfile.el --- automatic file copying -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc. @@ -90,27 +90,23 @@ "If t, always copy shadow files without asking. If nil (the default), always ask. If not nil and not t, ask only if there is no buffer currently visiting the file." - :type '(choice (const t) (const nil) (other :tag "Ask if no buffer" maybe)) - :group 'shadow) + :type '(choice (const t) (const nil) (other :tag "Ask if no buffer" maybe))) (defcustom shadow-inhibit-message nil "If non-nil, do not display a message when a file needs copying." - :type 'boolean - :group 'shadow) + :type 'boolean) (defcustom shadow-inhibit-overload nil "If non-nil, shadowfile won't redefine \\[save-buffers-kill-emacs]. Normally it overloads the function `save-buffers-kill-emacs' to check for files that have been changed and need to be copied to other systems." - :type 'boolean - :group 'shadow) + :type 'boolean) (defcustom shadow-info-file (locate-user-emacs-file "shadows" ".shadows") "File to keep shadow information in. The `shadow-info-file' should be shadowed to all your accounts to ensure consistency. Default: ~/.emacs.d/shadows" :type 'file - :group 'shadow :version "26.2") (defcustom shadow-todo-file @@ -122,13 +118,12 @@ remember and ask you again in your next Emacs session. This file must NOT be shadowed to any other system, it is host-specific. Default: ~/.emacs.d/shadow_todo" :type 'file - :group 'shadow :version "26.2") -;;; The following two variables should in most cases initialize themselves -;;; correctly. They are provided as variables in case the defaults are wrong -;;; on your machine (and for efficiency). +;; The following two variables should in most cases initialize themselves +;; correctly. They are provided as variables in case the defaults are wrong +;; on your machine (and for efficiency). (defvar shadow-system-name (concat "/" (system-name) ":") "The identification for local files on this machine.") @@ -160,7 +155,7 @@ created by `shadow-define-regexp-group'.") (defvar shadow-files-to-copy nil) ; List of files that need to ; be copied to remote hosts. -(defvar shadow-hashtable nil) ; for speed +(defvar shadow-hashtable (make-hash-table :test #'equal)) ; for speed (defvar shadow-info-buffer nil) ; buf visiting shadow-info-file (defvar shadow-todo-buffer nil) ; buf visiting shadow-todo-file @@ -191,11 +186,11 @@ PREFIX." ;;; Clusters and sites ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; I use the term `site' to refer to a string which may be the -;;; cluster identification "/name:", a remote identification -;;; "/method:user@host:", or "/system-name:" (the value of -;;; `shadow-system-name') for the location of local files. All -;;; user-level commands should accept either. +;; I use the term `site' to refer to a string which may be the +;; cluster identification "/name:", a remote identification +;; "/method:user@host:", or "/system-name:" (the value of +;; `shadow-system-name') for the location of local files. All +;; user-level commands should accept either. (cl-defstruct (shadow-cluster (:type list) :named) name primary regexp) @@ -580,7 +575,7 @@ be shadowed), and list of SITES." Filename should have clusters expanded, but otherwise can have any format. Return value is a list of dotted pairs like (from . to), where from and to are absolute file names." - (or (symbol-value (intern-soft file shadow-hashtable)) + (or (gethash file shadow-hashtable) (let* ((absolute-file (shadow-expand-file-name (or (shadow-local-file file) file) shadow-homedir)) @@ -598,7 +593,7 @@ and to are absolute file names." "shadow-shadows-of: %s %s %s %s %s" file (shadow-local-file file) shadow-homedir absolute-file canonical-file)) - (set (intern file shadow-hashtable) shadows)))) + (puthash file shadows shadow-hashtable)))) (defun shadow-shadows-of-1 (file groups regexp) "Return list of FILE's shadows in GROUPS. @@ -735,7 +730,7 @@ With non-nil argument also saves the buffer." (sit-for 1)))))) (defun shadow-invalidate-hashtable () - (setq shadow-hashtable (make-vector 37 0))) + (clrhash shadow-hashtable)) (defun shadow-insert-var (variable) "Build a `setq' to restore VARIABLE. @@ -744,17 +739,17 @@ will restore VARIABLE to its current setting. VARIABLE must be the name of a variable whose value is a list." (let ((standard-output (current-buffer))) (insert (format "(setq %s" variable)) - (cond ((consp (eval variable)) + (cond ((consp (symbol-value variable)) (insert "\n '(") - (prin1 (car (eval variable))) - (let ((rest (cdr (eval variable)))) + (prin1 (car (symbol-value variable))) + (let ((rest (cdr (symbol-value variable)))) (while rest (insert "\n ") (prin1 (car rest)) (setq rest (cdr rest))) (insert "))\n\n"))) (t (insert " ") - (prin1 (eval variable)) + (prin1 (symbol-value variable)) (insert ")\n\n"))))) (defun shadow-save-buffers-kill-emacs (&optional arg) @@ -763,6 +758,11 @@ With prefix arg, silently save all file-visiting buffers, then kill. Extended by shadowfile to automatically save `shadow-todo-file' and look for files that have been changed and need to be copied to other systems." + (interactive "P") + (shadow--save-buffers-kill-emacs arg) + (save-buffers-kill-emacs arg)) + +(defun shadow--save-buffers-kill-emacs (&optional arg &rest _) ;; This function is necessary because we need to get control and save ;; the todo file /after/ saving other files, but /before/ the warning ;; message about unsaved buffers (because it can get modified by the @@ -770,27 +770,10 @@ look for files that have been changed and need to be copied to other systems." ;; because it is not called at the correct time, and also because it is ;; called when the terminal is disconnected and we cannot ask whether ;; to copy files. - (interactive "P") (shadow-save-todo-file) (save-some-buffers arg t) (shadow-copy-files) - (shadow-save-todo-file) - (and (or (not (memq t (mapcar (lambda (buf) (and (buffer-file-name buf) - (buffer-modified-p buf))) - (buffer-list)))) - (yes-or-no-p "Modified buffers exist; exit anyway? ")) - (or (not (fboundp 'process-list)) - ;; `process-list' is not defined on MSDOS. - (let ((processes (process-list)) - active) - (while processes - (and (memq (process-status (car processes)) '(run stop open listen)) - (process-query-on-exit-flag (car processes)) - (setq active t)) - (setq processes (cdr processes))) - (or (not active) - (yes-or-no-p "Active processes exist; kill them and exit anyway? ")))) - (kill-emacs))) + (shadow-save-todo-file)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Hook us up @@ -809,19 +792,15 @@ look for files that have been changed and need to be copied to other systems." (message "Shadowfile information files not found - aborting") (beep) (sit-for 3)) - (when (and (not shadow-inhibit-overload) - (not (fboundp 'shadow-orig-save-buffers-kill-emacs))) - (defalias 'shadow-orig-save-buffers-kill-emacs - (symbol-function 'save-buffers-kill-emacs)) - (defalias 'save-buffers-kill-emacs 'shadow-save-buffers-kill-emacs)) - (add-hook 'write-file-functions 'shadow-add-to-todo) - (define-key ctl-x-4-map "s" 'shadow-copy-files))) + (unless shadow-inhibit-overload + (advice-add 'save-buffers-kill-emacs :before + #'shadow--save-buffers-kill-emacs)) + (add-hook 'write-file-functions #'shadow-add-to-todo) + (define-key ctl-x-4-map "s" #'shadow-copy-files))) (defun shadowfile-unload-function () - (substitute-key-definition 'shadow-copy-files nil ctl-x-4-map) - (when (fboundp 'shadow-orig-save-buffers-kill-emacs) - (fset 'save-buffers-kill-emacs - (symbol-function 'shadow-orig-save-buffers-kill-emacs))) + (substitute-key-definition #'shadow-copy-files nil ctl-x-4-map) + (advice-remove 'save-buffers-kill-emacs #'shadow--save-buffers-kill-emacs) ;; continue standard unloading nil) commit 3492cc36f23c99344a6533a5ba4c6080b10d35a1 Author: Stefan Kangas Date: Fri Apr 9 00:04:13 2021 +0200 Remove redundant #' before lambda in {calendar,erc,mh-e}/*.el * lisp/calendar/icalendar.el (icalendar--get-most-recent-observance): * lisp/calendar/parse-time.el (parse-time-rules): * lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): * lisp/erc/erc-track.el (erc-modified-channels-display): * lisp/erc/erc.el (erc-toggle-debug-irc-protocol) (erc-cmd-IGNORE, erc-cmd-JOIN, erc-default-server-handler) (erc-banlist-update): * lisp/mh-e/mh-search.el (mh-search, mh-mairix-convert-to-sop*) (mh-index-create-sequences): * lisp/mh-e/mh-thread.el (mh-toggle-threads, mh-thread-generate) (mh-thread-prune-containers, mh-thread-sort-containers): * lisp/mh-e/mh-utils.el (mh-sub-folders): Remove redundant #' before lambda. diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 04b525efc8..6eb086aa14 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -581,19 +581,19 @@ ALIST is a VTIMEZONE potentially containing historical records." (list (car (sort components - #'(lambda (a b) - (let* ((get-recent (lambda (n) - (car - (sort - (delq nil - (mapcar (lambda (p) - (and (memq (car p) '(DTSTART RDATE)) - (car (cddr p)))) - n)) - 'string-greaterp)))) - (a-recent (funcall get-recent (car (cddr a)))) - (b-recent (funcall get-recent (car (cddr b))))) - (string-greaterp a-recent b-recent)))))))) + (lambda (a b) + (let* ((get-recent (lambda (n) + (car + (sort + (delq nil + (mapcar (lambda (p) + (and (memq (car p) '(DTSTART RDATE)) + (car (cddr p)))) + n)) + 'string-greaterp)))) + (a-recent (funcall get-recent (car (cddr a)))) + (b-recent (funcall get-recent (car (cddr b))))) + (string-greaterp a-recent b-recent)))))))) (defun icalendar--convert-all-timezones (icalendar) "Convert all timezones in the ICALENDAR into an alist. diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el index aa3236cf25..5a3d2706af 100644 --- a/lisp/calendar/parse-time.el +++ b/lisp/calendar/parse-time.el @@ -103,46 +103,46 @@ letters, digits, plus or minus signs or colons." ((4) parse-time-months) ((5) (100)) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 8) - (= (aref parse-time-elt 2) ?:) - (= (aref parse-time-elt 5) ?:))) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 8) + (= (aref parse-time-elt 2) ?:) + (= (aref parse-time-elt 5) ?:))) [0 2] [3 5] [6 8]) ((8 7) parse-time-zoneinfo - ,#'(lambda () (car parse-time-val)) - ,#'(lambda () (cadr parse-time-val))) + ,(lambda () (car parse-time-val)) + ,(lambda () (cadr parse-time-val))) ((8) - ,#'(lambda () - (and (stringp parse-time-elt) - (= 5 (length parse-time-elt)) - (or (= (aref parse-time-elt 0) ?+) - (= (aref parse-time-elt 0) ?-)))) - ,#'(lambda () (* 60 (+ (cl-parse-integer parse-time-elt :start 3 :end 5) - (* 60 (cl-parse-integer parse-time-elt :start 1 :end 3))) - (if (= (aref parse-time-elt 0) ?-) -1 1)))) + ,(lambda () + (and (stringp parse-time-elt) + (= 5 (length parse-time-elt)) + (or (= (aref parse-time-elt 0) ?+) + (= (aref parse-time-elt 0) ?-)))) + ,(lambda () (* 60 (+ (cl-parse-integer parse-time-elt :start 3 :end 5) + (* 60 (cl-parse-integer parse-time-elt :start 1 :end 3))) + (if (= (aref parse-time-elt 0) ?-) -1 1)))) ((5 4 3) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 10) - (= (aref parse-time-elt 4) ?-) - (= (aref parse-time-elt 7) ?-))) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 10) + (= (aref parse-time-elt 4) ?-) + (= (aref parse-time-elt 7) ?-))) [0 4] [5 7] [8 10]) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 5) - (= (aref parse-time-elt 2) ?:))) - [0 2] [3 5] ,#'(lambda () 0)) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 5) + (= (aref parse-time-elt 2) ?:))) + [0 2] [3 5] ,(lambda () 0)) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 4) - (= (aref parse-time-elt 1) ?:))) - [0 1] [2 4] ,#'(lambda () 0)) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 4) + (= (aref parse-time-elt 1) ?:))) + [0 1] [2 4] ,(lambda () 0)) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 7) - (= (aref parse-time-elt 1) ?:))) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 7) + (= (aref parse-time-elt 1) ?:))) [0 1] [2 4] [5 7]) - ((5) (50 110) ,#'(lambda () (+ 1900 parse-time-elt))) - ((5) (0 49) ,#'(lambda () (+ 2000 parse-time-elt)))) + ((5) (50 110) ,(lambda () (+ 1900 parse-time-elt))) + ((5) (0 49) ,(lambda () (+ 2000 parse-time-elt)))) "(slots predicate extractor...)") ;;;###autoload(put 'parse-time-rules 'risky-local-variable t) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 234b4b5a71..219af3741f 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -415,33 +415,33 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc." (pcase (intern (downcase (pcomplete-arg 1))) ('chat (mapcar (lambda (elt) (plist-get elt :nick)) (cl-remove-if-not - #'(lambda (elt) - (eq (plist-get elt :type) 'CHAT)) + (lambda (elt) + (eq (plist-get elt :type) 'CHAT)) erc-dcc-list))) ('close (delete-dups (mapcar (lambda (elt) (symbol-name (plist-get elt :type))) erc-dcc-list))) ('get (mapcar #'erc-dcc-nick (cl-remove-if-not - #'(lambda (elt) - (eq (plist-get elt :type) 'GET)) + (lambda (elt) + (eq (plist-get elt :type) 'GET)) erc-dcc-list))) ('send (pcomplete-erc-all-nicks)))) (pcomplete-here (pcase (intern (downcase (pcomplete-arg 2))) ('get (mapcar (lambda (elt) (plist-get elt :file)) (cl-remove-if-not - #'(lambda (elt) - (and (eq (plist-get elt :type) 'GET) - (erc-nick-equal-p (erc-extract-nick - (plist-get elt :nick)) - (pcomplete-arg 1)))) + (lambda (elt) + (and (eq (plist-get elt :type) 'GET) + (erc-nick-equal-p (erc-extract-nick + (plist-get elt :nick)) + (pcomplete-arg 1)))) erc-dcc-list))) ('close (mapcar #'erc-dcc-nick (cl-remove-if-not - #'(lambda (elt) - (eq (plist-get elt :type) - (intern (upcase (pcomplete-arg 1))))) + (lambda (elt) + (eq (plist-get elt :type) + (intern (upcase (pcomplete-arg 1))))) erc-dcc-list))) ('send (pcomplete-entries))))) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 8be5555882..9985b6a02f 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -686,9 +686,9 @@ Use `erc-make-mode-line-buffer-name' to create buttons." (let* ((buffers (mapcar #'car erc-modified-channels-alist)) (counts (mapcar #'cadr erc-modified-channels-alist)) (faces (mapcar #'cddr erc-modified-channels-alist)) - (long-names (mapcar #'(lambda (buf) - (or (buffer-name buf) - "")) + (long-names (mapcar (lambda (buf) + (or (buffer-name buf) + "")) buffers)) (short-names (if (functionp erc-track-shorten-function) (funcall erc-track-shorten-function diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 2f6e48dce1..f0144de844 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2321,7 +2321,7 @@ If ARG is non-nil, show the *erc-protocol* buffer." (use-local-map (make-sparse-keymap)) (local-set-key (kbd "t") 'erc-toggle-debug-irc-protocol)) (add-hook 'kill-buffer-hook - #'(lambda () (setq erc-debug-irc-protocol nil)) + (lambda () (setq erc-debug-irc-protocol nil)) nil 'local) (goto-char (point-max)) (let ((inhibit-read-only t)) @@ -2945,9 +2945,9 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." (if (null (erc-with-server-buffer erc-ignore-list)) (erc-display-line (erc-make-notice "Ignore list is empty") 'active) (erc-display-line (erc-make-notice "Ignore list:") 'active) - (mapc #'(lambda (item) - (erc-display-line (erc-make-notice item) - 'active)) + (mapc (lambda (item) + (erc-display-line (erc-make-notice item) + 'active)) (erc-with-server-buffer erc-ignore-list)))) t) @@ -3129,8 +3129,8 @@ were most recently invited. See also `invitation'." (when chnl ;; Prevent double joining of same channel on same server. (let* ((joined-channels - (mapcar #'(lambda (chanbuf) - (with-current-buffer chanbuf (erc-default-target))) + (mapcar (lambda (chanbuf) + (with-current-buffer chanbuf (erc-default-target))) (erc-channel-list erc-server-process))) (server (with-current-buffer (process-buffer erc-server-process) (or erc-session-server erc-server-announced-name))) @@ -4149,9 +4149,9 @@ Displays PROC and PARSED appropriately using `erc-display-message'." (mapconcat #'identity (let (res) - (mapc #'(lambda (x) - (if (stringp x) - (setq res (append res (list x))))) + (mapc (lambda (x) + (if (stringp x) + (setq res (append res (list x))))) parsed) res) " "))) @@ -4539,10 +4539,10 @@ See also: `erc-echo-notice-in-user-buffers', ;; Remove the unbanned masks from the ban list (setq erc-channel-banlist (cl-delete-if - #'(lambda (y) - (member (upcase (cdr y)) - (mapcar #'upcase - (cdr (split-string mode))))) + (lambda (y) + (member (upcase (cdr y)) + (mapcar #'upcase + (cdr (split-string mode))))) erc-channel-banlist))) ((string-match "^\\+" mode) ;; Add the banned mask(s) to the ban list diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index aece03ef0f..cb8f8e3455 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -274,23 +274,23 @@ folder containing the index search results." t))) ;; Copy the search results over. - (maphash #'(lambda (folder msgs) - (let ((cur (car (mh-translate-range folder "cur"))) - (msgs (sort (cl-loop - for msg being the hash-keys of msgs - collect msg) - #'<))) - (mh-exec-cmd "refile" msgs "-src" folder - "-link" index-folder) - ;; Restore cur to old value, that refile changed - (when cur - (mh-exec-cmd-quiet nil "mark" folder "-add" "-zero" - "-sequence" - "cur" (format "%s" cur))) - (cl-loop for msg in msgs - do (cl-incf result-count) - (setf (gethash result-count origin-map) - (cons folder msg))))) + (maphash (lambda (folder msgs) + (let ((cur (car (mh-translate-range folder "cur"))) + (msgs (sort (cl-loop + for msg being the hash-keys of msgs + collect msg) + #'<))) + (mh-exec-cmd "refile" msgs "-src" folder + "-link" index-folder) + ;; Restore cur to old value, that refile changed + (when cur + (mh-exec-cmd-quiet nil "mark" folder "-add" "-zero" + "-sequence" + "cur" (format "%s" cur))) + (cl-loop for msg in msgs + do (cl-incf result-count) + (setf (gethash result-count origin-map) + (cons folder msg))))) folder-results-map) ;; Vist the results folder. @@ -1136,10 +1136,10 @@ REGEXP-LIST is an alist of fields and values." ((atom (cadr expr)) `(or (and ,expr))) ((eq (caadr expr) 'not) (mh-mairix-convert-to-sop* (cadadr expr))) ((eq (caadr expr) 'and) (mh-mairix-convert-to-sop* - `(or ,@(mapcar #'(lambda (x) `(not ,x)) + `(or ,@(mapcar (lambda (x) `(not ,x)) (cdadr expr))))) ((eq (caadr expr) 'or) (mh-mairix-convert-to-sop* - `(and ,@(mapcar #'(lambda (x) `(not ,x)) + `(and ,@(mapcar (lambda (x) `(not ,x)) (cdadr expr))))) (t (error "Unreachable: %s" expr)))) @@ -1620,7 +1620,7 @@ garbled." (cl-loop for seq in seq-list do (apply #'mh-exec-cmd "mark" mh-current-folder "-sequence" (symbol-name (car seq)) "-add" - (mapcar #'(lambda (x) (format "%s" x)) (cdr seq)))))) + (mapcar (lambda (x) (format "%s" x)) (cdr seq)))))) ;;;###mh-autoload (defun mh-create-sequence-map (seq-list) diff --git a/lisp/mh-e/mh-thread.el b/lisp/mh-e/mh-thread.el index a7878aaae9..01b6863038 100644 --- a/lisp/mh-e/mh-thread.el +++ b/lisp/mh-e/mh-thread.el @@ -233,7 +233,7 @@ sibling." (push index msg-list))) (forward-line)) (mh-scan-folder mh-current-folder - (mapcar #'(lambda (x) (format "%s" x)) + (mapcar (lambda (x) (format "%s" x)) (mh-coalesce-msg-list msg-list)) t)) (when mh-index-data @@ -591,7 +591,7 @@ Only information about messages in MSG-LIST are added to the tree." #'call-process (expand-file-name mh-scan-prog mh-progs) nil '(t nil) nil "-width" "10000" "-format" "%(msg)\n%{message-id}\n%{references}\n%{in-reply-to}\n%{subject}\n" - folder (mapcar #'(lambda (x) (format "%s" x)) msg-list))) + folder (mapcar (lambda (x) (format "%s" x)) msg-list))) (goto-char (point-min)) (let ((roots ()) (case-fold-search t)) @@ -635,9 +635,9 @@ Only information about messages in MSG-LIST are added to the tree." (mh-thread-remove-parent-link id) (mh-thread-add-link (car ancestors) id))) (mh-thread-add-link (car ancestors) (cadr ancestors))))))) - (maphash #'(lambda (_k v) - (when (null (mh-container-parent v)) - (push v roots))) + (maphash (lambda (_k v) + (when (null (mh-container-parent v)) + (push v roots))) mh-thread-id-table) (setq roots (mh-thread-prune-containers roots)) (prog1 (setq roots (mh-thread-group-by-subject roots)) @@ -720,25 +720,25 @@ For now it will take the last string inside angles." mh-thread-history) (mh-thread-remove-parent-link node))))) (let ((results ())) - (maphash #'(lambda (_k v) - (when (and (null (mh-container-parent v)) - (gethash (mh-message-id (mh-container-message v)) - mh-thread-id-index-map)) - (push v results))) + (maphash (lambda (_k v) + (when (and (null (mh-container-parent v)) + (gethash (mh-message-id (mh-container-message v)) + mh-thread-id-index-map)) + (push v results))) mh-thread-id-table) (mh-thread-sort-containers results)))) (defun mh-thread-sort-containers (containers) "Sort a list of message CONTAINERS to be in ascending order wrt index." (sort containers - #'(lambda (x y) - (when (and (mh-container-message x) (mh-container-message y)) - (let* ((id-x (mh-message-id (mh-container-message x))) - (id-y (mh-message-id (mh-container-message y))) - (index-x (gethash id-x mh-thread-id-index-map)) - (index-y (gethash id-y mh-thread-id-index-map))) - (and (integerp index-x) (integerp index-y) - (< index-x index-y))))))) + (lambda (x y) + (when (and (mh-container-message x) (mh-container-message y)) + (let* ((id-x (mh-message-id (mh-container-message x))) + (id-y (mh-message-id (mh-container-message y))) + (index-x (gethash id-x mh-thread-id-index-map)) + (index-y (gethash id-y mh-thread-id-index-map))) + (and (integerp index-x) (integerp index-y) + (< index-x index-y))))))) (defvar mh-thread-last-ancestor) diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index be66e62a1d..e73c1db9e4 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -544,8 +544,8 @@ nested folders within them." (mh-sub-folders-actual folder))) (t match)))) (if add-trailing-slash-flag - (mapcar #'(lambda (x) - (if (cdr x) (cons (concat (car x) "/") (cdr x)) x)) + (mapcar (lambda (x) + (if (cdr x) (cons (concat (car x) "/") (cdr x)) x)) sub-folders) sub-folders))) commit ff796823e50a97761ba20796753eb6606e7d016c Author: Gregory Heytings Date: Wed Apr 7 16:58:51 2021 +0000 Terminate isearch when point has moved to another buffer * lisp/isearch.el (isearch-post-command-hook): Terminate isearch when the command just executed has moved point to another buffer. https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg00309.html diff --git a/lisp/isearch.el b/lisp/isearch.el index 1ac1e63a9b..5efac4c78f 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3054,6 +3054,10 @@ See more for options in `search-exit-option'." (goto-char isearch-pre-move-point)) (isearch-search-and-update))) (setq isearch-pre-move-point nil)) + ;; Terminate the search if point has moved to another buffer. + (unless (eq isearch--current-buffer (current-buffer)) + (when (buffer-live-p isearch--current-buffer) + (with-current-buffer isearch--current-buffer (isearch-exit)))) (force-mode-line-update)) (defun isearch-quote-char (&optional count) commit 972bab0981fb0cc0d992b4a195ebaf33c79858c3 Author: Gregory Heytings Date: Wed Apr 7 17:51:30 2021 +0000 User option to move to another match when changing direction in isearch. * lisp/isearch.el (isearch-direction-change-changes-match): New user option (bug#47599). (isearch-repeat): Use the new option. (isearch-repeat-forward, isearch-repeat-backward): Adapt to the new option. * etc/NEWS: Mention the new user option. * doc/emacs/search.texi: Document the new user option. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index f3c42bcea7..38430a2ab1 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -201,6 +201,14 @@ something before the starting point, type @kbd{C-r} to switch to a backward search, leaving the search string unchanged. Similarly, @kbd{C-s} in a backward search switches to a forward search. +@cindex search, changing direction +@vindex isearch-repeat-on-direction-change + When you change the direction of a search, the first command you +type will, by default, remain on the same match, and the cursor will +move to the other end of the match. To move to another match +immediately, customize the variable +@code{isearch-repeat-on-direction-change} to @code{t}. + @cindex search, wrapping around @cindex search, overwrapped @cindex wrapped search diff --git a/etc/NEWS b/etc/NEWS index d3a8748ded..8d7b3a6c46 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -367,6 +367,12 @@ trying to be non-destructive. This command opens a new buffer called "*Memory Report*" and gives a summary of where Emacs is using memory currently. ++++ +** New user option 'isearch-repeat-on-direction-change'. +When this option is set, direction changes in Isearch move to another +search match, if there is one, instead of moving point to the other +end of the current match. + ** Outline +++ diff --git a/lisp/isearch.el b/lisp/isearch.el index 4b4f44bdff..1ac1e63a9b 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -185,6 +185,16 @@ When `nil', never wrap, just stop at the last match." (const :tag "Disable wrapping" nil)) :version "28.1") +(defcustom isearch-repeat-on-direction-change nil + "Whether a direction change should move to another match. +When `nil', the default, a direction change moves point to the other +end of the current search match. +When `t', a direction change moves to another search match, if there +is one." + :type '(choice (const :tag "Remain on the same match" nil) + (const :tag "Move to another match" t)) + :version "28.1") + (defvar isearch-mode-hook nil "Function(s) to call after starting up an incremental search.") @@ -1847,6 +1857,8 @@ Use `isearch-exit' to quit without signaling." (funcall isearch-wrap-function) (goto-char (if isearch-forward (point-min) (point-max)))))) ;; C-s in reverse or C-r in forward, change direction. + (if (and isearch-other-end isearch-repeat-on-direction-change) + (goto-char isearch-other-end)) (setq isearch-forward (not isearch-forward) isearch-success t)) @@ -1910,10 +1922,12 @@ of the buffer, type \\[isearch-beginning-of-buffer] with a numeric argument." (cond ((< count 0) (isearch-repeat-backward (abs count)) ;; Reverse the direction back - (isearch-repeat 'forward)) + (let ((isearch-repeat-on-direction-change nil)) + (isearch-repeat 'forward))) (t ;; Take into account one iteration to reverse direction - (when (not isearch-forward) (setq count (1+ count))) + (unless isearch-repeat-on-direction-change + (when (not isearch-forward) (setq count (1+ count)))) (isearch-repeat 'forward count)))) (isearch-repeat 'forward))) @@ -1931,10 +1945,12 @@ of the buffer, type \\[isearch-end-of-buffer] with a numeric argument." (cond ((< count 0) (isearch-repeat-forward (abs count)) ;; Reverse the direction back - (isearch-repeat 'backward)) + (let ((isearch-repeat-on-direction-change nil)) + (isearch-repeat 'backward))) (t ;; Take into account one iteration to reverse direction - (when isearch-forward (setq count (1+ count))) + (unless isearch-repeat-on-direction-change + (when isearch-forward (setq count (1+ count)))) (isearch-repeat 'backward count)))) (isearch-repeat 'backward))) commit b4eb84d4afd1b847f6f4c272d04ffa1f4b36dc98 Author: Juri Linkov Date: Thu Apr 8 21:46:57 2021 +0300 * lisp/repeat.el (repeat-post-hook): Check for prefix-arg. This is instead of checking for a list of argument-related commands that set prefix-arg anyway. diff --git a/lisp/repeat.el b/lisp/repeat.el index 8cbfaa0748..b3c58f2f81 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -382,25 +382,17 @@ When Repeat mode is enabled, and the command symbol has the property named (when rep-map (when (boundp rep-map) (setq rep-map (symbol-value rep-map))) - (let ((prefix-command-p (memq this-original-command - '(universal-argument - universal-argument-more - digit-argument - negative-argument))) - (map (copy-keymap rep-map)) + (let ((map (copy-keymap rep-map)) keys) ;; Exit when the last char is not among repeatable keys, ;; so e.g. `C-x u u' repeats undo, whereas `C-/ u' doesn't. (when (and (zerop (minibuffer-depth)) ; avoid remapping in prompts (or (lookup-key map (this-command-keys-vector)) - prefix-command-p)) - - (when (and repeat-keep-prefix (not prefix-command-p)) - (setq prefix-arg current-prefix-arg)) + prefix-arg)) ;; Messaging - (unless prefix-command-p + (unless prefix-arg (map-keymap (lambda (key _) (push key keys)) map) (let ((mess (format-message "Repeat with %s%s" @@ -419,6 +411,9 @@ When Repeat mode is enabled, and the command symbol has the property named (when repeat-exit-key (define-key map repeat-exit-key 'ignore)) + (when (and repeat-keep-prefix (not prefix-arg)) + (setq prefix-arg current-prefix-arg)) + (set-transient-map map)))))) (setq repeat-map nil)) commit 580c4c6510fca918610c9c0f440a7d21c4702f16 Author: Juri Linkov Date: Thu Apr 8 21:43:35 2021 +0300 * lisp/repeat.el (repeat-post-hook): Skip repeating in minibuffer (bug#47566). (repeat-map): Add docstring. diff --git a/lisp/repeat.el b/lisp/repeat.el index 1830bcc049..8cbfaa0748 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -348,7 +348,11 @@ For example, you can set it to like `isearch-exit'." :group 'convenience :version "28.1") -;;;###autoload (defvar repeat-map nil) +;;;###autoload +(defvar repeat-map nil + "The value of the repeating map for the next command. +A command called from the map can set it again to the same map when +the map can't be set on the command symbol property `repeat-map'.") ;;;###autoload (define-minor-mode repeat-mode @@ -388,8 +392,9 @@ When Repeat mode is enabled, and the command symbol has the property named ;; Exit when the last char is not among repeatable keys, ;; so e.g. `C-x u u' repeats undo, whereas `C-/ u' doesn't. - (when (or (lookup-key map (this-single-command-keys) nil) - prefix-command-p) + (when (and (zerop (minibuffer-depth)) ; avoid remapping in prompts + (or (lookup-key map (this-command-keys-vector)) + prefix-command-p)) (when (and repeat-keep-prefix (not prefix-command-p)) (setq prefix-arg current-prefix-arg)) commit d365c947b53a2a1e4b43ab65922ebfeca23943d1 Author: Stefan Monnier Date: Thu Apr 8 14:44:37 2021 -0400 * lisp/progmodes/vhdl-mode.el: Use progress-reporter This was actually prompted by a backward compatibility problem (because of the use of Emacs-27's `time-convert`). The new code seems to work fine in Emacs-25. It also fixes a minor bug that made the echo area messages of `vhdl-indent-region` compete with those of `indent-region`. (vhdl-progress-info): Delete variable. (vhdl--progress-reporter): New var to replace it. (vhdl-update-progress-info): Delete function. (vhdl-indent-line): Call progress-reporter-update instead. (vhdl-indent-region): Make it an obsolete alias of `indent-region`. Change all users. (vhdl-align-region-groups, vhdl-align-region, vhdl-fix-case-region-1): Use `make-progress-reporter` and `progress-reporter-update`. diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 856432ccf1..f4a39c29ca 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -2864,7 +2864,7 @@ STRING are replaced by `-' and substrings are converted to lower case." (define-key vhdl-mode-map "\C-c\M--" 'vhdl-comment-display-line) (define-key vhdl-mode-map "\C-c\C-i\C-l" 'indent-according-to-mode) (define-key vhdl-mode-map "\C-c\C-i\C-g" 'vhdl-indent-group) - (define-key vhdl-mode-map "\M-\C-\\" 'vhdl-indent-region) + (define-key vhdl-mode-map "\M-\C-\\" 'indent-region) (define-key vhdl-mode-map "\C-c\C-i\C-b" 'vhdl-indent-buffer) (define-key vhdl-mode-map "\C-c\C-a\C-g" 'vhdl-align-group) (define-key vhdl-mode-map "\C-c\C-a\C-a" 'vhdl-align-group) @@ -3575,7 +3575,7 @@ STRING are replaced by `-' and substrings are converted to lower case." ("Indent" ["Line" indent-according-to-mode :keys "C-c C-i C-l"] ["Group" vhdl-indent-group :keys "C-c C-i C-g"] - ["Region" vhdl-indent-region (mark)] + ["Region" indent-region (mark)] ["Buffer" vhdl-indent-buffer :keys "C-c C-i C-b"]) ("Align" ["Group" vhdl-align-group t] @@ -7383,22 +7383,8 @@ only-lines." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Progress reporting -(defvar vhdl-progress-info nil - "Array variable for progress information: 0 begin, 1 end, 2 time.") - -(defun vhdl-update-progress-info (string pos) - "Update progress information." - (when (and vhdl-progress-info (not noninteractive) - (time-less-p vhdl-progress-interval - (time-since (aref vhdl-progress-info 2)))) - (let ((delta (- (aref vhdl-progress-info 1) - (aref vhdl-progress-info 0)))) - (message "%s... (%2d%%)" string - (if (= 0 delta) - 100 - (floor (* 100.0 (- pos (aref vhdl-progress-info 0))) - delta)))) - (aset vhdl-progress-info 2 (time-convert nil 'integer)))) +(defvar vhdl--progress-reporter nil + "Holds the progress reporter data during long running operations.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Indentation commands @@ -7414,7 +7400,7 @@ else indent `correctly'." (cond ;; indent region if region is active ((and (not (featurep 'xemacs)) (use-region-p)) - (vhdl-indent-region (region-beginning) (region-end) nil)) + (indent-region (region-beginning) (region-end) nil)) ;; expand word ((= (char-syntax (preceding-char)) ?w) (let ((case-fold-search (not vhdl-word-completion-case-sensitive)) @@ -7509,25 +7495,17 @@ indentation change." (when (> (- (point-max) pos) (point)) (goto-char (- (point-max) pos)))) (run-hooks 'vhdl-special-indent-hook) - (vhdl-update-progress-info "Indenting" (vhdl-current-line)) + (when vhdl--progress-reporter + (progress-reporter-update vhdl--progress-reporter (point))) shift-amt)) -(defun vhdl-indent-region (beg end &optional column) - "Indent region as VHDL code. -Adds progress reporting to `indent-region'." - (interactive "r\nP") - (when vhdl-progress-interval - (setq vhdl-progress-info (vector (count-lines (point-min) beg) - (count-lines (point-min) end) 0))) - (indent-region beg end column) - (when vhdl-progress-interval (message "Indenting...done")) - (setq vhdl-progress-info nil)) +(define-obsolete-function-alias 'vhdl-indent-region #'indent-region "28.1") (defun vhdl-indent-buffer () "Indent whole buffer as VHDL code. Calls `indent-region' for whole buffer and adds progress reporting." (interactive) - (vhdl-indent-region (point-min) (point-max))) + (indent-region (point-min) (point-max))) (defun vhdl-indent-group () "Indent group of lines between empty lines." @@ -7540,7 +7518,7 @@ Calls `indent-region' for whole buffer and adds progress reporting." (if (re-search-forward vhdl-align-group-separate nil t) (point-marker) (point-max-marker))))) - (vhdl-indent-region beg end))) + (indent-region beg end))) (defun vhdl-indent-sexp (&optional endpos) "Indent each line of the list starting just after point. @@ -7799,18 +7777,21 @@ the token in MATCH." "Align region, treat groups of lines separately." (interactive "r\nP") (save-excursion - (let (orig pos) - (goto-char beg) - (beginning-of-line) - (setq orig (point-marker)) - (setq beg (point)) - (goto-char end) - (setq end (point-marker)) - (untabify beg end) - (unless no-message - (when vhdl-progress-interval - (setq vhdl-progress-info (vector (count-lines (point-min) beg) - (count-lines (point-min) end) 0)))) + (goto-char beg) + (beginning-of-line) + (setq beg (point)) + (goto-char end) + (setq end (point-marker)) + (untabify beg end) + (let ((orig (copy-marker beg)) + pos + (vhdl--progress-reporter + (if no-message + ;; Preserve a potential progress reporter from + ;; when called from `vhdl-align-region' call. + vhdl--progress-reporter + (when vhdl-progress-interval + (make-progress-reporter "Aligning..." beg (copy-marker end)))))) (when (nth 0 vhdl-beautify-options) (vhdl-fixup-whitespace-region beg end t)) (goto-char beg) @@ -7825,19 +7806,21 @@ the token in MATCH." (setq pos (point-marker)) (vhdl-align-region-1 beg pos spacing) (unless no-comments (vhdl-align-inline-comment-region-1 beg pos)) - (vhdl-update-progress-info "Aligning" (vhdl-current-line)) + (when vhdl--progress-reporter + (progress-reporter-update vhdl--progress-reporter (point))) (setq beg (1+ pos)) (goto-char beg)) ;; align last group (when (< beg end) (vhdl-align-region-1 beg end spacing) (unless no-comments (vhdl-align-inline-comment-region-1 beg end)) - (vhdl-update-progress-info "Aligning" (vhdl-current-line)))) + (when vhdl--progress-reporter + (progress-reporter-update vhdl--progress-reporter (point))))) (when vhdl-indent-tabs-mode (tabify orig end)) (unless no-message - (when vhdl-progress-interval (message "Aligning...done")) - (setq vhdl-progress-info nil))))) + (when vhdl--progress-reporter + (progress-reporter-done vhdl--progress-reporter)))))) (defun vhdl-align-region (beg end &optional spacing) "Align region, treat blocks with same indent and argument lists separately." @@ -7848,10 +7831,10 @@ the token in MATCH." ;; align blocks with same indent and argument lists (save-excursion (let ((cur-beg beg) - indent cur-end) - (when vhdl-progress-interval - (setq vhdl-progress-info (vector (count-lines (point-min) beg) - (count-lines (point-min) end) 0))) + indent cur-end + (vhdl--progress-reporter + (when vhdl-progress-interval + (make-progress-reporter "Aligning..." beg (copy-marker end))))) (goto-char end) (setq end (point-marker)) (goto-char cur-beg) @@ -7874,15 +7857,16 @@ the token in MATCH." (= (current-indentation) indent)) (<= (save-excursion (nth 0 (parse-partial-sexp - (point) (vhdl-point 'eol)))) 0)) + (point) (vhdl-point 'eol)))) + 0)) (unless (looking-at "^\\s-*$") (setq cur-end (vhdl-point 'bonl))) (beginning-of-line 2))) ;; align region (vhdl-align-region-groups cur-beg cur-end spacing t t)) (vhdl-align-inline-comment-region beg end spacing noninteractive) - (when vhdl-progress-interval (message "Aligning...done")) - (setq vhdl-progress-info nil))))) + (when vhdl--progress-reporter + (progress-reporter-done vhdl--progress-reporter)))))) (defun vhdl-align-group (&optional spacing) "Align group of lines between empty lines." @@ -8126,7 +8110,8 @@ end of line, do nothing in comments." "Convert all words matching WORD-REGEXP in region to lower or upper case, depending on parameter UPPER-CASE." (let ((case-replace nil) - (last-update 0)) + (pr (when (and count vhdl-progress-interval (not noninteractive)) + (make-progress-reporter "Fixing case..." beg (copy-marker end))))) (vhdl-prepare-search-2 (save-excursion (goto-char end) @@ -8137,14 +8122,8 @@ depending on parameter UPPER-CASE." (if upper-case (upcase-word -1) (downcase-word -1))) - (when (and count vhdl-progress-interval (not noninteractive) - (time-less-p vhdl-progress-interval - (time-since last-update))) - (message "Fixing case... (%2d%s)" - (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg))) - "%") - (setq last-update (time-convert nil 'integer)))) - (goto-char end))))) + (when pr (progress-reporter-update pr (point)))) + (when pr (progress-reporter-done pr)))))) (defun vhdl-fix-case-region (beg end &optional arg) "Convert all VHDL words in region to lower or upper case, depending on @@ -8283,7 +8262,7 @@ case fixing to a region. Calls functions `vhdl-indent-buffer', (replace-match "" nil t))) (when (nth 0 vhdl-beautify-options) (vhdl-fixup-whitespace-region beg end t)) (when (nth 1 vhdl-beautify-options) (vhdl-fix-statement-region beg end)) - (when (nth 2 vhdl-beautify-options) (vhdl-indent-region beg end)) + (when (nth 2 vhdl-beautify-options) (indent-region beg end)) (when (nth 3 vhdl-beautify-options) (let ((vhdl-align-groups t)) (vhdl-align-region beg end))) (when (nth 4 vhdl-beautify-options) (vhdl-fix-case-region beg end)) @@ -12411,7 +12390,7 @@ reflected in a subsequent paste operation." (insert "\n") (setq position (point)) (vhdl-insert-string-or-file vhdl-testbench-declarations) - (vhdl-indent-region position (point))) + (indent-region position (point))) (setq position (point)) (insert "\n\n") (vhdl-comment-display-line) (insert "\n") @@ -12442,7 +12421,7 @@ reflected in a subsequent paste operation." (insert "\n") (setq position (point)) (vhdl-insert-string-or-file vhdl-testbench-statements) - (vhdl-indent-region position (point))) + (indent-region position (point))) (insert "\n") (indent-to vhdl-basic-offset) (unless (eq vhdl-testbench-create-files 'none) @@ -14832,11 +14811,11 @@ if required." "Name of last selected project.") ;; macros must be defined in the file they are used (copied from `speedbar.el') -;;; (defmacro speedbar-with-writable (&rest forms) -;;; "Allow the buffer to be writable and evaluate FORMS." -;;; (list 'let '((inhibit-read-only t)) -;;; (cons 'progn forms))) -;;; (put 'speedbar-with-writable 'lisp-indent-function 0) +;; (defmacro speedbar-with-writable (&rest forms) +;; "Allow the buffer to be writable and evaluate FORMS." +;; (declare (indent 0) (debug t)) +;; (list 'let '((inhibit-read-only t)) +;; (cons 'progn forms))) (declare-function speedbar-extension-list-to-regex "speedbar" (extlist)) (declare-function speedbar-directory-buttons "speedbar" (directory _index)) commit a45493f2596c566de253eca98dfd5b82224ea217 Author: Stefan Monnier Date: Thu Apr 8 14:36:51 2021 -0400 * lisp/array.el: Use lexical-binding diff --git a/lisp/array.el b/lisp/array.el index cd8971bd26..6632da55dd 100644 --- a/lisp/array.el +++ b/lisp/array.el @@ -1,4 +1,4 @@ -;;; array.el --- array editing commands for GNU Emacs +;;; array.el --- array editing commands for GNU Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 1987, 2000-2021 Free Software Foundation, Inc. @@ -769,25 +769,25 @@ Return COLUMN." (defvar array-mode-map (let ((map (make-keymap))) - (define-key map "\M-ad" 'array-display-local-variables) - (define-key map "\M-am" 'array-make-template) - (define-key map "\M-ae" 'array-expand-rows) - (define-key map "\M-ar" 'array-reconfigure-rows) - (define-key map "\M-a=" 'array-what-position) - (define-key map "\M-ag" 'array-goto-cell) - (define-key map "\M-af" 'array-fill-rectangle) - (define-key map "\C-n" 'array-next-row) - (define-key map "\C-p" 'array-previous-row) - (define-key map "\C-f" 'array-forward-column) - (define-key map "\C-b" 'array-backward-column) - (define-key map "\M-n" 'array-copy-down) - (define-key map "\M-p" 'array-copy-up) - (define-key map "\M-f" 'array-copy-forward) - (define-key map "\M-b" 'array-copy-backward) - (define-key map "\M-\C-n" 'array-copy-row-down) - (define-key map "\M-\C-p" 'array-copy-row-up) - (define-key map "\M-\C-f" 'array-copy-column-forward) - (define-key map "\M-\C-b" 'array-copy-column-backward) + (define-key map "\M-ad" #'array-display-local-variables) + (define-key map "\M-am" #'array-make-template) + (define-key map "\M-ae" #'array-expand-rows) + (define-key map "\M-ar" #'array-reconfigure-rows) + (define-key map "\M-a=" #'array-what-position) + (define-key map "\M-ag" #'array-goto-cell) + (define-key map "\M-af" #'array-fill-rectangle) + (define-key map "\C-n" #'array-next-row) + (define-key map "\C-p" #'array-previous-row) + (define-key map "\C-f" #'array-forward-column) + (define-key map "\C-b" #'array-backward-column) + (define-key map "\M-n" #'array-copy-down) + (define-key map "\M-p" #'array-copy-up) + (define-key map "\M-f" #'array-copy-forward) + (define-key map "\M-b" #'array-copy-backward) + (define-key map "\M-\C-n" #'array-copy-row-down) + (define-key map "\M-\C-p" #'array-copy-row-up) + (define-key map "\M-\C-f" #'array-copy-column-forward) + (define-key map "\M-\C-b" #'array-copy-column-backward) map) "Keymap used in array mode.") @@ -815,17 +815,17 @@ in array mode may have different values assigned to the variables. The variables are: Variables you assign: - array-max-row: The number of rows in the array. - array-max-column: The number of columns in the array. - array-columns-per-line: The number of columns in the array + `array-max-row': The number of rows in the array. + `array-max-column': The number of columns in the array. + `array-columns-per-line': The number of columns in the array per line of buffer. - array-field-width: The width of each field, in characters. - array-rows-numbered: A logical variable describing whether to ignore + `array-field-width': The width of each field, in characters. + `array-rows-numbered': A logical variable describing whether to ignore row numbers in the buffer. Variables which are calculated: - array-line-length: The number of characters in a buffer line. - array-lines-per-row: The number of buffer lines used to + `array-line-length': The number of characters in a buffer line. + `array-lines-per-row': The number of buffer lines used to display each row. The following commands are available (an asterisk indicates it may commit 173d49b03ac945b700354f88b34fa61ea4000b42 Author: Michael Albinus Date: Thu Apr 8 16:35:02 2021 +0200 * doc/misc/tramp.texi (Frequently Asked Questions): New item about recentf. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 5ea0275baf..40245acb8e 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -5066,6 +5066,33 @@ path, or somewhere else entirely (including locally). @pxref{Renaming remote files}. +@item +How to prevent @value{tramp} from clearing the @code{recentf-list}? + +When @value{tramp} cleans a connection, it removes the respective +remote file name(s) from @code{recentf-list}. This is needed, because +an unresponsive remote host could trigger @code{recentf} to connect +that host again and again. + +If you find the cleanup disturbing, because the file names in +@code{recentf-list} are precious to you, you could add the following +two forms in your @file{~/.emacs} after loading the @code{tramp} and +@code{recentf} packages: + +@lisp +@group +(remove-hook + 'tramp-cleanup-connection-hook + #'tramp-recentf-cleanup) +@end group +@group +(remove-hook + 'tramp-cleanup-all-connections-hook + #'tramp-recentf-cleanup-all) +@end group +@end lisp + + @item I get a warning @samp{Tramp has been compiled with Emacs a.b, this is Emacs c.d} commit 9e8ac1f5be755a5618792b5b100915c2730c9d61 Author: Michael Albinus Date: Thu Apr 8 12:24:42 2021 +0200 Revert use of powershell in Tramp, there are collateral damages * lisp/net/tramp-sh.el (tramp-methods) : Fix quoting for MS Windows. (tramp-connection-properties): Don't set "encoding-shell". (tramp-actions-before-shell): Remove `tramp-no-job-control-regexp'. (tramp-maybe-open-connection): Revert changes for "encoding-shell". * lisp/net/tramp.el (tramp-no-job-control-regexp): Remove. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b902ee6f35..8db9dd9d82 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -169,7 +169,8 @@ The string is used in `tramp-methods'.") (tramp-login-program "ssh") (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") ("-t" "-t") - ("-o" "RemoteCommand='%l'") ("%h"))) + ("-o" "RemoteCommand=\"%l\"") + ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-login ("-l")) @@ -225,7 +226,8 @@ The string is used in `tramp-methods'.") (tramp-login-program "ssh") (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") ("-t" "-t") - ("-o" "RemoteCommand='%l'") ("%h"))) + ("-o" "RemoteCommand=\"%l\"") + ("%h"))) (tramp-async-args (("-q"))) (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-login ("-l")) @@ -389,14 +391,7 @@ The string is used in `tramp-methods'.") (regexp-opt '("rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp")) "\\'") - nil ,(user-login-name))) - - ;; MS Windows Openssh client does not cooperate well with cmdproxy. - (when-let ((encoding-shell - (and (eq system-type 'windows-nt) (executable-find "powershell")))) - (add-to-list 'tramp-connection-properties - `(,(regexp-opt '("/sshx:" "/scpx:")) - "encoding-shell" ,encoding-shell)))) + nil ,(user-login-name)))) ;;;###tramp-autoload (defconst tramp-completion-function-alist-rsh @@ -491,7 +486,6 @@ shell from reading its init file." '((tramp-login-prompt-regexp tramp-action-login) (tramp-password-prompt-regexp tramp-action-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) - (tramp-no-job-control-regexp tramp-action-permission-denied) (shell-prompt-pattern tramp-action-succeed) (tramp-shell-prompt-pattern tramp-action-succeed) (tramp-yesno-prompt-regexp tramp-action-yesno) @@ -4804,6 +4798,8 @@ connection if a previous connection has died for some reason." (setenv "HISTSIZE" "0")))) (setenv "PROMPT_COMMAND") (setenv "PS1" tramp-initial-end-of-output) + (unless (stringp tramp-encoding-shell) + (tramp-error vec 'file-error "`tramp-encoding-shell' not set")) (let* ((current-host tramp-system-name) (target-alist (tramp-compute-multi-hops vec)) ;; We will apply `tramp-ssh-controlmaster-options' @@ -4815,23 +4811,17 @@ connection if a previous connection has died for some reason." ;; W32 systems. (process-coding-system-alist nil) (coding-system-for-read nil) - (encoding-shell - (tramp-get-connection-property - vec "encoding-shell" tramp-encoding-shell)) - (extra-args (tramp-get-sh-extra-args encoding-shell)) + (extra-args (tramp-get-sh-extra-args tramp-encoding-shell)) ;; This must be done in order to avoid our file ;; name handler. (p (let ((default-directory (tramp-compat-temporary-file-directory))) - (unless (stringp encoding-shell) - (tramp-error - vec 'file-error "`tramp-encoding-shell' not set")) (apply #'start-process (tramp-get-connection-name vec) (tramp-get-connection-buffer vec) (append - (list encoding-shell) + (list tramp-encoding-shell) (and extra-args (split-string extra-args)) (and tramp-encoding-command-interactive (list tramp-encoding-command-interactive))))))) @@ -4850,7 +4840,8 @@ connection if a previous connection has died for some reason." ;; Check whether process is alive. (tramp-barf-if-no-shell-prompt - p 10 "Couldn't find local shell prompt for %s" encoding-shell) + p 10 + "Couldn't find local shell prompt for %s" tramp-encoding-shell) ;; Now do all the connections as specified. (while target-alist @@ -4925,7 +4916,7 @@ connection if a previous connection has died for some reason." ?c (format-spec options (format-spec-make ?t tmpfile)) ?l (concat remote-shell " " extra-args " -i")) ;; A restricted shell does not allow "exec". - (when r-shell '("; exit"))) + (when r-shell '("&&" "exit" "||" "exit"))) " ")) ;; Send the command. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 99955b5459..b2c650f6e1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -691,15 +691,6 @@ The regexp should match at end of buffer." :version "27.1" :type 'regexp) -;; Powershell requires "ssh -t -t" for terminal emulation. If it -;; doesn't fit, there is an error. -(defcustom tramp-no-job-control-regexp - (regexp-quote "Thus no job control in this shell.") - "Regular expression matching powershell's job control message. -The regexp should match at end of buffer." - :version "28.1" - :type 'regexp) - (defcustom tramp-operation-not-permitted-regexp (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*" (regexp-opt '("Operation not permitted") t))