commit 6de79542e43ece9a12ebc032c275a6c3fee0b73b (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Mon Apr 12 22:49:48 2021 -0400 * lisp/comint.el: Add `font-lock-face` to `rear-nonsticky` (comint--prompt-rear-nonsticky): New const. (comint-send-input, comint-output-filter): Use it. diff --git a/lisp/comint.el b/lisp/comint.el index 2745c5a26f..ef34174305 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1797,6 +1797,10 @@ Ignore duplicates if `comint-input-ignoredups' is non-nil." (min size (- comint-input-ring-size size))))) (ring-insert comint-input-ring cmd))) +(defconst comint--prompt-rear-nonsticky + '(field inhibit-line-move-field-capture read-only font-lock-face) + "Text properties we set on the prompt and don't want to leak past it.") + (defun comint-send-input (&optional no-newline artificial) "Send input to process. After the process output mark, sends all text from the process mark to @@ -1916,8 +1920,8 @@ Similarly for Soar, Scheme, etc." (unless (or no-newline comint-use-prompt-regexp) ;; Cover the terminating newline (add-text-properties end (1+ end) - '(rear-nonsticky - (field inhibit-line-move-field-capture read-only) + `(rear-nonsticky + ,comint--prompt-rear-nonsticky field boundary inhibit-line-move-field-capture t))))) @@ -2124,10 +2128,10 @@ Make backspaces delete the previous character." (unless comint-use-prompt-regexp (with-silent-modifications (add-text-properties comint-last-output-start (point) - '(front-sticky + `(rear-nonsticky + ,comint--prompt-rear-nonsticky + front-sticky (field inhibit-line-move-field-capture) - rear-nonsticky - (field inhibit-line-move-field-capture read-only) field output inhibit-line-move-field-capture t)))) @@ -2157,8 +2161,8 @@ Make backspaces delete the previous character." 'font-lock-face 'comint-highlight-prompt) (add-text-properties prompt-start (point) - '(rear-nonsticky - (field inhibit-line-move-field-capture read-only)))) + `(rear-nonsticky + ,comint--prompt-rear-nonsticky))) (goto-char saved-point))))))) (defun comint-preinput-scroll-to-bottom () commit 214dfbfea0cc7d64704aa4a258da542435c44cbb Author: Stefan Monnier Date: Mon Apr 12 21:55:50 2021 -0400 Don't version-control generated file `grammat-wy.el` This file is needed for CEDET's bootstrap, tho, so we now keep a copy of it under version control in `gram-wy-boot.el`, very much like we do with the `ldefs-boot.el` copy of `loaddefs.el`. * lisp/cedet/semantic/grm-wy-boot.el: Rename from `lisp/cedet/semantic/grammar-wy.el`. * lisp/cedet/semantic/grammar.el: Load `grm-wy-boot.el` if `grammar-wy.el` hasn't been generated yet. * admin/update_autogen: Also refresh `grm-wy-boot.el`. * admin/grammars/Makefile.in (WISENT): Add `grammar-wy.el` to the generated files. * .gitignore: Add `grammar-wy.el`. diff --git a/.gitignore b/.gitignore index a1e3cb92f8..c262f39126 100644 --- a/.gitignore +++ b/.gitignore @@ -88,6 +88,7 @@ lisp/cedet/semantic/wisent/javat-wy.el lisp/cedet/semantic/wisent/js-wy.el lisp/cedet/semantic/wisent/python-wy.el lisp/cedet/srecode/srt-wy.el +lisp/cedet/semantic/grammar-wy.el lisp/eshell/esh-groups.el lisp/finder-inf.el lisp/leim/ja-dic/ diff --git a/admin/grammars/Makefile.in b/admin/grammars/Makefile.in index 35ce55461f..4172411e03 100644 --- a/admin/grammars/Makefile.in +++ b/admin/grammars/Makefile.in @@ -51,14 +51,11 @@ BOVINE = \ ${bovinedir}/make-by.el \ ${bovinedir}/scm-by.el -## FIXME Should include this one too: -## ${cedetdir}/semantic/grammar-wy.el -## but semantic/grammar.el (which is what we use to generate grammar-wy.el) -## requires it! https://debbugs.gnu.org/16008 -WISENT = \ - ${wisentdir}/javat-wy.el \ - ${wisentdir}/js-wy.el \ - ${wisentdir}/python-wy.el \ +WISENT = \ + ${cedetdir}/semantic/grammar-wy.el \ + ${wisentdir}/javat-wy.el \ + ${wisentdir}/js-wy.el \ + ${wisentdir}/python-wy.el \ ${cedetdir}/srecode/srt-wy.el ALL = ${BOVINE} ${WISENT} diff --git a/admin/update_autogen b/admin/update_autogen index 35c391da19..11c4313ae3 100755 --- a/admin/update_autogen +++ b/admin/update_autogen @@ -317,7 +317,7 @@ EOF echo "Finding loaddef targets..." find lisp -name '*.el' -exec grep '^;.*generated-autoload-file:' {} + | \ - sed -e '/loaddefs\|esh-groups/d' -e 's|/[^/]*: "|/|' -e 's/"//g' \ + sed -e '/loaddefs\|esh-groups/d' -e 's|/[^/]*: "|/|' -e 's/"//g' \ >| $tempfile || die "Error finding targets" genfiles= @@ -363,17 +363,23 @@ make -C lisp "$@" autoloads EMACS=../src/bootstrap-emacs || die "make src error" ## Ignore comment differences. -[ ! "$lboot_flag" ] || \ +[ ! "$lboot_flag" ] || \ diff -q -I '^;' $ldefs_in $ldefs_out || \ cp $ldefs_in $ldefs_out || die "cp ldefs_boot error" +# Refresh the prebuilt grammar-wy.el +grammar_in=lisp/cedet/semantic/grammar-wy.el +grammar_out=lisp/cedet/semantic/grm-wy-boot.el +make -C admin/grammars/ ../../$grammar_in +cp $grammar_in $grammar_out || die "cp grm_wy_boot error" + echo "Checking status of loaddef files..." ## It probably would be fine to just check+commit lisp/, since ## making autoloads should not effect any other files. But better ## safe than sorry. -modified=$(status $genfiles $ldefs_out) || die +modified=$(status $genfiles $ldefs_out $grammar_out) || die commit "loaddefs" $modified || die "commit error" diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index dba289fdd7..4c3bb6c238 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -31,7 +31,12 @@ (require 'semantic/format) ;; FIXME this is a generated file, but we need to load this file to ;; generate it! -(require 'semantic/grammar-wy) +;; We need `semantic/grammar-wy.el' but we're also needed to generate +;; that file from `grammar.wy', so to break the dependency, we keep +;; a bootstrap copy of `grammar-wy.el' in `grm-wy-boot.el'. See bug#16008. +(eval-and-compile + (unless (require 'semantic/grammar-wy nil t) + (load "semantic/grm-wy-boot"))) (require 'semantic/idle) (require 'help-fns) (require 'semantic/analyze) diff --git a/lisp/cedet/semantic/grammar-wy.el b/lisp/cedet/semantic/grm-wy-boot.el similarity index 100% rename from lisp/cedet/semantic/grammar-wy.el rename to lisp/cedet/semantic/grm-wy-boot.el diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index ec1077d447..641882c902 100644 --- a/lisp/emacs-lisp/eieio-base.el +++ b/lisp/emacs-lisp/eieio-base.el @@ -1,7 +1,6 @@ ;;; eieio-base.el --- Base classes for EIEIO. -*- lexical-binding:t -*- -;;; Copyright (C) 2000-2002, 2004-2005, 2007-2021 Free Software -;;; Foundation, Inc. +;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: OO, lisp commit fc3caa45ef2dcbd5a1c8339f14696589b99888ce Author: Stefan Monnier Date: Mon Apr 12 19:23:45 2021 -0400 * lisp/minibuffer.el (completion-table-with-quoting): Fix bug#47678 diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 5f594679ca..c900b0d7ce 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -488,8 +488,17 @@ for use at QPOS." (qsuffix (cdr action)) (ufull (if (zerop (length qsuffix)) ustring (funcall unquote (concat string qsuffix)))) - (_ (cl-assert (string-prefix-p ustring ufull))) - (usuffix (substring ufull (length ustring))) + ;; If (not (string-prefix-p ustring ufull)) we have a problem: + ;; the unquoting the qfull gives something "unrelated" to ustring. + ;; E.g. "~/" and "/" where "~//" gets unquoted to just "/" (see + ;; bug#47678). + ;; In that case we can't even tell if we're right before the + ;; "/" or right after it (aka if this "/" is from qstring or + ;; from qsuffix), which which usuffix to use is very unclear. + (usuffix (if (string-prefix-p ustring ufull) + (substring ufull (length ustring)) + ;; FIXME: Maybe "" is preferable/safer? + qsuffix)) (boundaries (completion-boundaries ustring table pred usuffix)) (qlboundary (car (funcall requote (car boundaries) string))) (qrboundary (if (zerop (cdr boundaries)) 0 ;Common case. commit 3cb0229d75b1380d7a144e24ad24172497fb931c Author: Wilson Snyder Date: Mon Apr 12 13:36:05 2021 -0400 * lisp/progmodes/verilog-mode.el (vl-memory): Add missing defvar. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 5f8f723f80..2b88120eb9 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -9,7 +9,7 @@ ;; Keywords: languages ;; The "Version" is the date followed by the decimal rendition of the Git ;; commit hex. -;; Version: 2021.03.30.243771231 +;; Version: 2021.04.12.188864585 ;; Yoni Rabkin contacted the maintainer of this ;; file on 19/3/2008, and the maintainer agreed that when a bug is @@ -124,7 +124,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2021-03-30-e87a75f-vpo-GNU" +(defconst verilog-mode-version "2021-04-12-b41d849-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -11561,6 +11561,7 @@ See the example in `verilog-auto-inout-modport'." (defvar vl-cell-type nil "See `verilog-auto-inst'.") ; Prevent compile warning (defvar vl-cell-name nil "See `verilog-auto-inst'.") ; Prevent compile warning +(defvar vl-memory nil "See `verilog-auto-inst'.") ; Prevent compile warning (defvar vl-modport nil "See `verilog-auto-inst'.") ; Prevent compile warning (defvar vl-name nil "See `verilog-auto-inst'.") ; Prevent compile warning (defvar vl-width nil "See `verilog-auto-inst'.") ; Prevent compile warning @@ -12063,6 +12064,7 @@ Lisp Templates: vl-width Width of the input/output port (`3' for [2:0]). May be a (...) expression if bits isn't a constant. vl-dir Direction of the pin input/output/inout/interface. + vl-memory The unpacked array part of the I/O port (`[5:0]'). vl-modport The modport, if an interface with a modport. vl-cell-type Module name/type of the cell (`InstModule'). vl-cell-name Instance name of the cell (`instName'). commit f63da590fdf115ad6173e123fd41dc62accc7704 Author: Stefan Monnier Date: Mon Apr 12 13:01:06 2021 -0400 * lisp/emacs-lisp/smie.el: Fix URL. Remove redundant `:group` args (smie-indent-forward-token): Improve error message. (smie--funcall): New function. (smie-indent-calculate): Use it. diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 994433063c..ab3cb3c5ac 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -57,7 +57,7 @@ ;; ;; SMIE: Weakness is Power! Auto-indentation with incomplete information ;; Stefan Monnier, Journal 2020, volumn 5, issue 1. -;; doi: 10.22152/programming-journal.org/2020/5/1 +;; doi: 10.22152/programming-journal.org/2021/5/1 ;; A good background to understand the development (especially the parts ;; building the 2D precedence tables and then computing the precedence levels @@ -68,7 +68,7 @@ ;; OTOH we had to kill many chickens, read many coffee grounds, and practice ;; untold numbers of black magic spells, to come up with the indentation code. ;; Since then, some of that code has been beaten into submission, but the -;; smie-indent-keyword is still pretty obscure. +;; `smie-indent-keyword' function is still pretty obscure. ;; Conflict resolution: @@ -247,7 +247,7 @@ be either: ;; (exp (exp (or "+" "*" "=" ..) exp)). ;; Basically, make it EBNF (except for the specification of a separator in ;; the repetition, maybe). - (let* ((nts (mapcar 'car bnf)) ;Non-terminals. + (let* ((nts (mapcar #'car bnf)) ;Non-terminals. (first-ops-table ()) (last-ops-table ()) (first-nts-table ()) @@ -266,7 +266,7 @@ be either: (push resolver precs)) (t (error "Unknown resolver %S" resolver)))) (apply #'smie-merge-prec2s over - (mapcar 'smie-precs->prec2 precs)))) + (mapcar #'smie-precs->prec2 precs)))) again) (dolist (rules bnf) (let ((nt (car rules)) @@ -497,7 +497,7 @@ CSTS is a list of pairs representing arcs in a graph." res)) cycle))) (mapconcat - (lambda (elems) (mapconcat 'identity elems "=")) + (lambda (elems) (mapconcat #'identity elems "=")) (append names (list (car names))) " < "))) @@ -567,7 +567,7 @@ PREC2 is a table as returned by `smie-precs->prec2' or ;; Then eliminate trivial constraints iteratively. (let ((i 0)) (while csts - (let ((rhvs (mapcar 'cdr csts)) + (let ((rhvs (mapcar #'cdr csts)) (progress nil)) (dolist (cst csts) (unless (memq (car cst) rhvs) @@ -657,8 +657,8 @@ use syntax-tables to handle them in efficient C code.") Same calling convention as `smie-forward-token-function' except it should move backward to the beginning of the previous token.") -(defalias 'smie-op-left 'car) -(defalias 'smie-op-right 'cadr) +(defalias 'smie-op-left #'car) +(defalias 'smie-op-right #'cadr) (defun smie-default-backward-token () (forward-comment (- (point))) @@ -974,8 +974,7 @@ I.e. a good choice can be: (defcustom smie-blink-matching-inners t "Whether SMIE should blink to matching opener for inner keywords. If non-nil, it will blink not only for \"begin..end\" but also for \"if...else\"." - :type 'boolean - :group 'smie) + :type 'boolean) (defun smie-blink-matching-check (start end) (save-excursion @@ -1141,8 +1140,7 @@ OPENER is non-nil if TOKEN is an opener and nil if it's a closer." (defcustom smie-indent-basic 4 "Basic amount of indentation." - :type 'integer - :group 'smie) + :type 'integer) (defvar smie-rules-function #'ignore "Function providing the indentation rules. @@ -1189,7 +1187,7 @@ designed specifically for use in this function.") (and ;; (looking-at comment-start-skip) ;(bug#16041). (forward-comment (point-max)))))) -(defalias 'smie-rule-hanging-p 'smie-indent--hanging-p) +(defalias 'smie-rule-hanging-p #'smie-indent--hanging-p) (defun smie-indent--hanging-p () "Return non-nil if the current token is \"hanging\". A hanging keyword is one that's at the end of a line except it's not at @@ -1205,7 +1203,7 @@ the beginning of a line." (funcall smie--hanging-eolp-function) (point)))))) -(defalias 'smie-rule-bolp 'smie-indent--bolp) +(defalias 'smie-rule-bolp #'smie-indent--bolp) (defun smie-indent--bolp () "Return non-nil if the current token is the first on the line." (save-excursion (skip-chars-backward " \t") (bolp))) @@ -1421,7 +1419,7 @@ BASE-POS is the position relative to which offsets should be applied." (forward-sexp 1) nil) ((eobp) nil) - (t (error "Bumped into unknown token"))))) + (t (error "Bumped into unknown token: %S" tok))))) (defun smie-indent-backward-token () "Skip token backward and return it, along with its levels." @@ -1810,9 +1808,11 @@ Each function is called with no argument, shouldn't move point, and should return either nil if it has no opinion, or an integer representing the column to which that point should be aligned, if we were to reindent it.") +(defalias 'smie--funcall #'funcall) ;Debugging/tracing convenience indirection. + (defun smie-indent-calculate () "Compute the indentation to use for point." - (run-hook-with-args-until-success 'smie-indent-functions)) + (run-hook-wrapped 'smie-indent-functions #'smie--funcall)) (defun smie-indent-line () "Indent current line using the SMIE indentation engine." @@ -2016,7 +2016,7 @@ value with which to replace it." ;; FIXME improve value-type. :type '(choice (const nil) (alist :key-type symbol)) - :initialize 'custom-initialize-set + :initialize #'custom-initialize-set :set #'smie-config--setter) (defun smie-config-local (rules) commit c42dc493d1af7fd1ba73c64ba481f017858c24f6 Author: Stefan Monnier Date: Mon Apr 12 12:55:52 2021 -0400 * lisp/emacs-lisp/memory-report.el (memory-report--object-size-1): Simplify diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el index ecbca280e5..f4f03133b0 100644 --- a/lisp/emacs-lisp/memory-report.el +++ b/lisp/emacs-lisp/memory-report.el @@ -182,7 +182,7 @@ by counted more than once." (cl-defmethod memory-report--object-size-1 (_ (value symbol)) ;; Don't count global symbols -- makes sizes of lists of symbols too - ;; heavey. + ;; heavy. (if (intern-soft value obarray) 0 (memory-report--size 'symbol))) @@ -214,14 +214,14 @@ by counted more than once." (setf (gethash value counted) t) (when (car value) (cl-incf total (memory-report--object-size counted (car value)))) - (if (cdr value) - (if (consp (cdr value)) - (if (gethash (cdr value) counted) - (setq value nil) - (setq value (cdr value))) - (cl-incf total (memory-report--object-size counted (cdr value))) - (setq value nil)) - (setq value nil))) + (let ((next (cdr value))) + (setq value (when next + (if (consp next) + (unless (gethash next counted) + (cdr value)) + (cl-incf total (memory-report--object-size + counted next)) + nil))))) total)) (cl-defmethod memory-report--object-size-1 (counted (value vector)) commit be75b08f8214545c9991e157e83e1c864503f25c Author: Stefan Monnier Date: Mon Apr 12 12:53:53 2021 -0400 * lisp/emacs-lisp/float-sup.el (pi): Actually mark it as obsolete diff --git a/lisp/emacs-lisp/float-sup.el b/lisp/emacs-lisp/float-sup.el index 4256bd5958..0e86b923c4 100644 --- a/lisp/emacs-lisp/float-sup.el +++ b/lisp/emacs-lisp/float-sup.el @@ -31,6 +31,7 @@ (with-suppressed-warnings ((lexical pi)) (defconst pi float-pi "Obsolete since Emacs-23.3. Use `float-pi' instead.")) +(make-obsolete-variable 'pi 'float-pi "23.3") (internal-make-var-non-special 'pi) (defconst float-e (exp 1) "The value of e (2.7182818...).") commit 0e2cf3b9853bceb74632daa2bd22edb350840d91 Author: Stefan Monnier Date: Mon Apr 12 12:51:28 2021 -0400 * lisp/emacs-lisp/edebug.el (edebug--frame): Move docstring where it belongs diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 365bc74874..cbc4019312 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -4116,12 +4116,12 @@ This should be a list of `edebug---frame' objects.") "Stack frames of the current Edebug Backtrace buffer with instrumentation. This should be a list of `edebug---frame' objects.") -;; Data structure for backtrace frames with information -;; from Edebug instrumentation found in the backtrace. (cl-defstruct (edebug--frame (:constructor edebug--make-frame) (:include backtrace-frame)) + "Data structure for backtrace frames with information +from Edebug instrumentation found in the backtrace." def-name before-index after-index) (defun edebug-pop-to-backtrace () commit 0df37f741679f99bb57da138e61c91a99ed918a5 Author: Stefan Monnier Date: Mon Apr 12 12:49:36 2021 -0400 * lisp/vt-control.el: Avoid `called-interactively-p` (vt-keypad-on, vt-keypad-off): Use the `tell` arg instead. (vt-numlock): Add `tell` arg. diff --git a/lisp/vt-control.el b/lisp/vt-control.el index 0bd5132f7c..bac0069b85 100644 --- a/lisp/vt-control.el +++ b/lisp/vt-control.el @@ -83,26 +83,24 @@ (defun vt-keypad-on (&optional tell) "Turn on the VT applications keypad." - (interactive) + (interactive "p") (send-string-to-terminal "\e=") (setq vt-applications-keypad-p t) - (if (or tell (called-interactively-p 'interactive)) - (message "Applications keypad enabled."))) + (if tell (message "Applications keypad enabled."))) (defun vt-keypad-off (&optional tell) "Turn off the VT applications keypad." (interactive "p") (send-string-to-terminal "\e>") (setq vt-applications-keypad-p nil) - (if (or tell (called-interactively-p 'interactive)) - (message "Applications keypad disabled."))) + (if tell (message "Applications keypad disabled."))) -(defun vt-numlock nil +(defun vt-numlock (&optional tell) "Toggle VT application keypad on and off." - (interactive) + (interactive "p") (if vt-applications-keypad-p - (vt-keypad-off (called-interactively-p 'interactive)) - (vt-keypad-on (called-interactively-p 'interactive)))) + (vt-keypad-off tell) + (vt-keypad-on tell))) (provide 'vt-control) commit cf774fb8cc0404e00e284a75862d95b5cbc1e94d Author: Stefan Monnier Date: Mon Apr 12 12:46:47 2021 -0400 * lisp/files.el (file-modes-number-to-symbolic): Add `filetype` arg. * lisp/tar-mode.el (tar-header-block-summarize): Use it. (tar-grind-file-mode): Declare obsolete. diff --git a/lisp/files.el b/lisp/files.el index 60d6034011..9d9fbe1f06 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7633,6 +7633,9 @@ If CHAR is in [Xugo], the value is taken from FROM (or 0 if omitted)." ;; Rights relative to the previous file modes. ((= char ?X) (if (= (logand from #o111) 0) 0 #o0111)) ((= char ?u) (let ((uright (logand #o4700 from))) + ;; FIXME: These divisions/shifts seem to be right + ;; for the `7' part of the #o4700 mask, but not + ;; for the `4' part. Same below for `g' and `o'. (+ uright (/ uright #o10) (/ uright #o100)))) ((= char ?g) (let ((gright (logand #o2070 from))) (+ gright (/ gright #o10) (* gright #o10)))) @@ -7667,11 +7670,28 @@ as in \"og+rX-w\"." op char-right))) num-rights)) -(defun file-modes-number-to-symbolic (mode) +(defun file-modes-number-to-symbolic (mode &optional filetype) + "Return a string describing a a file's MODE. +For instance, if MODE is #o700, then it produces `-rwx------'. +FILETYPE if provided should be a character denoting the type of file, +such as `?d' for a directory, or `?l' for a symbolic link and will override +the leading `-' char." (string - (if (zerop (logand 8192 mode)) - (if (zerop (logand 16384 mode)) ?- ?d) - ?c) ; completeness + (or filetype + (pcase (lsh mode -12) + ;; POSIX specifies that the file type is included in st_mode + ;; and provides names for the file types but values only for + ;; the permissions (e.g., S_IWOTH=2). + + ;; (#o017 ??) ;; #define S_IFMT 00170000 + (#o014 ?s) ;; #define S_IFSOCK 0140000 + (#o012 ?l) ;; #define S_IFLNK 0120000 + ;; (8 ??) ;; #define S_IFREG 0100000 + (#o006 ?b) ;; #define S_IFBLK 0060000 + (#o004 ?d) ;; #define S_IFDIR 0040000 + (#o002 ?c) ;; #define S_IFCHR 0020000 + (#o001 ?p) ;; #define S_IFIFO 0010000 + (_ ?-))) (if (zerop (logand 256 mode)) ?- ?r) (if (zerop (logand 128 mode)) ?- ?w) (if (zerop (logand 64 mode)) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index d9b2d42193..3f0cca0ab7 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -474,6 +474,7 @@ checksum before doing the check." "Construct a `rw-r--r--' string indicating MODE. MODE should be an integer which is a file mode value. For instance, if mode is #o700, then it produces `rwx------'." + (declare (obsolete file-modes-number-to-symbolic "28.1")) (substring (file-modes-number-to-symbolic mode) 1)) (defun tar-header-block-summarize (tar-hblock &optional mod-p) @@ -489,25 +490,26 @@ For instance, if mode is #o700, then it produces `rwx------'." ;; (ck (tar-header-checksum tar-hblock)) (type (tar-header-link-type tar-hblock)) (link-name (tar-header-link-name tar-hblock))) - (format "%c%c%s %7s/%-7s %7s%s %s%s" + (format "%c%s %7s/%-7s %7s%s %s%s" (if mod-p ?* ? ) - (cond ((or (eq type nil) (eq type 0)) ?-) - ((eq type 1) ?h) ; link - ((eq type 2) ?l) ; symlink - ((eq type 3) ?c) ; char special - ((eq type 4) ?b) ; block special - ((eq type 5) ?d) ; directory - ((eq type 6) ?p) ; FIFO/pipe - ((eq type 20) ?*) ; directory listing - ((eq type 28) ?L) ; next has longname - ((eq type 29) ?M) ; multivolume continuation - ((eq type 35) ?S) ; sparse - ((eq type 38) ?V) ; volume header - ((eq type 55) ?H) ; pax global extended header - ((eq type 72) ?X) ; pax extended header - (t ?\s) - ) - (tar-grind-file-mode mode) + (file-modes-number-to-symbolic + mode + (cond ((or (eq type nil) (eq type 0)) ?-) + ((eq type 1) ?h) ; link + ((eq type 2) ?l) ; symlink + ((eq type 3) ?c) ; char special + ((eq type 4) ?b) ; block special + ((eq type 5) ?d) ; directory + ((eq type 6) ?p) ; FIFO/pipe + ((eq type 20) ?*) ; directory listing + ((eq type 28) ?L) ; next has longname + ((eq type 29) ?M) ; multivolume continuation + ((eq type 35) ?S) ; sparse + ((eq type 38) ?V) ; volume header + ((eq type 55) ?H) ; pax global extended header + ((eq type 72) ?X) ; pax extended header + (t ?\s) + )) (if (= 0 (length uname)) uid uname) (if (= 0 (length gname)) gid gname) size diff --git a/test/manual/indent/scheme.scm b/test/manual/indent/scheme.scm new file mode 100644 index 0000000000..9053a8743e --- /dev/null +++ b/test/manual/indent/scheme.scm @@ -0,0 +1,23 @@ +;; Testing sexp-comments + +(define a #;(hello) there) + +(define a #;1 there) + +(define a #;"asdf" there) + +(define a ;; #;(hello + there) + +(define a #;(hello + there) 2) + +(define a #;(hello + #;(world)) + and) + there) 2) + +(define a #;(hello + #;"asdf" (world + and) + there) 2) commit 9a6523dfd68a17ebf7049d2aae3fd02386d7cb04 Author: Stefan Monnier Date: Mon Apr 12 12:32:07 2021 -0400 * lisp/frame.el (delete-other-frames): Add universal prefix `iconify` arg (frame--current-backround-mode): New function, extracted from `frame-set-background-mode`. Use `color-dark-p`. (frame-set-background-mode): Use it. diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index cd2ff8f3b3..a9d20c543d 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -2628,7 +2628,7 @@ When Emacs gets one of these commands, it generates a @code{delete-frame} event, whose normal definition is a command that calls the function @code{delete-frame}. @xref{Misc Events}. -@deffn Command delete-other-frames &optional frame +@deffn Command delete-other-frames &optional frame iconify This command deletes all frames on @var{frame}'s terminal, except @var{frame}. If @var{frame} uses another frame's minibuffer, that minibuffer frame is left untouched. The argument @var{frame} must @@ -2639,6 +2639,9 @@ this command works by calling @code{delete-frame} with @var{force} This function does not delete any of @var{frame}'s child frames (@pxref{Child Frames}). If @var{frame} is a child frame, it deletes @var{frame}'s siblings only. + +With the prefix argument @var{iconify}, the frames are iconified rather +than deleted. @end deffn diff --git a/etc/NEWS b/etc/NEWS index 88583d952f..320827d881 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -275,6 +275,9 @@ input using the minibuffer. * Editing Changes in Emacs 28.1 ++++ +** A prefix arg now causes 'delete-other-frames' to only iconify frames + +++ ** New command 'execute-extended-command-for-buffer'. This new command, bound to 'M-S-x', works like diff --git a/lisp/frame.el b/lisp/frame.el index 2b6e4a60b8..bca160175a 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -301,7 +301,7 @@ This function runs the abnormal hook `move-frame-functions'." (declare-function tool-bar-mode "tool-bar" (&optional arg)) (declare-function tool-bar-height "xdisp.c" (&optional frame pixelwise)) -(defalias 'tool-bar-lines-needed 'tool-bar-height) +(defalias 'tool-bar-lines-needed #'tool-bar-height) ;; startup.el calls this function after loading the user's init ;; file. Now default-frame-alist and initial-frame-alist contain @@ -690,8 +690,8 @@ is not considered (see `next-frame')." 0)) (select-frame-set-input-focus (selected-frame))) -(defalias 'next-multiframe-window 'next-window-any-frame) -(defalias 'previous-multiframe-window 'previous-window-any-frame) +(defalias 'next-multiframe-window #'next-window-any-frame) +(defalias 'previous-multiframe-window #'previous-window-any-frame) (defun window-system-for-display (display) "Return the window system for DISPLAY. @@ -782,7 +782,7 @@ If DISPLAY is nil, that stands for the selected frame's display." (format "Delete %s frames? " (length frames)) (format "Delete %s ? " (car frames)))))) (error "Abort!") - (mapc 'delete-frame frames) + (mapc #'delete-frame frames) (x-close-connection display)))) (defun make-frame-command () @@ -1162,8 +1162,8 @@ e.g. (mapc \\='frame-set-background-mode (frame-list))." :group 'faces :set #'(lambda (var value) (set-default var value) - (mapc 'frame-set-background-mode (frame-list))) - :initialize 'custom-initialize-changed + (mapc #'frame-set-background-mode (frame-list))) + :initialize #'custom-initialize-changed :type '(choice (const dark) (const light) (const :tag "automatic" nil))) @@ -1176,6 +1176,27 @@ e.g. (mapc \\='frame-set-background-mode (frame-list))." (defvar inhibit-frame-set-background-mode nil) +(defun frame--current-backround-mode (frame) + (let* ((frame-default-bg-mode (frame-terminal-default-bg-mode frame)) + (bg-color (frame-parameter frame 'background-color)) + (tty-type (tty-type frame)) + (default-bg-mode + (if (or (window-system frame) + (and tty-type + (string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)" + tty-type))) + 'light + 'dark))) + (cond (frame-default-bg-mode) + ((equal bg-color "unspecified-fg") ; inverted colors + (if (eq default-bg-mode 'light) 'dark 'light)) + ((not (color-values bg-color frame)) + default-bg-mode) + ((color-dark-p (mapcar (lambda (c) (/ c 65535.0)) + (color-values bg-color frame))) + 'dark) + (t 'light)))) + (defun frame-set-background-mode (frame &optional keep-face-specs) "Set up display-dependent faces on FRAME. Display-dependent faces are those which have different definitions @@ -1184,30 +1205,8 @@ according to the `background-mode' and `display-type' frame parameters. If optional arg KEEP-FACE-SPECS is non-nil, don't recalculate face specs for the new background mode." (unless inhibit-frame-set-background-mode - (let* ((frame-default-bg-mode (frame-terminal-default-bg-mode frame)) - (bg-color (frame-parameter frame 'background-color)) - (tty-type (tty-type frame)) - (default-bg-mode - (if (or (window-system frame) - (and tty-type - (string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)" - tty-type))) - 'light - 'dark)) - (non-default-bg-mode (if (eq default-bg-mode 'light) 'dark 'light)) - (bg-mode - (cond (frame-default-bg-mode) - ((equal bg-color "unspecified-fg") ; inverted colors - non-default-bg-mode) - ((not (color-values bg-color frame)) - default-bg-mode) - ((>= (apply '+ (color-values bg-color frame)) - ;; Just looking at the screen, colors whose - ;; values add up to .6 of the white total - ;; still look dark to me. - (* (apply '+ (color-values "white" frame)) .6)) - 'light) - (t 'dark))) + (let* ((bg-mode + (frame--current-backround-mode frame)) (display-type (cond ((null (window-system frame)) (if (tty-display-color-p frame) 'color 'mono)) @@ -1273,6 +1272,26 @@ the `background-mode' terminal parameter." (intern (downcase bg-resource)))) (terminal-parameter frame 'background-mode))) +;; FIXME: This needs to be significantly improved before we can use it: +;; - Fix the "scope" to be consistent: the code below is partly per-frame +;; and partly all-frames :-( +;; - Make it interact correctly with color themes (e.g. modus-themes). +;; Maybe automatically disabling color themes that disagree with the +;; selected value of `dark-mode'. +;; - Check interaction with "(in|re)verse-video". +;; +;; (define-minor-mode dark-mode +;; "Use light text on dark background." +;; :global t +;; :group 'faces +;; (when (eq dark-mode +;; (eq 'light (frame--current-backround-mode (selected-frame)))) +;; ;; FIXME: Change the face's SPEC instead? +;; (set-face-attribute 'default nil +;; :foreground (face-attribute 'default :background) +;; :background (face-attribute 'default :foreground)) +;; (frame-set-background-mode (selected-frame)))) + ;;;; Frame configurations @@ -1357,9 +1376,9 @@ differing font heights." If FRAME is omitted, describe the currently selected frame." (cdr (assq 'width (frame-parameters frame)))) -(defalias 'frame-border-width 'frame-internal-border-width) -(defalias 'frame-pixel-width 'frame-native-width) -(defalias 'frame-pixel-height 'frame-native-height) +(defalias 'frame-border-width #'frame-internal-border-width) +(defalias 'frame-pixel-width #'frame-native-width) +(defalias 'frame-pixel-height #'frame-native-height) (defun frame-inner-width (&optional frame) "Return inner width of FRAME in pixels. @@ -1991,9 +2010,9 @@ frame's display)." (fboundp 'image-mask-p) (fboundp 'image-size))) -(defalias 'display-blink-cursor-p 'display-graphic-p) -(defalias 'display-multi-frame-p 'display-graphic-p) -(defalias 'display-multi-font-p 'display-graphic-p) +(defalias 'display-blink-cursor-p #'display-graphic-p) +(defalias 'display-multi-frame-p #'display-graphic-p) +(defalias 'display-multi-font-p #'display-graphic-p) (defun display-selections-p (&optional display) "Return non-nil if DISPLAY supports selections. @@ -2340,13 +2359,15 @@ In the 3rd, 4th, and 6th examples, the returned value is relative to the opposite frame edge from the edge indicated in the input spec." (cons (car spec) (frame-geom-value-cons (car spec) (cdr spec) frame))) -(defun delete-other-frames (&optional frame) +(defun delete-other-frames (&optional frame iconify) "Delete all frames on FRAME's terminal, except FRAME. If FRAME uses another frame's minibuffer, the minibuffer frame is left untouched. Do not delete any of FRAME's child frames. If FRAME is a child frame, delete its siblings only. FRAME must be -a live frame and defaults to the selected one." - (interactive) +a live frame and defaults to the selected one. +If the prefix arg ICONIFY is non-nil, just iconify the frames rather than +deleting them." + (interactive "i\nP") (setq frame (window-normalize-frame frame)) (let ((minibuffer-frame (window-frame (minibuffer-window frame))) (this (next-frame frame t)) @@ -2361,7 +2382,7 @@ a live frame and defaults to the selected one." (and parent (not (eq (frame-parent this) parent))) ;; Do not delete a child frame of FRAME. (eq (frame-parent this) frame)) - (delete-frame this)) + (if iconify (iconify-frame this) (delete-frame this))) (setq this next)) ;; In a second round consider all remaining frames. (setq this (next-frame frame t)) @@ -2373,7 +2394,7 @@ a live frame and defaults to the selected one." (and parent (not (eq (frame-parent this) parent))) ;; Do not delete a child frame of FRAME. (eq (frame-parent this) frame)) - (delete-frame this)) + (if iconify (iconify-frame this) (delete-frame this))) (setq this next)))) @@ -2399,7 +2420,7 @@ parameters `bottom-divider-width' and `right-divider-width'." :type '(choice (const :tag "Bottom only" bottom-only) (const :tag "Right only" right-only) (const :tag "Bottom and right" t)) - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (symbol value) (set-default symbol value) (when window-divider-mode @@ -2420,7 +2441,7 @@ parameter `bottom-divider-width'." :type '(restricted-sexp :tag "Default width of bottom dividers" :match-alternatives (window-divider-width-valid-p)) - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (symbol value) (set-default symbol value) (when window-divider-mode @@ -2437,7 +2458,7 @@ parameter `right-divider-width'." :type '(restricted-sexp :tag "Default width of right dividers" :match-alternatives (window-divider-width-valid-p)) - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (symbol value) (set-default symbol value) (when window-divider-mode @@ -2714,14 +2735,14 @@ See also `toggle-frame-maximized'." ;;;; Key bindings -(define-key ctl-x-5-map "2" 'make-frame-command) -(define-key ctl-x-5-map "1" 'delete-other-frames) -(define-key ctl-x-5-map "0" 'delete-frame) -(define-key ctl-x-5-map "o" 'other-frame) -(define-key ctl-x-5-map "5" 'other-frame-prefix) -(define-key global-map [f11] 'toggle-frame-fullscreen) -(define-key global-map [(meta f10)] 'toggle-frame-maximized) -(define-key esc-map [f10] 'toggle-frame-maximized) +(define-key ctl-x-5-map "2" #'make-frame-command) +(define-key ctl-x-5-map "1" #'delete-other-frames) +(define-key ctl-x-5-map "0" #'delete-frame) +(define-key ctl-x-5-map "o" #'other-frame) +(define-key ctl-x-5-map "5" #'other-frame-prefix) +(define-key global-map [f11] #'toggle-frame-fullscreen) +(define-key global-map [(meta f10)] #'toggle-frame-maximized) +(define-key esc-map [f10] #'toggle-frame-maximized) ;; Misc. commit ed4b51962ea5494b92e0d078916558cab27a836a Author: Juri Linkov Date: Mon Apr 12 19:14:45 2021 +0300 * lisp/repeat.el (repeat-mode-echo): New defcustom. (repeat-post-hook): Use it. (repeat-mode-message): New function (bug#47566). (repeat-post-hook): Use real-this-command instead of this-command to handle e.g. rectangle-exchange-point-and-mark remapped to exchange-point-and-mark (bug#47688). diff --git a/lisp/repeat.el b/lisp/repeat.el index b3c58f2f81..f1b20d369b 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -348,6 +348,17 @@ For example, you can set it to like `isearch-exit'." :group 'convenience :version "28.1") +(defcustom repeat-mode-echo #'repeat-mode-message + "Function to display a hint about available keys. +Function is called after every repeatable command with one argument: +a string with a list of keys." + :type '(choice (const :tag "Show hints in the echo area" + repeat-mode-message) + (const :tag "Don't show hints" ignore) + (function :tag "Function")) + :group 'convenience + :version "28.1") + ;;;###autoload (defvar repeat-map nil "The value of the repeating map for the next command. @@ -377,8 +388,8 @@ When Repeat mode is enabled, and the command symbol has the property named "Function run after commands to set transient keymap for repeatable keys." (when repeat-mode (let ((rep-map (or repeat-map - (and (symbolp this-command) - (get this-command 'repeat-map))))) + (and (symbolp real-this-command) + (get real-this-command 'repeat-map))))) (when rep-map (when (boundp rep-map) (setq rep-map (symbol-value rep-map))) @@ -403,9 +414,7 @@ When Repeat mode is enabled, and the command symbol has the property named (format ", or exit with %s" (key-description repeat-exit-key)) "")))) - (if (current-message) - (message "%s [%s]" (current-message) mess) - (message mess)))) + (funcall repeat-mode-echo mess))) ;; Adding an exit key (when repeat-exit-key @@ -417,6 +426,12 @@ When Repeat mode is enabled, and the command symbol has the property named (set-transient-map map)))))) (setq repeat-map nil)) +(defun repeat-mode-message (mess) + "Function that displays available repeating keys in the echo area." + (if (current-message) + (message "%s [%s]" (current-message) mess) + (message mess))) + (provide 'repeat) ;;; repeat.el ends here commit 632fd8079ddc3badd86d09a9770d617be78f5fac Author: Stefan Monnier Date: Mon Apr 12 11:54:10 2021 -0400 * lisp/dynamic-setting.el: Add missing footer diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el index 39d2a1d1e2..6b037aa2a6 100644 --- a/lisp/dynamic-setting.el +++ b/lisp/dynamic-setting.el @@ -24,8 +24,8 @@ ;;; Commentary: -;; This file provides the lisp part of the GConf and XSetting code in -;; xsetting.c. But it is nothing that prevents it from being used by +;; This file provides the Lisp part of the GConf and XSetting code in +;; xsetting.c. But there is nothing that prevents it from being used by ;; other configuration schemes. ;;; Code: @@ -92,3 +92,6 @@ Changes can be (define-key special-event-map [config-changed-event] #'dynamic-setting-handle-config-changed-event) + +(provide 'dynamic-setting) +;;; dynamic-setting.el ends here commit 2ae53db722b64eb5e67ef53de46825b766fba17e Author: Stefan Monnier Date: Mon Apr 12 11:53:25 2021 -0400 * lisp/comint.el (comint-strip-ctrl-m): Avoid `called-interactively-p` diff --git a/lisp/comint.el b/lisp/comint.el index 9cbcfc03fa..2745c5a26f 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2254,23 +2254,23 @@ This function could be on `comint-output-filter-functions' or bound to a key." (let ((inhibit-read-only t)) (delete-region (point-min) (point))))) -(defun comint-strip-ctrl-m (&optional _string) +(defun comint-strip-ctrl-m (&optional _string interactive) "Strip trailing `^M' characters from the current output group. This function could be on `comint-output-filter-functions' or bound to a key." - (interactive) + (interactive (list nil t)) (let ((process (get-buffer-process (current-buffer)))) (if (not process) ;; This function may be used in ;; `comint-output-filter-functions', and in that case, if ;; there's no process, then we should do nothing. If ;; interactive, report an error. - (when (called-interactively-p 'interactive) + (when interactive (error "No process in the current buffer")) (let ((pmark (process-mark process))) (save-excursion (condition-case nil (goto-char - (if (called-interactively-p 'interactive) + (if interactive comint-last-input-end comint-last-output-start)) (error nil)) (while (re-search-forward "\r+$" pmark t) commit 2ec25de5ea1966c2a3ac4ba7180ea57405dba132 Author: Glenn Morris Date: Mon Apr 12 08:08:29 2021 -0700 * lisp/strokes.el (strokes-mode): Fix typo in previous. diff --git a/lisp/strokes.el b/lisp/strokes.el index 4a018ff199..575092a71d 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -1393,7 +1393,7 @@ Encode/decode your strokes with \\[strokes-encode-buffer], \\[strokes-decode-buffer]. \\{strokes-mode-map}" - :ligher strokes-lighter :global t + :lighter strokes-lighter :global t (cond ((not (display-mouse-p)) (error "Can't use Strokes without a mouse")) (strokes-mode ; turn on strokes commit 6bec60ad3151825c2ee5f775848ea3d4c70c72a5 Author: Stefan Monnier Date: Mon Apr 12 11:08:19 2021 -0400 (define-minor-mode): Warn about use of pre-Emacs-21 style args * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Use `advertised-calling-convention` to avoid promoting the old style arguments. Emit a wanring when old-style arguments are used. Massage the docstring accordingly. * doc/lispref/modes.texi (Defining Minor Modes): Document the keyword arguments rather than the old-style positional arguments. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 6cf4dd21c1..88f2f14c09 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1660,7 +1660,7 @@ reserved for users. @xref{Key Binding Conventions}. The macro @code{define-minor-mode} offers a convenient way of implementing a mode in one self-contained definition. -@defmac define-minor-mode mode doc [init-value [lighter [keymap]]] keyword-args@dots{} body@dots{} +@defmac define-minor-mode mode doc keyword-args@dots{} body@dots{} This macro defines a new minor mode whose name is @var{mode} (a symbol). It defines a command named @var{mode} to toggle the minor mode, with @var{doc} as its documentation string. @@ -1675,41 +1675,12 @@ If @var{doc} is @code{nil}, the macro supplies a default documentation string explaining the above. By default, it also defines a variable named @var{mode}, which is set to -@code{t} or @code{nil} by enabling or disabling the mode. The variable -is initialized to @var{init-value}. Except in unusual circumstances -(see below), this value must be @code{nil}. +@code{t} or @code{nil} by enabling or disabling the mode. -The string @var{lighter} says what to display in the mode line -when the mode is enabled; if it is @code{nil}, the mode is not displayed -in the mode line. - -The optional argument @var{keymap} specifies the keymap for the minor -mode. If non-@code{nil}, it should be a variable name (whose value is -a keymap), a keymap, or an alist of the form - -@example -(@var{key-sequence} . @var{definition}) -@end example - -@noindent -where each @var{key-sequence} and @var{definition} are arguments -suitable for passing to @code{define-key} (@pxref{Changing Key -Bindings}). If @var{keymap} is a keymap or an alist, this also -defines the variable @code{@var{mode}-map}. - -The above three arguments @var{init-value}, @var{lighter}, and -@var{keymap} can be (partially) omitted when @var{keyword-args} are -used. The @var{keyword-args} consist of keywords followed by +The @var{keyword-args} consist of keywords followed by corresponding values. A few keywords have special meanings: @table @code -@item :group @var{group} -Custom group name to use in all generated @code{defcustom} forms. -Defaults to @var{mode} without the possible trailing @samp{-mode}. -@strong{Warning:} don't use this default group name unless you have -written a @code{defgroup} to define that group properly. @xref{Group -Definitions}. - @item :global @var{global} If non-@code{nil}, this specifies that the minor mode should be global rather than buffer-local. It defaults to @code{nil}. @@ -1719,19 +1690,34 @@ One of the effects of making a minor mode global is that the through the Customize interface turns the mode on and off, and its value can be saved for future Emacs sessions (@pxref{Saving Customizations,,, emacs, The GNU Emacs Manual}. For the saved -variable to work, you should ensure that the @code{define-minor-mode} -form is evaluated each time Emacs starts; for packages that are not -part of Emacs, the easiest way to do this is to specify a -@code{:require} keyword. +variable to work, you should ensure that the minor mode function +is available each time Emacs starts; usually this is done by +marking the @code{define-minor-mode} form as autoloaded. @item :init-value @var{init-value} -This is equivalent to specifying @var{init-value} positionally. +This is the value to which the @var{mode} variable is initialized. +Except in unusual circumstances (see below), this value must be +@code{nil}. @item :lighter @var{lighter} -This is equivalent to specifying @var{lighter} positionally. +The string @var{lighter} says what to display in the mode line +when the mode is enabled; if it is @code{nil}, the mode is not displayed +in the mode line. @item :keymap @var{keymap} -This is equivalent to specifying @var{keymap} positionally. +The optional argument @var{keymap} specifies the keymap for the minor +mode. If non-@code{nil}, it should be a variable name (whose value is +a keymap), a keymap, or an alist of the form + +@example +(@var{key-sequence} . @var{definition}) +@end example + +@noindent +where each @var{key-sequence} and @var{definition} are arguments +suitable for passing to @code{define-key} (@pxref{Changing Key +Bindings}). If @var{keymap} is a keymap or an alist, this also +defines the variable @code{@var{mode}-map}. @item :variable @var{place} This replaces the default variable @var{mode}, used to store the state diff --git a/etc/NEWS b/etc/NEWS index 7483a6e5b7..88583d952f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2363,6 +2363,11 @@ This is to keep the same behavior as Eshell. * Incompatible Lisp Changes in Emacs 28.1 ++++ +** The use of positional arguments in 'define-minor-mode' is obsolete. +These were actually rendered obsolete in Emacs-21 but were never +marked as such. + ** 'facemenu-color-alist' is now obsolete, and is not used. ** 'facemenu.el' is no longer preloaded. diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index addb58cdbb..e23ff5ae51 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -139,39 +139,31 @@ documenting what its argument does. If the word \"ARG\" does not appear in DOC, a paragraph is added to DOC explaining usage of the mode argument. -Optional INIT-VALUE is the initial value of the mode's variable. - Note that the minor mode function won't be called by setting - this option, so the value *reflects* the minor mode's natural - initial state, rather than *setting* it. - In the vast majority of cases it should be nil. -Optional LIGHTER is displayed in the mode line when the mode is on. -Optional KEYMAP is the default keymap bound to the mode keymap. - If non-nil, it should be a variable name (whose value is a keymap), - or an expression that returns either a keymap or a list of - (KEY . BINDING) pairs where KEY and BINDING are suitable for - `define-key'. If you supply a KEYMAP argument that is not a - symbol, this macro defines the variable MODE-map and gives it - the value that KEYMAP specifies. - BODY contains code to execute each time the mode is enabled or disabled. It is executed after toggling the mode, and before running MODE-hook. Before the actual body code, you can write keyword arguments, i.e. alternating keywords and values. If you provide BODY, then you must - provide (even if just nil) INIT-VALUE, LIGHTER, and KEYMAP, or provide - at least one keyword argument, or both; otherwise, BODY would be - misinterpreted as the first omitted argument. The following special + provide at least one keyword argument. The following special keywords are supported (other keywords are passed to `defcustom' if the minor mode is global): -:group GROUP Custom group name to use in all generated `defcustom' forms. :global GLOBAL If non-nil specifies that the minor mode is not meant to be buffer-local, so don't make the variable MODE buffer-local. By default, the mode is buffer-local. -:init-value VAL Same as the INIT-VALUE argument. +:init-value VAL the initial value of the mode's variable. + Note that the minor mode function won't be called by setting + this option, so the value *reflects* the minor mode's natural + initial state, rather than *setting* it. + In the vast majority of cases it should be nil. Not used if you also specify :variable. -:lighter SPEC Same as the LIGHTER argument. -:keymap MAP Same as the KEYMAP argument. -:require SYM Same as in `defcustom'. +:lighter SPEC Text displayed in the mode line when the mode is on. +:keymap MAP Keymap bound to the mode keymap. Defaults to `MODE-map'. + If non-nil, it should be a variable name (whose value is + a keymap), or an expression that returns either a keymap or + a list of (KEY . BINDING) pairs where KEY and BINDING are + suitable for `define-key'. If you supply a KEYMAP argument + that is not a symbol, this macro defines the variable MODE-map + and gives it the value that KEYMAP specifies. :interactive VAL Whether this mode should be a command or not. The default is to make it one; use nil to avoid that. If VAL is a list, it's interpreted as a list of major modes this minor mode @@ -185,15 +177,18 @@ BODY contains code to execute each time the mode is enabled or disabled. sets it. If you specify a :variable, this function does not define a MODE variable (nor any of the terms used in :variable). - :after-hook A single lisp form which is evaluated after the mode hooks have been run. It should not be quoted. For example, you could write (define-minor-mode foo-mode \"If enabled, foo on you!\" :lighter \" Foo\" :require \\='foo :global t :group \\='hassle :version \"27.5\" - ...BODY CODE...)" + ...BODY CODE...) + +For backward compatibility with the Emacs<21 calling convention, +BODY can also start with the triplet INIT-VALUE LIGHTER KEYMAP." (declare (doc-string 2) + (advertised-calling-convention (mode doc &rest body) "28.1") (debug (&define name string-or-null-p [&optional [¬ keywordp] sexp &optional [¬ keywordp] sexp @@ -201,23 +196,12 @@ For example, you could write [&rest [keywordp sexp]] def-body))) - ;; Allow skipping the first three args. - (cond - ((keywordp init-value) - (setq body (if keymap `(,init-value ,lighter ,keymap ,@body) - `(,init-value ,lighter)) - init-value nil lighter nil keymap nil)) - ((keywordp lighter) - (setq body `(,lighter ,keymap ,@body) lighter nil keymap nil)) - ((keywordp keymap) (push keymap body) (setq keymap nil))) - (let* ((last-message (make-symbol "last-message")) (mode-name (symbol-name mode)) - (pretty-name (easy-mmode-pretty-mode-name mode lighter)) + (pretty-name nil) (globalp nil) (set nil) (initialize nil) - (group nil) (type nil) (extra-args nil) (extra-keywords nil) @@ -225,14 +209,28 @@ For example, you could write (setter `(setq ,mode)) ;The beginning of the exp to set the mode var. (getter mode) ;The exp to get the mode value. (modefun mode) ;The minor mode function name we're defining. - (require t) (after-hook nil) (hook (intern (concat mode-name "-hook"))) (hook-on (intern (concat mode-name "-on-hook"))) (hook-off (intern (concat mode-name "-off-hook"))) (interactive t) + (warnwrap (if (keywordp init-value) #'identity + (lambda (exp) + (macroexp-warn-and-return + "Use keywords rather than deprecated positional arguments to `define-minor-mode'" + exp)))) keyw keymap-sym tmp) + ;; Allow skipping the first three args. + (cond + ((keywordp init-value) + (setq body (if keymap `(,init-value ,lighter ,keymap ,@body) + `(,init-value ,lighter)) + init-value nil lighter nil keymap nil)) + ((keywordp lighter) + (setq body `(,lighter ,keymap ,@body) lighter nil keymap nil)) + ((keywordp keymap) (push keymap body) (setq keymap nil))) + ;; Check keys. (while (keywordp (setq keyw (car body))) (setq body (cdr body)) @@ -246,9 +244,7 @@ For example, you could write (:extra-args (setq extra-args (pop body))) (:set (setq set (list :set (pop body)))) (:initialize (setq initialize (list :initialize (pop body)))) - (:group (setq group (nconc group (list :group (pop body))))) (:type (setq type (list :type (pop body)))) - (:require (setq require (pop body))) (:keymap (setq keymap (pop body))) (:interactive (setq interactive (pop body))) (:variable (setq variable (pop body)) @@ -264,6 +260,7 @@ For example, you could write (:after-hook (setq after-hook (pop body))) (_ (push keyw extra-keywords) (push (pop body) extra-keywords)))) + (setq pretty-name (easy-mmode-pretty-mode-name mode lighter)) (setq keymap-sym (if (and keymap (symbolp keymap)) keymap (intern (concat mode-name "-map")))) @@ -301,70 +298,72 @@ or call the function `%s'.")))) ,(format base-doc-string pretty-name mode mode) ,@set ,@initialize - ,@group ,@type - ,@(unless (eq require t) `(:require ,require)) ,@(nreverse extra-keywords))))) ;; The actual function. - (defun ,modefun (&optional arg ,@extra-args) - ,(easy-mmode--mode-docstring doc pretty-name keymap-sym) - ,(when interactive - ;; Use `toggle' rather than (if ,mode 0 1) so that using - ;; repeat-command still does the toggling correctly. - (if (consp interactive) - `(interactive - (list (if current-prefix-arg - (prefix-numeric-value current-prefix-arg) - 'toggle)) - ,@interactive) - '(interactive (list (if current-prefix-arg - (prefix-numeric-value current-prefix-arg) - 'toggle))))) - (let ((,last-message (current-message))) - (,@setter - (cond ((eq arg 'toggle) - (not ,getter)) - ((and (numberp arg) - (< arg 1)) - nil) - (t - t))) - ;; Keep minor modes list up to date. - ,@(if globalp - ;; When running this byte-compiled code in earlier - ;; Emacs versions, these variables may not be defined - ;; there. So check defensively, even if they're - ;; always defined in Emacs 28 and up. - `((when (boundp 'global-minor-modes) - (setq global-minor-modes - (delq ',modefun global-minor-modes)) - (when ,getter - (push ',modefun global-minor-modes)))) - ;; Ditto check. - `((when (boundp 'local-minor-modes) - (setq local-minor-modes (delq ',modefun local-minor-modes)) - (when ,getter - (push ',modefun local-minor-modes))))) - ,@body - ;; The on/off hooks are here for backward compatibility only. - (run-hooks ',hook (if ,getter ',hook-on ',hook-off)) - (if (called-interactively-p 'any) - (progn - ,(if (and globalp (not variable)) - `(customize-mark-as-set ',mode)) - ;; Avoid overwriting a message shown by the body, - ;; but do overwrite previous messages. - (unless (and (current-message) - (not (equal ,last-message - (current-message)))) - (let ((local ,(if globalp "" " in current buffer"))) - (message ,(format "%s %%sabled%%s" pretty-name) - (if ,getter "en" "dis") local))))) - ,@(when after-hook `(,after-hook))) - (force-mode-line-update) - ;; Return the new setting. - ,getter) + ,(funcall + warnwrap + `(defun ,modefun (&optional arg ,@extra-args) + ,(easy-mmode--mode-docstring doc pretty-name keymap-sym) + ,(when interactive + ;; Use `toggle' rather than (if ,mode 0 1) so that using + ;; repeat-command still does the toggling correctly. + (if (consp interactive) + `(interactive + (list (if current-prefix-arg + (prefix-numeric-value current-prefix-arg) + 'toggle)) + ,@interactive) + '(interactive + (list (if current-prefix-arg + (prefix-numeric-value current-prefix-arg) + 'toggle))))) + (let ((,last-message (current-message))) + (,@setter + (cond ((eq arg 'toggle) + (not ,getter)) + ((and (numberp arg) + (< arg 1)) + nil) + (t + t))) + ;; Keep minor modes list up to date. + ,@(if globalp + ;; When running this byte-compiled code in earlier + ;; Emacs versions, these variables may not be defined + ;; there. So check defensively, even if they're + ;; always defined in Emacs 28 and up. + `((when (boundp 'global-minor-modes) + (setq global-minor-modes + (delq ',modefun global-minor-modes)) + (when ,getter + (push ',modefun global-minor-modes)))) + ;; Ditto check. + `((when (boundp 'local-minor-modes) + (setq local-minor-modes + (delq ',modefun local-minor-modes)) + (when ,getter + (push ',modefun local-minor-modes))))) + ,@body + ;; The on/off hooks are here for backward compatibility only. + (run-hooks ',hook (if ,getter ',hook-on ',hook-off)) + (if (called-interactively-p 'any) + (progn + ,(if (and globalp (not variable)) + `(customize-mark-as-set ',mode)) + ;; Avoid overwriting a message shown by the body, + ;; but do overwrite previous messages. + (unless (and (current-message) + (not (equal ,last-message + (current-message)))) + (let ((local ,(if globalp "" " in current buffer"))) + (message ,(format "%s %%sabled%%s" pretty-name) + (if ,getter "en" "dis") local))))) + ,@(when after-hook `(,after-hook))) + (force-mode-line-update) + ;; Return the new setting. + ,getter)) ;; Autoloading a define-minor-mode autoloads everything ;; up-to-here. commit 07671edbf0686a71fe568626a71ef48fdb2e0215 Author: Stefan Monnier Date: Mon Apr 12 10:46:07 2021 -0400 * lisp/progmodes/vhdl-mode.el: Add note about XEmacs compatibility diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index be98066a62..5eeac8af3b 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -12,6 +12,9 @@ ;; file on 18/3/2008, and the maintainer agreed that when a bug is ;; filed in the Emacs bug reporting system against this file, a copy ;; of the bug report be sent to the maintainer's email address. +;; +;; Reto also said in Apr 2021 that he preferred to keep the XEmacs +;; compatibility code. (defconst vhdl-version "3.38.1" "VHDL Mode version number.") commit 72db25ef54f3d8e3b9827eeaa6df2eab2711cdff Author: Lars Ingebrigtsen Date: Mon Apr 12 11:45:33 2021 +0200 Adjust verilog-mode to changes in the completion framework * lisp/progmodes/verilog-mode.el (verilog-func-completion): Don't bug out on `C-M-i' (which expects no point movement) (bug#47652). (verilog-declaration-end): There may be no semicolons; don't bug out. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index a7f72950b1..5f8f723f80 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -3607,7 +3607,7 @@ inserted using a single call to `verilog-insert'." ;; More searching (defun verilog-declaration-end () - (search-forward ";")) + (search-forward ";" nil t)) (defun verilog-single-declaration-end (limit) "Returns pos where current (single) declaration statement ends. @@ -7555,25 +7555,25 @@ will be completed at runtime and should not be added to this list.") TYPE is `module', `tf' for task or function, or t if unknown." (if (string= verilog-str "") (setq verilog-str "[a-zA-Z_]")) - (let ((verilog-str (concat (cond - ((eq type 'module) "\\<\\(module\\|connectmodule\\)\\s +") - ((eq type 'tf) "\\<\\(task\\|function\\)\\s +") - (t "\\<\\(task\\|function\\|module\\|connectmodule\\)\\s +")) - "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>")) + (let ((verilog-str + (concat (cond + ((eq type 'module) "\\<\\(module\\|connectmodule\\)\\s +") + ((eq type 'tf) "\\<\\(task\\|function\\)\\s +") + (t "\\<\\(task\\|function\\|module\\|connectmodule\\)\\s +")) + "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>")) match) - (if (not (looking-at verilog-defun-re)) - (verilog-re-search-backward verilog-defun-re nil t)) - (forward-char 1) + (save-excursion + (if (not (looking-at verilog-defun-re)) + (verilog-re-search-backward verilog-defun-re nil t)) + (forward-char 1) - ;; Search through all reachable functions - (goto-char (point-min)) - (while (verilog-re-search-forward verilog-str (point-max) t) - (progn (setq match (buffer-substring (match-beginning 2) - (match-end 2))) - (setq verilog-all (cons match verilog-all)))) - (if (match-beginning 0) - (goto-char (match-beginning 0))))) + ;; Search through all reachable functions + (goto-char (point-min)) + (while (verilog-re-search-forward verilog-str (point-max) t) + (setq match (buffer-substring (match-beginning 2) + (match-end 2))) + (setq verilog-all (cons match verilog-all)))))) (defun verilog-get-completion-decl (end) "Macro for searching through current declaration (var, type or const) commit f2ab4cec7a762e8fe641cde00e6b299a92301cac Author: Shitikanth Kashyap Date: Mon Apr 12 10:43:42 2021 +0200 Fix python-shell-switch-to-shell redisplay bug * lisp/progmodes/python.el (python-shell-switch-to-shell): Redisplay the switched-to window faster (bug#47679). Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e5c15d148f..30721c7a57 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3385,7 +3385,8 @@ user-friendly message if there's no process running; defaults to t when called interactively." (interactive "p") (pop-to-buffer - (process-buffer (python-shell-get-process-or-error msg)) nil t)) + (process-buffer (python-shell-get-process-or-error msg)) + nil 'mark-for-redisplay)) (defun python-shell-send-setup-code () "Send all setup code for shell. commit 9dc28e1fca03b124c53c2f99add3180591896696 Author: Ralph Schleicher Date: Mon Apr 12 10:31:46 2021 +0200 Add command in eww to toggle images * lisp/net/eww.el (eww-toggle-images): New function. (eww-mode-map): Add key binding and menu entry. * lisp/net/shr.el (shr-inhibit-images): Make it customizable. * doc/misc/eww.texi (Basics): Document eww-toggle-images. Fix index entries for shr-use-fonts and shr-use-colors. (Advanced): Document shr-inhibit-images (bug#47705). diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 6e82a97030..cc546a92d6 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -124,17 +124,25 @@ which part of the document contains the ``readable'' text, and will only display this part. This usually gets rid of menus and the like. @findex eww-toggle-fonts -@findex shr-use-fonts +@vindex shr-use-fonts @kindex F The @kbd{F} command (@code{eww-toggle-fonts}) toggles whether to use variable-pitch fonts or not. This sets the @code{shr-use-fonts} variable. @findex eww-toggle-colors -@findex shr-use-colors -@kindex F +@vindex shr-use-colors +@kindex M-C The @kbd{M-C} command (@code{eww-toggle-colors}) toggles whether to use HTML-specified colors or not. This sets the @code{shr-use-colors} variable. +@findex eww-toggle-images +@vindex shr-inhibit-images +@kindex M-I +@cindex Image Display + The @kbd{M-I} command (@code{eww-toggle-images}, capital letter i) +toggles whether to display images or not. This also sets the +@code{shr-inhibit-images} variable. + @findex eww-download @vindex eww-download-directory @kindex d @@ -305,6 +313,11 @@ of the width and height. If Emacs supports image scaling (ImageMagick support required) then larger images are scaled down. You can block specific images completely by customizing @code{shr-blocked-images}. +@vindex shr-inhibit-images + You can control image display by customizing +@code{shr-inhibit-images}. If this variable is @code{nil}, display +the ``ALT'' text of images instead. + @vindex shr-color-visible-distance-min @vindex shr-color-visible-luminance-min @cindex Contrast diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 32fe857e65..eec3ec7ba8 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -987,6 +987,7 @@ the like." (define-key map "F" 'eww-toggle-fonts) (define-key map "D" 'eww-toggle-paragraph-direction) (define-key map [(meta C)] 'eww-toggle-colors) + (define-key map [(meta I)] 'eww-toggle-images) (define-key map "b" 'eww-add-bookmark) (define-key map "B" 'eww-list-bookmarks) @@ -1015,6 +1016,7 @@ the like." ["List cookies" url-cookie-list t] ["Toggle fonts" eww-toggle-fonts t] ["Toggle colors" eww-toggle-colors t] + ["Toggle images" eww-toggle-images t] ["Character Encoding" eww-set-character-encoding] ["Toggle Paragraph Direction" eww-toggle-paragraph-direction])) map)) @@ -1893,6 +1895,14 @@ If CHARSET is nil then use UTF-8." "off")) (eww-reload)) +(defun eww-toggle-images () + "Toggle whether or not to display images." + (interactive nil eww-mode) + (setq shr-inhibit-images (not shr-inhibit-images)) + (eww-reload) + (message "Images are now %s" + (if shr-inhibit-images "off" "on"))) + ;;; Bookmarks code (defvar eww-bookmarks nil) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 7c15eb1ca0..cbdeb65ba8 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -183,8 +183,10 @@ temporarily blinks with this face." "Face for elements." :version "27.1") -(defvar shr-inhibit-images nil - "If non-nil, inhibit loading images.") +(defcustom shr-inhibit-images nil + "If non-nil, inhibit loading images." + :version "28.1" + :type 'boolean) (defvar shr-external-rendering-functions nil "Alist of tag/function pairs used to alter how shr renders certain tags.