commit 288e00d69ac8d9907e8d6b8cccff2b3c914b2464 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Thu Oct 10 00:15:24 2019 -0700 Port time-stamp-test-time-zone to macOS Problem reported by Stefan Kangas in: https://lists.gnu.org/r/emacs-devel/2019-10/msg00360.html * test/lisp/time-stamp-tests.el (time-stamp-test-time-zone): Don’t assume (format-time-string "%Z" 0 t) returns "GMT". diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index ace5e58e36..37822f6e29 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -298,12 +298,14 @@ (ert-deftest time-stamp-test-time-zone () "Test time-stamp formats for time zone." (with-time-stamp-test-env - ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%Z" ref-time) "GMT")) - ;; documented 1995-2019 - (should (equal (time-stamp-string "%z" ref-time) "gmt")) - ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%#Z" ref-time) "gmt")))) + (let ((UTC-abbr (format-time-string "%Z" ref-time t)) + (utc-abbr (format-time-string "%#Z" ref-time t))) + ;; implemented and documented since 1995 + (should (equal (time-stamp-string "%Z" ref-time) UTC-abbr)) + ;; documented 1995-2019 + (should (equal (time-stamp-string "%z" ref-time) utc-abbr)) + ;; implemented since 1997, documented since 2019 + (should (equal (time-stamp-string "%#Z" ref-time) utc-abbr))))) (ert-deftest time-stamp-test-non-date-conversions () "Test time-stamp formats for non-date items." commit b3314ac5c43414a5de518794d002aa3801ed809f Author: Juanma Barranquero Date: Thu Oct 10 06:00:20 2019 +0200 identity, ignore: Make arg names more consistent with docs * lisp/subr.el (ignore): Rename argument IGNORE to ARGUMENTS. * src/fns.c (Fidentity): Rename ARG to ARGUMENT. * doc/lispref/functions.texi (Calling Functions): Fix references. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index d082225dd0..eced3a2447 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -929,12 +929,12 @@ that accept function arguments are often called @dfn{functionals}. function as the argument. Here are two different kinds of no-op function: -@defun identity arg -This function returns @var{arg} and has no side effects. +@defun identity argument +This function returns @var{argument} and has no side effects. @end defun -@defun ignore &rest args -This function ignores any arguments and returns @code{nil}. +@defun ignore &rest arguments +This function ignores any @var{arguments} and returns @code{nil}. @end defun Some functions are user-visible @dfn{commands}, which can be called diff --git a/lisp/subr.el b/lisp/subr.el index e361b8324f..010443a56b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -332,9 +332,9 @@ PREFIX is a string, and defaults to \"g\"." (setq gensym-counter (1+ gensym-counter))))) (make-symbol (format "%s%d" (or prefix "g") num)))) -(defun ignore (&rest _ignore) +(defun ignore (&rest _arguments) "Do nothing and return nil. -This function accepts any number of arguments, but ignores them." +This function accepts any number of ARGUMENTS, but ignores them." (interactive) nil) diff --git a/src/fns.c b/src/fns.c index 37c581f15b..fc1abe8b18 100644 --- a/src/fns.c +++ b/src/fns.c @@ -49,11 +49,11 @@ static bool internal_equal (Lisp_Object, Lisp_Object, enum equal_kind, int, Lisp_Object); DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, - doc: /* Return the argument unchanged. */ + doc: /* Return the ARGUMENT unchanged. */ attributes: const) - (Lisp_Object arg) + (Lisp_Object argument) { - return arg; + return argument; } DEFUN ("random", Frandom, Srandom, 0, 1, 0, commit 46d11bcfa381c13a9719b7ecd3f9d4cc92c34089 Author: Damien Cassou Date: Thu Oct 10 02:19:10 2019 +0200 checkdoc CL tests * test/lisp/emacs-lisp/checkdoc-tests.el: Add cl-lib-related tests (bug#37063). diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index 1cefc4c366..de75c42c52 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -37,6 +37,112 @@ (insert "(defun foo())") (should-error (checkdoc-defun) :type 'user-error))) +(ert-deftest checkdoc-cl-defmethod-ok () + "Checkdoc should be happy with a simple correct cl-defmethod." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defmethod foo (a) \"Return A.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defmethod-with-types-ok () + "Checkdoc should be happy with a cl-defmethod using types." + (with-temp-buffer + (emacs-lisp-mode) + ;; this method matches if A is the symbol `smthg' and if b is a list: + (insert "(cl-defmethod foo ((a (eql smthg)) (b list)) \"Return A+B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-key-ok () + "Checkdoc should be happy with a cl-defun using &key." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (&key a (b 27)) \"Return :A+:B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-allow-other-keys-ok () + "Checkdoc should be happy with a cl-defun using &allow-other-keys." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (&key a &allow-other-keys) \"Return :A.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-default-optional-value-ok () + "Checkdoc should be happy with a cl-defun using default values for optional args." + (with-temp-buffer + (emacs-lisp-mode) + ;; B is optional and equals 1+a if not provided. HAS-BS is non-nil + ;; if B was provided in the call: + (insert "(cl-defun foo (a &optional (b (1+ a) has-bs)) \"Return A + B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-destructuring-ok () + "Checkdoc should be happy with a cl-defun destructuring its arguments." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo ((a b &optional c) d) \"Return A+B+C+D.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defmethod-ok () + "Checkdoc should be happy with a simple correct cl-defmethod." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defmethod foo (a) \"Return A.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defmethod-with-types-ok () + "Checkdoc should be happy with a cl-defmethod using types." + (with-temp-buffer + (emacs-lisp-mode) + ;; this method matches if A is the symbol `smthg' and if b is a list: + (insert "(cl-defmethod foo ((a (eql smthg)) (b list)) \"Return A+B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-key-ok () + "Checkdoc should be happy with a cl-defun using &key." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (&key a (b 27)) \"Return :A+:B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-allow-other-keys-ok () + "Checkdoc should be happy with a cl-defun using &allow-other-keys." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (&key a &allow-other-keys) \"Return :A.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-aux-ok () + "Checkdoc should be happy with a cl-defun using &aux." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (a b &aux (c (+ a b))) \"Return A and B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-default-optional-value-ok () + "Checkdoc should be happy with a cl-defun using default values for optional args." + (with-temp-buffer + (emacs-lisp-mode) + ;; B is optional and equals 1+a if not provided. HAS-BS is non-nil + ;; if B was provided in the call: + (insert "(cl-defun foo (a &optional (b (1+ a) has-bs)) \"Return A + B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-destructuring-ok () + "Checkdoc should be happy with a cl-defun destructuring its arguments." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo ((a b &optional c) d) \"Return A+B+C+D.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defmethod-with-context-ok () + "Checkdoc should ignore context specializers in a cl-defmethod." + (with-temp-buffer + (emacs-lisp-mode) + ;; A context specializer is used to select the correct method but + ;; doesn't have to appear in the docstring: + (insert "(cl-defmethod foo (a &context (global-var (eql foo))) \"Return A.\")") + (checkdoc-defun))) + (ert-deftest checkdoc-tests--next-docstring () "Checks that the one-argument form of `defvar' works. See the comments in Bug#24998." commit b9211d0bc2b0adcef5fd84cc3904ad46818fec73 Author: dick r. chiang Date: Thu Oct 10 02:18:20 2019 +0200 Make checkdoc work better with cl-lib functions * lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info): Make checkdoc work for cl-lib methods with more complex parameter lists (bug#37063). Copyright-paperwork-exempt: yes diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 51fb75da69..6c40bdf632 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1952,11 +1952,10 @@ from the comment." ;; new obarray. (if (not (listp lst)) (setq lst nil)) (unless is-advice - ;; lst here can be something like ((foo bar) baz) from + ;; (car lst) can be something like ((foo bar) baz) from ;; cl-lib methods; flatten it: - (setq lst (flatten-tree lst)) (while lst - (setq ret (cons (symbol-name (car lst)) ret) + (setq ret (cons (symbol-name (car (flatten-tree (car lst)))) ret) lst (cdr lst))))) (nreverse ret)))) commit 9ab3f16c460d91aa556eb35085a90f168b10390f Author: Lars Ingebrigtsen Date: Thu Oct 10 01:57:54 2019 +0200 Fix formatting of (file-size-human-readable 2047) * lisp/files.el (file-size-human-readable): Don't format slightly-less numbers as X.0k, but just Xk instead (bug#36329). diff --git a/lisp/files.el b/lisp/files.el index fdd7c75ced..a1c7e3c814 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1419,7 +1419,8 @@ in all cases, since that is the standard symbol for byte." (if (string= prefix "") "" "i") (or unit "B")) (concat prefix unit)))) - (format (if (> (mod file-size 1.0) 0.05) + (format (if (and (>= (mod file-size 1.0) 0.05) + (< (mod file-size 1.0) 0.95)) "%.1f%s%s" "%.0f%s%s") file-size diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index ed23f7675c..60387e1ab2 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1282,6 +1282,12 @@ renaming only, rather than modified in-place." (should (equal (file-size-human-readable 10000 'si " " "bit") "10 kbit")) (should (equal (file-size-human-readable 10000 'iec " " "bit") "9.8 Kibit")) + (should (equal (file-size-human-readable 2048) "2k")) + (should (equal (file-size-human-readable 2046) "2k")) + (should (equal (file-size-human-readable 2050) "2k")) + (should (equal (file-size-human-readable 1950) "1.9k")) + (should (equal (file-size-human-readable 2100) "2.1k")) + (should (equal (file-size-human-readable-iec 0) "0 B")) (should (equal (file-size-human-readable-iec 1) "1 B")) (should (equal (file-size-human-readable-iec 9621) "9.4 KiB")) commit ccea37f6ac503d2e94ca3dc0aa1aad079a2cc8d5 Author: Lars Ingebrigtsen Date: Thu Oct 10 01:34:14 2019 +0200 Work around bad interaction between dired-omit-mode and recover-session * lisp/files.el (recover-session): Add ugly hack to try to ensure that we're actually showing the session files (bug#36223). diff --git a/lisp/files.el b/lisp/files.el index 20bc204b06..fdd7c75ced 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6211,6 +6211,8 @@ an auto-save file." (after-find-file nil nil t)) (t (user-error "Recover-file canceled"))))) +(defvar dired-mode-hook) + (defun recover-session () "Recover auto save files from a previous Emacs session. This command first displays a Dired buffer showing you the @@ -6230,7 +6232,12 @@ Then you'll be asked about a number of files to recover." (concat "\\`" (regexp-quote nd))) t) (error "No previous sessions to recover"))) - (let ((ls-lisp-support-shell-wildcards t)) + (require 'dired) + (let ((ls-lisp-support-shell-wildcards t) + ;; Ensure that we don't omit the session files as the user may + ;; have (as suggested by the manual) `dired-omit-mode' in the + ;; hook. + (dired-mode-hook (delete 'dired-omit-mode dired-mode-hook))) (dired (concat auto-save-list-file-prefix "*") (concat dired-listing-switches " -t"))) (use-local-map (nconc (make-sparse-keymap) (current-local-map))) commit 3f594fef9eeeda2272dc9858b6b17bbd5fa2f436 Author: Lars Ingebrigtsen Date: Thu Oct 10 01:19:33 2019 +0200 Allow filtering out warnings/errors from compile.el detection * lisp/progmodes/compile.el (compilation-transform-file-match-alist): New variable (bug#32968). (compilation-error-properties): Use it to remove known false positives. (compilation-error-regexp-alist): Mention it in this doc string. diff --git a/etc/NEWS b/etc/NEWS index 49aa7f6007..3b98ef7d2f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -612,6 +612,10 @@ be functions. nil, but instead of scrolling the current line to the top of the screen when there is no left fringe, it inserts a visible arrow before column zero. +--- +*** The new 'compilation-transform-file-match-alist' variable can be used +to transform file name matches compilation output, and remove known +false positives being recognised as warnings/errors. ** cl-lib.el +++ diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 50370a4f3a..b8d1acd1cc 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -58,6 +58,16 @@ If nil, use Emacs default." :type '(choice (const :tag "Default" nil) integer)) +(defcustom compilation-transform-file-match-alist + '(("/bin/[a-z]*sh\\'" nil) + ("\\*+ \\[\\(Makefile\\)" "\\1")) + "Alist of regexp/replacements to alter file names in compilation errors. +If the replacement is nil, the file will not be considered an +error after all. If not nil, it should be a regexp replacement +string." + :type '(repeat (list regexp string)) + :version "27.1") + (defvar compilation-filter-hook nil "Hook run after `compilation-filter' has inserted a string into the buffer. It is called with the variable `compilation-filter-start' bound @@ -608,7 +618,12 @@ SUBMATCH is the number of a submatch and FACE is an expression which evaluates to a face name (a symbol or string). Alternatively, FACE can evaluate to a property list of the form (face FACE PROP1 VAL1 PROP2 VAL2 ...), in which case all the -listed text properties PROP# are given values VAL# as well." +listed text properties PROP# are given values VAL# as well. + +After identifying errors and warnings determined by this +variable, the `compilation-transform-file-match-alist' variable +is then consulted. It allows further transformations of the +matched file names, and weeding out false positives." :type '(repeat (choice (symbol :tag "Predefined symbol") (sexp :tag "Error specification"))) :link `(file-link :tag "example file" @@ -1111,7 +1126,7 @@ POS and RES.") (setq file (if (functionp file) (funcall file) (match-string-no-properties file)))) (let ((dir - (unless (file-name-absolute-p file) + (unless (file-name-absolute-p file) (let ((pos (compilation--previous-directory (match-beginning 0)))) (when pos @@ -1161,19 +1176,36 @@ POS and RES.") (setq end-col (match-string-no-properties end-col)) (- (string-to-number end-col) -1))) (and end-line -1))) - (if (consp type) ; not a static type, check what it is. + (if (consp type) ; not a static type, check what it is. (setq type (or (and (car type) (match-end (car type)) 1) (and (cdr type) (match-end (cdr type)) 0) 2))) - - (when (and compilation-auto-jump-to-next - (>= type compilation-skip-threshold)) - (kill-local-variable 'compilation-auto-jump-to-next) - (run-with-timer 0 nil 'compilation-auto-jump - (current-buffer) (match-beginning 0))) - - (compilation-internal-error-properties - file line end-line col end-col type fmt))) + ;; Remove matches like /bin/sh and do other file name transforms. + (save-match-data + (let ((transformed nil)) + (dolist (f file) + (let ((match + (cl-loop for (regexp replacement) + in compilation-transform-file-match-alist + when (string-match regexp f) + return (or replacement t)))) + (cond ((not match) + (push f transformed)) + ((stringp match) + (push (replace-match match nil nil f) transformed))))) + (setq file (nreverse transformed)))) + (if (not file) + ;; If we ignored all the files with errors on this line, then + ;; return nil. + nil + (when (and compilation-auto-jump-to-next + (>= type compilation-skip-threshold)) + (kill-local-variable 'compilation-auto-jump-to-next) + (run-with-timer 0 nil 'compilation-auto-jump + (current-buffer) (match-beginning 0))) + + (compilation-internal-error-properties + file line end-line col end-col type fmt)))) (defun compilation-beginning-of-line (&optional n) "Like `beginning-of-line', but accounts for lines hidden by `selective-display'." commit e4efab3f03cec69c87b2e3e28bd70f401821d96f Author: Lars Ingebrigtsen Date: Thu Oct 10 00:51:50 2019 +0200 Clarify documentation of show-help-function slightly * doc/lispref/text.texi (Special Properties): Clarify where the example in Tooltip mode is (bug#35392). diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index ef1d8ebc57..ef11ac2669 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3733,15 +3733,16 @@ effectively disable them. @end defvar @defvar show-help-function -@anchor{Help display} If this variable is non-@code{nil}, it specifies a -function called to display help strings. These may be @code{help-echo} -properties, menu help strings (@pxref{Simple Menu Items}, -@pxref{Extended Menu Items}), or tool bar help strings (@pxref{Tool -Bar}). The specified function is called with one argument, the help -string to display, which is passed through +@anchor{Help display} If this variable is non-@code{nil}, it specifies +a function called to display help strings. These may be +@code{help-echo} properties, menu help strings (@pxref{Simple Menu +Items}, @pxref{Extended Menu Items}), or tool bar help strings +(@pxref{Tool Bar}). The specified function is called with one +argument, the help string to display, which is passed through @code{substitute-command-keys} before being given to the function; see -@ref{Keys in Documentation}. Tooltip mode (@pxref{Tooltips,,, emacs, -The GNU Emacs Manual}) provides an example. +@ref{Keys in Documentation}. See the code of Tooltip mode +(@pxref{Tooltips,,, emacs, The GNU Emacs Manual}) for an example of a +mode that uses @code{show-help-function}. @end defvar @defvar face-filters-always-match commit 235b8b3a6d0b9ece617ab6408e72f1cf69bb919a Author: Juri Linkov Date: Thu Oct 10 01:42:56 2019 +0300 * lisp/tab-bar.el: Don't show window count for one window. * lisp/tab-bar.el (tab-bar-tab-name-selected-window): Don't show the number of windows when there is only one window in the window configuration. (tab-bar-close-other-tabs): Rename from tab-close-other. Take into account tab-bar-show to turn off when needed. (tab-close-other): Alias to tab-bar-close-other-tabs. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 91bc589ae2..c4eba8600a 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -268,7 +268,10 @@ from all windows in the window configuration." (defun tab-bar-tab-name-selected-window () "Generate tab name from the buffer of the selected window. Also add the number of windows in the window configuration." - (format "%s (%d)" (buffer-name) (length (window-list-1 nil 'nomini)))) + (let ((count (length (window-list-1 nil 'nomini)))) + (if (> count 1) + (format "%s (%d)" (buffer-name) count) + (format "%s" (buffer-name))))) (defun tab-bar-tab-name-all-windows () "Generate tab name from buffers of all windows." @@ -576,13 +579,17 @@ TO-INDEX counts from 1." (tab-bar-tabs))))) (tab-bar-close-tab (1+ (tab-bar--tab-index-by-name name)))) -(defun tab-close-other () +(defun tab-bar-close-other-tabs () "Close all tabs on the selected frame, except the selected one." (interactive) (let* ((tabs (tab-bar-tabs)) (current-index (tab-bar--current-tab-index tabs))) (when current-index (set-frame-parameter nil 'tabs (list (nth current-index tabs))) + (when (and tab-bar-mode + (and (natnump tab-bar-show) + (<= 1 tab-bar-show))) + (tab-bar-mode -1)) (if tab-bar-mode (force-mode-line-update) (message "Deleted all other tabs"))))) @@ -590,12 +597,13 @@ TO-INDEX counts from 1." ;;; Short aliases -(defalias 'tab-new 'tab-bar-new-tab) -(defalias 'tab-close 'tab-bar-close-tab) -(defalias 'tab-select 'tab-bar-select-tab) -(defalias 'tab-next 'tab-bar-switch-to-next-tab) -(defalias 'tab-previous 'tab-bar-switch-to-prev-tab) -(defalias 'tab-list 'tab-bar-list) +(defalias 'tab-new 'tab-bar-new-tab) +(defalias 'tab-close 'tab-bar-close-tab) +(defalias 'tab-close-other 'tab-bar-close-other-tabs) +(defalias 'tab-select 'tab-bar-select-tab) +(defalias 'tab-next 'tab-bar-switch-to-next-tab) +(defalias 'tab-previous 'tab-bar-switch-to-prev-tab) +(defalias 'tab-list 'tab-bar-list) ;;; Non-graphical access to frame-local tabs (named window configurations) commit 4d6c1260eaef47e2da3f9842d035cdad2a967601 Author: Lars Ingebrigtsen Date: Wed Oct 9 22:46:05 2019 +0200 Fix nnimap tick/readedness thinko introduced some weeks back * lisp/gnus/nnimap.el (nnimap-request-set-mark): Fix thinko in the tick/read change: Unticking a message shouldn't make it unread, but ticking it should make it read. diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index d4681e2b43..1ec5522831 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -1189,11 +1189,11 @@ If LIMIT, first try to limit the search to the N last articles." ;; response. If they're successful, they're successful. (dolist (action actions) (cl-destructuring-bind (range action marks) action - ;; If we add/remove a tick mark, then do the same with the - ;; readedness mark on the IMAP server. Other IMAP clients - ;; can have marked messages without having them read, but - ;; Gnus can't. - (when (memq 'tick marks) + ;; If we add a tick mark, then also mark the message as + ;; read. Other IMAP clients can have marked messages + ;; without having them read, but Gnus can't. + (when (and (memq 'tick marks) + (eq action 'add)) (push 'read marks)) (let ((flags (nnimap-marks-to-flags marks))) (when flags commit 9c81149ae9165b0f017d60d141221b340879baef Author: Lars Ingebrigtsen Date: Wed Oct 9 21:55:41 2019 +0200 Make mml-secure-epg-sign bug out if we can't find an identity * lisp/gnus/mml-sec.el (mml-secure-epg-sign): Bug out if we couldn't find anything to sign with instead of silently pretending to sign. * lisp/gnus/mml-smime.el (mml-smime-epg-sign): Don't bind inhibit-display because that makes debugging impossible. diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index 51578a753d..c7a2d4664e 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -944,6 +944,8 @@ If no one is selected, symmetric encryption will be performed. " (signer-names (mml-secure-signer-names protocol sender)) (signers (mml-secure-signers context signer-names)) signature micalg) + (unless signers + (error "Couldn't find any signer names. Perhaps `mml-secure-smime-sign-with-sender' should be set?")) (when (eq 'OpenPGP protocol) (setf (epg-context-armor context) t) (setf (epg-context-textmode context) t) diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 659f2b9528..6dcec9f911 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -348,8 +348,7 @@ Whether the passphrase is cached at all is controlled by (autoload 'mml-compute-boundary "mml") (defun mml-smime-epg-sign (cont) - (let ((inhibit-redisplay t) - (boundary (mml-compute-boundary cont))) + (let ((boundary (mml-compute-boundary cont))) (goto-char (point-min)) (let* ((pair (mml-secure-epg-sign 'CMS cont)) (signature (car pair)) commit c548a2af9b81ac892c8afbf1e9bd7018574153bf Author: Stefan Kangas Date: Wed Oct 9 20:10:09 2019 +0200 Remove XEmacs compat code from edt.el (Bug#37621) * lisp/emulation/edt.el (top-level, edt-emacs-variant) (edt-window-system, edt-xserver, edt-page-backward) (edt-beginning-of-line, edt-end-of-line-forward) (edt-end-of-line-backward, edt-one-word-forward) (edt-one-word-backward, edt-character, edt-line-forward) (edt-next-line, edt-previous-line, edt-top, edt-find-forward) (edt-find-backward, edt-find-next-forward) (edt-find-next-backward, edt-reset, edt-advance, edt-backup) (edt-define-key, edt-bottom-check, edt-sentence-forward) (edt-sentence-backward, edt-paragraph-forward) (edt-paragraph-backward, edt-restore-key, edt-window-top) (edt-window-bottom, edt-scroll-window-backward-line) (edt-line-to-bottom-of-window, edt-line-to-middle-of-window) (edt-goto-percentage, edt-display-the-time, edt-remember) (edt-split-window, edt-load-keys, edt-emulation-on) (edt-emulation-off, edt-default-emulation-setup) (edt-user-emulation-setup, edt-select-default-global-map) (edt-select-user-global-map): Remove XEmacs compat code. diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el index dcc327dbd4..b8c835ce2c 100644 --- a/lisp/emulation/edt.el +++ b/lisp/emulation/edt.el @@ -106,10 +106,7 @@ ;; customization file, edt-user.el, to do this. ;; See Info node `edt' for more details. -;; 3. EDT Emulation now also works in XEmacs, including the -;; highlighting of selected text. - -;; 4. If you access a workstation using an X Server, observe that +;; 3. If you access a workstation using an X Server, observe that ;; the initialization file generated by edt-mapper.el will now ;; contain the name of the X Server vendor. This is a ;; convenience for those who have access to their Unix account @@ -120,7 +117,7 @@ ;; names. Then, the correct initialization file for the ;; particular X server in use is loaded correctly automatically. -;; 5. Also, edt-mapper.el is now capable of binding an ASCII key +;; 4. Also, edt-mapper.el is now capable of binding an ASCII key ;; sequence, providing the ASCII key sequence prefix is already ;; known by Emacs to be a prefix. As a result of providing this ;; support, some terminal/keyboard/window system configurations, @@ -140,7 +137,7 @@ ;; your terminal OR a bug in the terminal emulation software you ;; are using.) -;; 6. The edt-quit function (bound to GOLD-q by default) has been +;; 5. The edt-quit function (bound to GOLD-q by default) has been ;; modified to warn the user when file-related buffer ;; modifications exist. It now cautions the user that those ;; modifications will be lost if the user quits without saving @@ -180,8 +177,6 @@ (defvar edt-rect-start-point) (defvar edt-user-global-map) (defvar rect-start-point) -(defvar time-string) -(defvar zmacs-region-stays) ;;; ;;; Version Information @@ -310,23 +305,13 @@ This means that an edt-user.el file was found in the user's `load-path'.") ;;; ;;; o edt-emulation-on o edt-load-keys ;;; -(defconst edt-emacs-variant (if (featurep 'emacs) "gnu" "xemacs") - "Indicates Emacs variant: GNU Emacs or XEmacs (aka Lucid Emacs).") - -(defconst edt-window-system (if (featurep 'emacs) window-system (console-type)) - "Indicates window system (in GNU Emacs) or console type (in XEmacs).") - -(declare-function x-server-vendor "xfns.c" (&optional terminal)) - -(defconst edt-xserver (when (eq edt-window-system 'x) +(defconst edt-xserver (when (eq window-system 'x) ;; The Cygwin window manager has a `/' in its ;; name, which breaks the generated file name of ;; the custom key map file. Replace `/' with a ;; `-' to work around that. - (if (featurep 'xemacs) - (replace-in-string (x-server-vendor) "[ /]" "-") - (replace-regexp-in-string "[ /]" "-" - (x-server-vendor)))) + (replace-regexp-in-string "[ /]" "-" + (x-server-vendor))) "Indicates X server vendor name, if applicable.") (defvar edt-keys-file nil @@ -388,8 +373,7 @@ Argument NUM is the number of page delimiters to move." (error "Beginning of buffer") (progn (backward-page num) - (edt-line-to-top-of-window) - (if (featurep 'xemacs) (setq zmacs-region-stays t))))) + (edt-line-to-top-of-window)))) (defun edt-page (num) "Move in current direction to next page delimiter. @@ -449,8 +433,7 @@ Argument NUM is the number of BOL marks to move." (progn (setq num (1- num)) (forward-line (* -1 num)))) - (edt-top-check beg num)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (edt-top-check beg num))) ;;; @@ -465,8 +448,7 @@ Argument NUM is the number of EOL marks to move." (let ((beg (edt-current-line))) (forward-char) (end-of-line num) - (edt-bottom-check beg num)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (edt-bottom-check beg num))) (defun edt-end-of-line-backward (num) @@ -476,8 +458,7 @@ Argument NUM is the number of EOL marks to move." (edt-check-prefix num) (let ((beg (edt-current-line))) (end-of-line (1- num)) - (edt-top-check beg num)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (edt-top-check beg num))) (defun edt-end-of-line (num) @@ -521,8 +502,7 @@ Argument NUM is the number of EOL marks to move." (not (eobp)) (eq ?\ (char-syntax (following-char))) (not (memq (following-char) edt-word-entities))) - (forward-char)))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (forward-char))))) (defun edt-one-word-backward () "Move backward to first character of previous word." @@ -545,8 +525,7 @@ Argument NUM is the number of EOL marks to move." (not (bobp)) (not (eq ?\ (char-syntax (preceding-char)))) (not (memq (preceding-char) edt-word-entities))) - (backward-char))))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (backward-char)))))) (defun edt-word-forward (num) "Move forward to first character of next word. @@ -585,8 +564,7 @@ Argument NUM is the number of characters to move." (edt-check-prefix num) (if (equal edt-direction-string edt-forward-string) (forward-char num) - (backward-char num)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (backward-char num))) ;;; ;;; LINE @@ -608,8 +586,7 @@ Argument NUM is the number of BOL marks to move." (edt-check-prefix num) (let ((beg (edt-current-line))) (forward-line num) - (edt-bottom-check beg num)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (edt-bottom-check beg num))) (defun edt-line (num) "Move in current direction to next beginning of line mark. @@ -631,8 +608,7 @@ Argument NUM is the number of lines to move." (let ((beg (edt-current-line))) ;; We're deliberately using next-line instead of forward-line. (with-no-warnings (next-line num)) - (edt-bottom-check beg num)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (edt-bottom-check beg num))) (defun edt-previous-line (num) "Move cursor up one line. @@ -642,8 +618,7 @@ Argument NUM is the number of lines to move." (let ((beg (edt-current-line))) ;; We're deliberately using previous-line instead of forward-line. (with-no-warnings (previous-line num)) - (edt-top-check beg num)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (edt-top-check beg num))) ;;; @@ -653,8 +628,7 @@ Argument NUM is the number of lines to move." (defun edt-top () "Move cursor to the beginning of buffer." (interactive) - (goto-char (point-min)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (goto-char (point-min))) ;;; ;;; BOTTOM @@ -703,8 +677,7 @@ Optional argument FIND is t is this function is called from `edt-find'." (if (zerop (setq left (save-excursion (forward-line height)))) (recenter top-margin) (recenter (- left bottom-up-margin))) - (and (> (point) bottom) (recenter bottom-margin))))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (and (> (point) bottom) (recenter bottom-margin)))))) (defun edt-find-backward (&optional find) "Find first occurrence of a string in the backward direction and save it. @@ -715,8 +688,7 @@ Optional argument FIND is t if this function is called from `edt-find'." (edt-with-position (if (search-backward edt-find-last-text) (edt-set-match)) - (and (< (point) top) (recenter (min beg top-margin)))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (and (< (point) top) (recenter (min beg top-margin))))) (defun edt-find () "Find first occurrence of string in current direction and save it." @@ -746,8 +718,7 @@ Optional argument FIND is t if this function is called from `edt-find'." (recenter (- left bottom-up-margin))) (and (> (point) bottom) (recenter bottom-margin)))) (backward-char 1) - (error "Search failed: \"%s\"" edt-find-last-text))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (error "Search failed: \"%s\"" edt-find-last-text)))) (defun edt-find-next-backward () "Find next occurrence of a string in backward direction." @@ -756,8 +727,7 @@ Optional argument FIND is t if this function is called from `edt-find'." (if (not (search-backward edt-find-last-text nil t)) (error "Search failed: \"%s\"" edt-find-last-text) (edt-set-match) - (and (< (point) top) (recenter (min beg top-margin))))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (and (< (point) top) (recenter (min beg top-margin)))))) (defun edt-find-next () "Find next occurrence of a string in current direction." @@ -834,9 +804,7 @@ In select mode, selected text is highlighted." (defun edt-reset () "Cancel text selection." (interactive) - (if (featurep 'emacs) - (deactivate-mark) - (zmacs-deactivate-region))) + (deactivate-mark)) ;;; ;;; CUT @@ -1050,8 +1018,7 @@ Also, execute command specified if in Minibuffer." (force-mode-line-update) (if (string-equal " *Minibuf" (substring (buffer-name) 0 (min (length (buffer-name)) 9))) - (exit-minibuffer)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (exit-minibuffer))) ;;; @@ -1066,8 +1033,7 @@ Also, execute command specified if in Minibuffer." (force-mode-line-update) (if (string-equal " *Minibuf" (substring (buffer-name) 0 (min (length (buffer-name)) 9))) - (exit-minibuffer)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (exit-minibuffer))) ;;; @@ -1117,14 +1083,11 @@ Argument NUM is the numbers of consecutive characters to change." The current key definition is saved in `edt-last-replaced-key-definition'. Use `edt-restore-key' to restore last replaced key definition." (interactive) - (if (featurep 'xemacs) (setq zmacs-region-stays t)) (let (edt-function edt-key-definition) (setq edt-key-definition (read-key-sequence "Press the key to be defined: ")) - (if (if (featurep 'emacs) - (string-equal "\C-m" edt-key-definition) - (string-equal "\C-m" (events-to-keys edt-key-definition))) + (if (string-equal "\C-m" edt-key-definition) (message "Key not defined") (progn (setq edt-function (read-command "Enter command name: ")) @@ -1202,8 +1165,6 @@ Argument LINES is the number of lines the cursor moved toward the bottom." ;; subtract 1 from height because it includes mode line (difference (- height margin 1))) (cond ((> beg difference) (recenter beg)) - ((and (featurep 'xemacs) (> (+ beg lines 1) difference)) - (recenter (- margin))) ((> (+ beg lines) difference) (recenter (- margin)))))) (defun edt-current-line nil @@ -1289,8 +1250,7 @@ Argument NUM is the positive number of sentences to move." (if (zerop (setq left (save-excursion (forward-line height)))) (recenter top-margin) (recenter (- left bottom-up-margin))) - (and (> (point) bottom) (recenter bottom-margin)))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (and (> (point) bottom) (recenter bottom-margin))))) (defun edt-sentence-backward (num) "Move backward to next sentence beginning. @@ -1301,8 +1261,7 @@ Argument NUM is the positive number of sentences to move." (if (eobp) (error "End of buffer") (backward-sentence num)) - (and (< (point) top) (recenter (min beg top-margin)))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (and (< (point) top) (recenter (min beg top-margin))))) (defun edt-sentence (num) "Move in current direction to next sentence. @@ -1332,8 +1291,7 @@ Argument NUM is the positive number of paragraphs to move." (if (zerop (setq left (save-excursion (forward-line height)))) (recenter top-margin) (recenter (- left bottom-up-margin))) - (and (> (point) bottom) (recenter bottom-margin)))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (and (> (point) bottom) (recenter bottom-margin))))) (defun edt-paragraph-backward (num) "Move backward to beginning of paragraph. @@ -1344,8 +1302,7 @@ Argument NUM is the positive number of paragraphs to move." (while (> num 0) (start-of-paragraph-text) (setq num (1- num))) - (and (< (point) top) (recenter (min beg top-margin)))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (and (< (point) top) (recenter (min beg top-margin))))) (defun edt-paragraph (num) "Move in current direction to next paragraph. @@ -1363,24 +1320,18 @@ Argument NUM is the positive number of paragraphs to move." "Restore last replaced key definition. Definition is stored in `edt-last-replaced-key-definition'." (interactive) - (if (featurep 'xemacs) (setq zmacs-region-stays t)) (if edt-last-replaced-key-definition (progn (let (edt-key-definition) (set 'edt-key-definition (read-key-sequence "Press the key to be restored: ")) - (if (if (featurep 'emacs) - (string-equal "\C-m" edt-key-definition) - (string-equal "\C-m" (events-to-keys edt-key-definition))) + (if (string-equal "\C-m" edt-key-definition) (message "Key not restored") (progn (define-key (current-global-map) edt-key-definition edt-last-replaced-key-definition) - (if (featurep 'emacs) - (message "Key definition for %s has been restored." - edt-key-definition) - (message "Key definition for %s has been restored." - (events-to-keys edt-key-definition))))))) + (message "Key definition for %s has been restored." + edt-key-definition))))) (error "No replaced key definition to restore!"))) ;;; @@ -1392,8 +1343,7 @@ Definition is stored in `edt-last-replaced-key-definition'." (interactive) (let ((start-column (current-column))) (move-to-window-line 0) - (move-to-column start-column)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (move-to-column start-column))) ;;; ;;; WINDOW BOTTOM @@ -1404,8 +1354,7 @@ Definition is stored in `edt-last-replaced-key-definition'." (interactive) (let ((start-column (current-column))) (move-to-window-line (- (window-height) 2)) - (move-to-column start-column)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (move-to-column start-column))) ;;; ;;; SCROLL WINDOW LINE @@ -1414,14 +1363,12 @@ Definition is stored in `edt-last-replaced-key-definition'." (defun edt-scroll-window-forward-line () "Move window forward one line leaving cursor at position in window." (interactive) - (scroll-up 1) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (scroll-up 1)) (defun edt-scroll-window-backward-line () "Move window backward one line leaving cursor at position in window." (interactive) - (scroll-down 1) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (scroll-down 1)) (defun edt-scroll-line () "Move window one line in current direction." @@ -1467,8 +1414,7 @@ Argument NUM is the positive number of windows to move." (defun edt-line-to-bottom-of-window () "Move the current line to the bottom of the window." (interactive) - (recenter -1) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (recenter -1)) ;;; ;;; LINE TO TOP OF WINDOW @@ -1477,8 +1423,7 @@ Argument NUM is the positive number of windows to move." (defun edt-line-to-top-of-window () "Move the current line to the top of the window." (interactive) - (recenter 0) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (recenter 0)) ;;; ;;; LINE TO MIDDLE OF WINDOW @@ -1487,8 +1432,7 @@ Argument NUM is the positive number of windows to move." (defun edt-line-to-middle-of-window () "Move window so line with cursor is in the middle of the window." (interactive) - (recenter '(4)) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (recenter '(4))) ;;; ;;; GOTO PERCENTAGE @@ -1500,8 +1444,7 @@ Argument NUM is the percentage into the buffer to move." (interactive "NGoto-percentage: ") (if (or (> num 100) (< num 0)) (error "Percentage %d out of range 0 < percent < 100" num) - (goto-char (/ (* (point-max) num) 100))) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (goto-char (/ (* (point-max) num) 100)))) ;;; ;;; FILL REGION @@ -1673,7 +1616,6 @@ Argument NUM is the number of times to duplicate the line." (defun edt-display-the-time () "Display the current time." (interactive) - (if (featurep 'xemacs) (setq zmacs-region-stays t)) (message "%s" (current-time-string))) ;;; @@ -1701,9 +1643,7 @@ Argument NUM is the number of times to duplicate the line." (let (edt-key-definition) (set 'edt-key-definition (read-key-sequence "Enter key for binding: ")) - (if (if (featurep 'emacs) - (string-equal "\C-m" edt-key-definition) - (string-equal "\C-m" (events-to-keys edt-key-definition))) + (if (string-equal "\C-m" edt-key-definition) (message "Key sequence not remembered") (progn (set 'edt-learn-macro-count (+ edt-learn-macro-count 1)) @@ -1753,8 +1693,7 @@ Warn user that modifications will be lost." "Split current window and place cursor in the new window." (interactive) (split-window) - (other-window 1) - (if (featurep 'xemacs) (setq zmacs-region-stays t))) + (other-window 1)) ;;; ;;; COPY RECTANGLE @@ -1935,9 +1874,8 @@ Optional argument NOT-YES changes the default to negative." (defun edt-load-keys (file) "Load the LK-201 key mapping FILE generated by edt-mapper.el. If FILE is nil, which is the normal case, try to load a default file. -The default file names are based upon the window system, terminal -type, and version of Emacs in use: GNU Emacs or XEmacs (aka Lucid -Emacs). If a default file does not exist, ask user if one should be +The default file names are based upon the window system and terminal +type. If a default file does not exist, ask user if one should be created." (interactive "fKey definition file: ") (cond (file @@ -1948,11 +1886,11 @@ created." (setq file (expand-file-name (concat - "~/.edt-" edt-emacs-variant + "~/.edt-gnu" (if edt-term (concat "-" edt-term)) (if edt-xserver (concat "-" edt-xserver)) - (if edt-window-system - (concat "-" (upcase (symbol-name edt-window-system)))) + (if window-system + (concat "-" (upcase (symbol-name window-system)))) "-keys"))))) (cond ((file-readable-p file) (load-file file)) @@ -2002,15 +1940,14 @@ created." "Turn on EDT Emulation." (interactive) ;; If using pc window system (MS-DOS), set terminal type to pc. - ;; If not a window system (GNU) or a tty window system (XEmacs), - ;; get terminal type. - (if (eq edt-window-system 'pc) + ;; If not a window system, get terminal type. + (if (eq window-system 'pc) (setq edt-term "pc") - (if (or (not edt-window-system) (eq edt-window-system 'tty)) + (if (not window-system) (setq edt-term (getenv "TERM")))) ;; Look for a terminal configuration file for this terminal type. ;; Otherwise, load the user's custom configuration file. - (if (or (not edt-window-system) (memq edt-window-system '(pc tty))) + (if (or (not window-system) (memq window-system '(pc tty))) (progn ;; Load terminal-specific configuration file, if it exists for this ;; terminal type. Note: All DEC VT series terminals are supported @@ -2037,27 +1974,14 @@ created." (setq edt-term term)))) (edt-load-keys nil)) ;; Make highlighting of selected text work properly for EDT commands. - (if (featurep 'emacs) - (progn - (setq edt-orig-transient-mark-mode - (default-value 'transient-mark-mode)) - (add-hook 'activate-mark-hook - (function - (lambda () - (edt-select-mode t)))) - (add-hook 'deactivate-mark-hook - (function - (lambda () - (edt-select-mode nil))))) - (progn - (add-hook 'zmacs-activate-region-hook - (function - (lambda () - (edt-select-mode t)))) - (add-hook 'zmacs-deactivate-region-hook - (function - (lambda () - (edt-select-mode nil)))))) + (setq edt-orig-transient-mark-mode + (default-value 'transient-mark-mode)) + (add-hook 'activate-mark-hook + (lambda () + (edt-select-mode t))) + (add-hook 'deactivate-mark-hook + (lambda () + (edt-select-mode nil))) ;; Load user's EDT custom key bindings file, if it exists. ;; Otherwise, use the default bindings. (if (load "edt-user" t t) @@ -2074,8 +1998,7 @@ created." (setq edt-select-mode-current nil) (edt-reset) (force-mode-line-update t) - (if (featurep 'emacs) - (setq-default transient-mark-mode edt-orig-transient-mark-mode)) + (setq-default transient-mark-mode edt-orig-transient-mark-mode) (message "Original key bindings restored; EDT Emulation disabled")) (defun edt-default-menu-bar-update-buffers () @@ -2103,9 +2026,7 @@ Optional argument USER-SETUP non-nil means called from function ;; disturbing the original bindings in global-map. (fset 'edt-default-ESC-prefix (copy-keymap 'ESC-prefix)) (setq edt-default-global-map (copy-keymap (current-global-map))) - (if (featurep 'emacs) - (define-key edt-default-global-map "\e" 'edt-default-ESC-prefix) - (define-key edt-default-global-map [escape] 'edt-default-ESC-prefix)) + (define-key edt-default-global-map "\e" 'edt-default-ESC-prefix) (define-prefix-command 'edt-default-gold-map) (edt-setup-default-bindings) ;; If terminal has additional function keys, the terminal-specific @@ -2141,9 +2062,7 @@ Optional argument USER-SETUP non-nil means called from function ;; Setup user EDT global map by copying default EDT global map bindings. (fset 'edt-user-ESC-prefix (copy-keymap 'edt-default-ESC-prefix)) (setq edt-user-global-map (copy-keymap edt-default-global-map)) - (if (featurep 'emacs) - (define-key edt-user-global-map "\e" 'edt-user-ESC-prefix) - (define-key edt-user-global-map [escape] 'edt-user-ESC-prefix)) + (define-key edt-user-global-map "\e" 'edt-user-ESC-prefix) ;; If terminal has additional function keys, the user's initialization ;; file can assign bindings to them via the optional ;; function edt-setup-extra-default-bindings. @@ -2160,8 +2079,7 @@ Optional argument USER-SETUP non-nil means called from function (defun edt-select-default-global-map() "Select default EDT emulation key bindings." (interactive) - (if (featurep 'emacs) - (transient-mark-mode 1)) + (transient-mark-mode 1) (use-global-map edt-default-global-map) (if (not edt-keep-current-page-delimiter) (progn @@ -2178,8 +2096,7 @@ Optional argument USER-SETUP non-nil means called from function (interactive) (if edt-user-map-configured (progn - (if (featurep 'emacs) - (transient-mark-mode 1)) + (transient-mark-mode 1) (use-global-map edt-user-global-map) (if (not edt-keep-current-page-delimiter) (progn commit b16f19626c468647de570e43c9b18db5bd5e7638 Author: Lars Ingebrigtsen Date: Wed Oct 9 20:07:56 2019 +0200 Move the "Skeleton Language" node to later in the manual * doc/misc/autotype.texi (Skeleton Language): Move this low-level node to after the more user-facing nodes (bug#20780). diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi index a354383cc9..89cba183a2 100644 --- a/doc/misc/autotype.texi +++ b/doc/misc/autotype.texi @@ -86,7 +86,6 @@ completions and expansions of text at point. * Using Skeletons:: How to insert a skeleton into your text. * Wrapping Skeletons:: Putting existing text within a skeleton. * Skeletons as Abbrevs:: An alternative for issuing skeleton commands. -* Skeleton Language:: Making skeleton commands insert what you want. * Inserting Pairs:: Typing one character and getting another after point. * Autoinserting:: Filling up empty files as soon as you visit them. @@ -96,6 +95,7 @@ completions and expansions of text at point. * QuickURL:: Inserting URLs based on text at point. * Tempo:: Flexible template insertion. * Hippie Expand:: Expansion of text trying various methods. +* Skeleton Language:: Making skeleton commands insert what you want. * GNU Free Documentation License:: The license for this documentation. * Concept Index:: @@ -209,105 +209,6 @@ have been omitted.) -@node Skeleton Language -@chapter Skeleton Language -@cindex skeleton language - -@findex skeleton-insert - Skeletons are a shorthand extension to the Lisp language, where various -atoms directly perform either actions on the current buffer or rudimentary -flow control mechanisms. Skeletons are interpreted by the function -@code{skeleton-insert}. - - A skeleton is a list starting with an interactor, which is usually a -prompt-string, or @code{nil} when not needed, but can also be a Lisp -expression for complex read functions or for returning some calculated value. -The rest of the list are any number of elements as described in the following -table: - -@table @asis -@item @code{"@var{string}"}, @code{?@var{c}}, @code{?\@var{c}} -@vindex skeleton-transformation -Insert string or character. Literal strings and characters are passed through -@code{skeleton-transformation} when that is non-@code{nil}. -@item @code{?\n} -@c ??? something seems very wrong here. -Insert a newline and align under current line, but not if this is the -last element of a skeleton and the newline would be inserted at end of -line, or this is the first element and the newline would be inserted -at beginning of line. Use newline character @code{?\n} to prevent -alignment. Use @code{"\n"} as the first or last string element of a -skeleton to insert a newline unconditionally. -@item @code{_} -Interesting point. When wrapping skeletons around successive regions, they are -put at these places. Point is left at first @code{_} where nothing is -wrapped. -@item @code{-} -Interesting point with no inter-region interaction; overrides -interesting point set by @code{_}. -@item @code{>} -Indent line according to major mode. When following element is @code{_}, and -there is an interregion that will be wrapped here, indent that interregion. -@item @code{&} -Logical and. If preceding element moved point, i.e., usually inserted -something, do following element. -@item @code{|} -Logical xor. If preceding element didn't move point, i.e., usually inserted -nothing, do following element. -@item @code{@@} -Add position to @code{skeleton-positions}. -@item @code{-@var{number}} -Delete preceding number characters. Depends on value of -@code{skeleton-untabify}. -@item @code{()} or @code{nil} -Ignored. -@item @var{lisp-expression} -Evaluated, and the return value is again interpreted as a skeleton element. -@item @code{str} -A special variable that, when evaluated the first time, usually prompts -for input according to the skeleton's interactor. It is then set to the -return value resulting from the interactor. Each subskeleton has its local -copy of this variable. -@item @code{v1}, @code{v2} -Skeleton-local user variables. -@item @code{'@var{expression}} -Evaluate following Lisp expression for its side-effect, but prevent it from -being interpreted as a skeleton element. -@item @var{skeleton} -Subskeletons are inserted recursively, not once, but as often as the user -enters something at the subskeletons interactor. Thus there must be a -@code{str} in the subskeleton. They can also be used non-interactively, when -prompt is a lisp-expression that returns successive list-elements. -@item @code{resume:} -Ignored. Execution resumes here if the user quits during skeleton -interpretation. -@item @code{help} -Help form during interaction with the user or @code{nil}. -@item @code{input} -Initial input (a string or a cons with index) while reading the input. -@item @code{quit} -A constant which is non-@code{nil} when the @code{resume:} section was entered -because the user quit. -@end table - -@findex skeleton-further-elements - Some modes also use other skeleton elements they themselves defined. For -example in shell script mode's skeletons you will find @code{<} which does a -rigid indentation backwards, or in CC mode's skeletons you find the -self-inserting elements @code{@{} and @code{@}}. These are defined by the -buffer-local variable @code{skeleton-further-elements} which is a list of -variables bound while interpreting a skeleton. - -@findex define-skeleton - The macro @code{define-skeleton} defines a command for interpreting a -skeleton. The first argument is the command name, the second is a -documentation string, and the rest is an interactor and any number of skeleton -elements together forming a skeleton. This skeleton is assigned to a variable -of the same name as the command and can thus be overridden from your -@file{~/.emacs} file (@pxref{Init File,,, emacs, The GNU Emacs Manual}). - - - @node Inserting Pairs @chapter Inserting Matching Pairs of Characters @cindex inserting pairs @@ -656,6 +557,104 @@ Typically you would bind @code{hippie-expand} to @kbd{M-/} with @code{dabbrev-expand}, the standard binding of @kbd{M-/}, providing one of the expansion possibilities. +@node Skeleton Language +@chapter Skeleton Language +@cindex skeleton language + +@findex skeleton-insert + Skeletons are a shorthand extension to the Lisp language, where various +atoms directly perform either actions on the current buffer or rudimentary +flow control mechanisms. Skeletons are interpreted by the function +@code{skeleton-insert}. + + A skeleton is a list starting with an interactor, which is usually a +prompt-string, or @code{nil} when not needed, but can also be a Lisp +expression for complex read functions or for returning some calculated value. +The rest of the list are any number of elements as described in the following +table: + +@table @asis +@item @code{"@var{string}"}, @code{?@var{c}}, @code{?\@var{c}} +@vindex skeleton-transformation +Insert string or character. Literal strings and characters are passed through +@code{skeleton-transformation} when that is non-@code{nil}. +@item @code{?\n} +@c ??? something seems very wrong here. +Insert a newline and align under current line, but not if this is the +last element of a skeleton and the newline would be inserted at end of +line, or this is the first element and the newline would be inserted +at beginning of line. Use newline character @code{?\n} to prevent +alignment. Use @code{"\n"} as the first or last string element of a +skeleton to insert a newline unconditionally. +@item @code{_} +Interesting point. When wrapping skeletons around successive regions, they are +put at these places. Point is left at first @code{_} where nothing is +wrapped. +@item @code{-} +Interesting point with no inter-region interaction; overrides +interesting point set by @code{_}. +@item @code{>} +Indent line according to major mode. When following element is @code{_}, and +there is an interregion that will be wrapped here, indent that interregion. +@item @code{&} +Logical and. If preceding element moved point, i.e., usually inserted +something, do following element. +@item @code{|} +Logical xor. If preceding element didn't move point, i.e., usually inserted +nothing, do following element. +@item @code{@@} +Add position to @code{skeleton-positions}. +@item @code{-@var{number}} +Delete preceding number characters. Depends on value of +@code{skeleton-untabify}. +@item @code{()} or @code{nil} +Ignored. +@item @var{lisp-expression} +Evaluated, and the return value is again interpreted as a skeleton element. +@item @code{str} +A special variable that, when evaluated the first time, usually prompts +for input according to the skeleton's interactor. It is then set to the +return value resulting from the interactor. Each subskeleton has its local +copy of this variable. +@item @code{v1}, @code{v2} +Skeleton-local user variables. +@item @code{'@var{expression}} +Evaluate following Lisp expression for its side-effect, but prevent it from +being interpreted as a skeleton element. +@item @var{skeleton} +Subskeletons are inserted recursively, not once, but as often as the user +enters something at the subskeletons interactor. Thus there must be a +@code{str} in the subskeleton. They can also be used non-interactively, when +prompt is a lisp-expression that returns successive list-elements. +@item @code{resume:} +Ignored. Execution resumes here if the user quits during skeleton +interpretation. +@item @code{help} +Help form during interaction with the user or @code{nil}. +@item @code{input} +Initial input (a string or a cons with index) while reading the input. +@item @code{quit} +A constant which is non-@code{nil} when the @code{resume:} section was entered +because the user quit. +@end table + +@findex skeleton-further-elements + Some modes also use other skeleton elements they themselves defined. For +example in shell script mode's skeletons you will find @code{<} which does a +rigid indentation backwards, or in CC mode's skeletons you find the +self-inserting elements @code{@{} and @code{@}}. These are defined by the +buffer-local variable @code{skeleton-further-elements} which is a list of +variables bound while interpreting a skeleton. + +@findex define-skeleton + The macro @code{define-skeleton} defines a command for interpreting a +skeleton. The first argument is the command name, the second is a +documentation string, and the rest is an interactor and any number of skeleton +elements together forming a skeleton. This skeleton is assigned to a variable +of the same name as the command and can thus be overridden from your +@file{~/.emacs} file (@pxref{Init File,,, emacs, The GNU Emacs Manual}). + + @node GNU Free Documentation License @appendix GNU Free Documentation License @include doclicense.texi commit 50886f0992cf824f87a501cc8d8d8f62e7d2762a Author: Lars Ingebrigtsen Date: Wed Oct 9 19:27:17 2019 +0200 Add a letrec example to the manuel * doc/lispref/variables.texi (Local Variables): Add a letrec example. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 02e156396d..89dac4f7a4 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -273,7 +273,17 @@ before any of the local values are computed. The values are then assigned to the locally bound variables. This is only useful when lexical binding is in effect, and you want to create closures that refer to bindings that would otherwise not yet be in effect when using -@code{let}. +@code{let*}. + +For instance, here's a closure that removes itself from a hook after +being run once: + +@lisp +(letrec ((hookfun (lambda () + (message "Run once") + (remove-hook 'post-command-hook hookfun)))) + (add-hook 'post-command-hook hookfun)) +@end lisp @end defspec Here is a complete list of the other facilities that create local commit fe2e29d29b50b378545632fb730209de6e5532d5 Author: Lars Ingebrigtsen Date: Wed Oct 9 18:42:36 2019 +0200 Tweak letrec documentation * doc/lispref/variables.texi (Local Variables): Compare letrec to let* instead of let. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 8d6cc29380..02e156396d 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -268,7 +268,7 @@ Compare the following example with the example above for @code{let}. @end defspec @defspec letrec (bindings@dots{}) forms@dots{} -This special form is like @code{let}, but all the variables are bound +This special form is like @code{let*}, but all the variables are bound before any of the local values are computed. The values are then assigned to the locally bound variables. This is only useful when lexical binding is in effect, and you want to create closures that commit 600bcde608479fc454e4794add84905d6337d3fa Author: Stephen Gildea Date: Wed Oct 9 09:19:10 2019 -0700 time-stamp: revert recent change to "%04y" * time-stamp.el (time-stamp-string-preprocess): Revert change to "%04y" format made 2 weeks ago by commit 0e56883878 (the previous commit to this file). Although undocumented, "%04y" was discovered to be in use in the wild (2016) and had not issued a warning that it would change. Add a warning that it will change. * time-stamp-tests.el (time-stamp-test-year-2digit): add test of "%04y" diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 4fb28b2fd3..284dd48d4f 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -545,7 +545,11 @@ and all `time-stamp-format' compatibility." ((eq cur-char ?y) ;year (if alt-form (string-to-number (time-stamp--format "%Y" time)) - (string-to-number (time-stamp--format "%y" time)))) + (if (or (string-equal field-width "") + (<= (string-to-number field-width) 2)) + (string-to-number (time-stamp--format "%y" time)) + (time-stamp-conv-warn (format "%%%sy" field-width) "%Y") + (string-to-number (time-stamp--format "%Y" time))))) ((eq cur-char ?Y) ;4-digit year (string-to-number (time-stamp--format "%Y" time))) ((eq cur-char ?z) ;time zone lower case @@ -630,8 +634,7 @@ The new forms being recommended now will continue to work then.") (defun time-stamp-conv-warn (old-form new-form) "Display a warning about a soon-to-be-obsolete format. -Suggests replacing OLD-FORM with NEW-FORM. -In use before 2019 changes; will be used again after those changes settle." +Suggests replacing OLD-FORM with NEW-FORM." (cond (time-stamp-conversion-warn (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*") @@ -640,7 +643,7 @@ In use before 2019 changes; will be used again after those changes settle." (progn (insert "The formats recognized in time-stamp-format will change in a future release\n" - "to be compatible with the new, expanded format-time-string function.\n\n" + "to be more compatible with the format-time-string function.\n\n" "The following obsolescent time-stamp-format construct(s) were found:\n\n"))) (insert "\"" old-form "\" -- use " new-form "\n")) (display-buffer "*Time-stamp-compatibility*")))) diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 287b5f486c..ace5e58e36 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -46,8 +46,7 @@ (put 'with-time-stamp-test-env 'lisp-indent-hook 'defun) (defmacro time-stamp-should-warn (form) - "Similar to `should' but verifies that a format warning is generated. -In use before 2019 changes; will be used again after those changes settle." + "Similar to `should' but verifies that a format warning is generated." `(let ((warning-count 0)) (cl-letf (((symbol-function 'time-stamp-conv-warn) (lambda (_old _new) @@ -266,7 +265,10 @@ In use before 2019 changes; will be used again after those changes settle." (should (equal (time-stamp-string "%_y" ref-time) " 6")) (should (equal (time-stamp-string "%_y" ref-time2) "16")) (should (equal (time-stamp-string "%y" ref-time) "06")) - (should (equal (time-stamp-string "%y" ref-time2) "16")))) + (should (equal (time-stamp-string "%y" ref-time2) "16")) + ;; implemented since 1995, warned since 2019, will change + (time-stamp-should-warn (equal (time-stamp-string "%04y" ref-time) "2006")) + (time-stamp-should-warn (equal (time-stamp-string "%4y" ref-time) "2006")))) (ert-deftest time-stamp-test-year-4digit () "Test time-stamp format %Y." commit 3d57c829af571465c261d9f865eeee5ed3cae985 Author: Simen Heggestøyl Date: Sat Jan 27 12:18:40 2018 +0100 Warn about missing executables in RST PDF preview * lisp/textmodes/rst.el (rst-compile-pdf-preview): Warn about missing executables when attempting to compile and preview an RST file as PDF. (Bug#30063) diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index b7438fbb10..ce9e633511 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -4380,10 +4380,15 @@ buffer, if the region is not selected." "Convert the document to a PDF file and launch a preview program." (interactive) (let* ((tmp-filename (make-temp-file "rst_el" nil ".pdf")) + (pdf-compile-program (cadr (assq 'pdf rst-compile-toolsets))) (command (format "%s %s %s && %s %s ; rm %s" - (cadr (assq 'pdf rst-compile-toolsets)) + pdf-compile-program buffer-file-name tmp-filename rst-pdf-program tmp-filename tmp-filename))) + (unless (executable-find pdf-compile-program) + (error "Cannot find executable `%s'" pdf-compile-program)) + (unless (executable-find rst-pdf-program) + (error "Cannot find executable `%s'" rst-pdf-program)) (start-process-shell-command "rst-pdf-preview" nil command) ;; Note: you could also use (compile command) to view the compilation ;; output. commit 697a7a1497d053d6070432d3a48824e01082ca42 Author: Stephen Gildea Date: Wed Oct 9 09:06:23 2019 -0700 Expand testing of time-stamp format "%y" * time-stamp-tests.el (time-stamp-test-year): break into two tests, time-stamp-test-year-2digit and time-stamp-test-year-4digit. Expand time-stamp-test-year-2digit to look more like tests for other 2-digit conversions. diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index d710564c36..287b5f486c 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -248,6 +248,32 @@ In use before 2019 changes; will be used again after those changes settle." (should (equal (time-stamp-string "%S" ref-time) "05")) (should (equal (time-stamp-string "%S" ref-time2) "15")))) +(ert-deftest time-stamp-test-year-2digit () + "Test time-stamp formats for %y." + (with-time-stamp-test-env + ;; implemented and documented since 1995 + (should (equal (time-stamp-string "%02y" ref-time) "06")) + (should (equal (time-stamp-string "%02y" ref-time2) "16")) + ;; documented 1997-2019 + (should (equal (time-stamp-string "%:y" ref-time) "2006")) + (should (equal (time-stamp-string "%:y" ref-time2) "2016")) + ;; warned 1997-2019, changed in 2019 + ;; (We don't expect the %-y or %_y form to be useful, + ;; but we test both so that we can confidently state that + ;; `-' and `_' affect all 2-digit conversions identically.) + (should (equal (time-stamp-string "%-y" ref-time) "6")) + (should (equal (time-stamp-string "%-y" ref-time2) "16")) + (should (equal (time-stamp-string "%_y" ref-time) " 6")) + (should (equal (time-stamp-string "%_y" ref-time2) "16")) + (should (equal (time-stamp-string "%y" ref-time) "06")) + (should (equal (time-stamp-string "%y" ref-time2) "16")))) + +(ert-deftest time-stamp-test-year-4digit () + "Test time-stamp format %Y." + (with-time-stamp-test-env + ;; implemented since 1997, documented since 2019 + (should (equal (time-stamp-string "%Y" ref-time) "2006")))) + (ert-deftest time-stamp-test-am-pm () "Test time-stamp formats for AM and PM strings." (with-time-stamp-test-env @@ -267,18 +293,6 @@ In use before 2019 changes; will be used again after those changes settle." (should (equal (time-stamp-string "%w" ref-time2) "5")) (should (equal (time-stamp-string "%w" ref-time3) "0")))) -(ert-deftest time-stamp-test-year () - "Test time-stamp formats for year." - (with-time-stamp-test-env - ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%02y" ref-time) "06")) - ;; documented 1997-2019 - (should (equal (time-stamp-string "%:y" ref-time) "2006")) - ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%Y" ref-time) "2006")) - ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%y" ref-time) "06")))) - (ert-deftest time-stamp-test-time-zone () "Test time-stamp formats for time zone." (with-time-stamp-test-env commit 6fa1558ca56c20226821e440a70129ece7b808b6 Author: Juanma Barranquero Date: Wed Oct 9 15:43:07 2019 +0200 Silence compiler warning * src/w32.c (acl_to_text): Add ATTRIBUTE_MALLOC. diff --git a/src/w32.c b/src/w32.c index 55e471f14c..26ea15d891 100644 --- a/src/w32.c +++ b/src/w32.c @@ -6259,7 +6259,7 @@ acl_valid (acl_t acl) return is_valid_security_descriptor ((PSECURITY_DESCRIPTOR)acl) ? 0 : -1; } -char * +char * ATTRIBUTE_MALLOC acl_to_text (acl_t acl, ssize_t *size) { LPTSTR str_acl; commit 0f397e8dd4813c31e417e4edaa5cd3c1360c0b0d Author: Robert Pluim Date: Wed Oct 9 15:16:07 2019 +0200 ; Fix typo in previous commit * lisp/replace.el (query-replace-read-from): Fix typo in docstring. diff --git a/lisp/replace.el b/lisp/replace.el index d81eba3c7a..09482fab82 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -176,7 +176,7 @@ See `replace-regexp' and `query-replace-regexp-eval'.") (defun query-replace-read-from (prompt regexp-flag) "Query and return the `from' argument of a query-replace operation. -Prompt with PROMT. REGEXP-FLAG non-nil means the response should be a regexp. +Prompt with PROMPT. REGEXP-FLAG non-nil means the response should be a regexp. The return value can also be a pair (FROM . TO) indicating that the user wants to replace FROM with TO." (if query-replace-interactive commit b5fbefdac66613e9dedc168d5a356a384a6d4f3f Author: Robert Pluim Date: Wed Oct 9 15:12:18 2019 +0200 Expand documentation on Lisp variables defined in C sources * doc/lispref/internals.texi (Writing Emacs Primitives): Add description of DEFVAR_* arguments. Describe variable naming conventions. Explain how to express quoting of symbols in C, plus 'specbind' and how to create buffer-local variables. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 9fb826c93b..ab385168af 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -945,7 +945,7 @@ of these functions are called, and add a call to @anchor{Defining Lisp variables in C} @vindex byte-boolean-vars @cindex defining Lisp variables in C -@cindex @code{DEFVAR_INT}, @code{DEFVAR_LISP}, @code{DEFVAR_BOOL} +@cindex @code{DEFVAR_INT}, @code{DEFVAR_LISP}, @code{DEFVAR_BOOL}, @code{DEFSYM} The function @code{syms_of_@var{filename}} is also the place to define any C variables that are to be visible as Lisp variables. @code{DEFVAR_LISP} makes a C variable of type @code{Lisp_Object} visible @@ -956,15 +956,78 @@ with a value that is either @code{t} or @code{nil}. Note that variables defined with @code{DEFVAR_BOOL} are automatically added to the list @code{byte-boolean-vars} used by the byte compiler. + These macros all expect three arguments: + +@table @code +@item lname +The name of the variable to be used by Lisp programs. +@item vname +The name of the variable in the C sources. +@item doc +The documentation for the variable, as a C +comment. @xref{Documentation Basics} for more details. +@end table + + By convention, when defining variables of a ``native'' type +(@code{int} and @code{bool}), the name of the C variable is the name +of the Lisp variable with @code{-} replaced by @code{_}. When the +variable has type @code{Lisp_Object}, the convention is to also prefix +the C variable name with @code{V}. i.e. + +@smallexample +DEFVAR_INT ("my-int-variable", my_int_variable, + doc: /* An integer variable. */); + +DEFVAR_LISP ("my-lisp-variable", Vmy_lisp_variable, + doc: /* A Lisp variable. */); +@end smallexample + + There are situations in Lisp where you need to refer to the symbol +itself rather than the value of that symbol. One such case is when +temporarily overriding the value of a variable, which in Lisp is done +with @code{let}. In C sources, this is done by defining a +corresponding, constant symbol, and using @code{specbind}. By +convention, @code{Qmy_lisp_variable} corresponds to +@code{Vmy_lisp_variable}; to define it, use the @code{DEFSYM} macro. +i.e. + +@smallexample +DEFSYM (Qmy_lisp_variable, "my-lisp-variable"); +@end smallexample + + To perform the actual binding: + +@smallexample +specbind (Qmy_lisp_variable, Qt); +@end smallexample + + In Lisp symbols sometimes need to be quoted, to achieve the same +effect in C you again use the corresponding constant symbol +@code{Qmy_lisp_variable}. For example, when creating a buffer-local +variable (@pxref{Buffer-Local Variables}) in Lisp you would write: + +@smallexample +(make-variable-buffer-local 'my-lisp-variable) +@end smallexample + +In C the corresponding code uses @code{Fmake_variable_buffer_local} in +combination with @code{DEFSYM}, i.e. + +@smallexample +DEFSYM (Qmy_lisp_variable, "my-lisp-variable"); +Fmake_variable_buffer_local (Qmy_lisp_variable); +@end smallexample + @cindex defining customization variables in C If you want to make a Lisp variable that is defined in C behave like one declared with @code{defcustom}, add an appropriate entry to -@file{cus-start.el}. +@file{cus-start.el}. @xref{Variable Definitions}, for a description of +the format to use. @cindex @code{staticpro}, protection from GC - If you define a file-scope C variable of type @code{Lisp_Object}, -you must protect it from garbage-collection by calling @code{staticpro} -in @code{syms_of_@var{filename}}, like this: + If you directly define a file-scope C variable of type +@code{Lisp_Object}, you must protect it from garbage-collection by +calling @code{staticpro} in @code{syms_of_@var{filename}}, like this: @example staticpro (&@var{variable}); commit e26c19b88906663fb66ca58d84b85ad336d84f49 Author: Michael Albinus Date: Wed Oct 9 13:56:58 2019 +0200 * doc/misc/tramp.texi (Remote shell setup): Howto configure local shell. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index ba0545c38d..f34484ba71 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2101,7 +2101,7 @@ be recomputed. To force @value{tramp} to recompute afresh, call @section Remote shell setup hints -@subsection Changing the default remote shell +@subsection Changing the default remote or local shell @cindex zsh setup Per default, @value{tramp} uses the command @command{/bin/sh} for @@ -2123,9 +2123,22 @@ remote login shell, like @option{sshx} or @option{plink}. See @ref{Inline methods} and @ref{External methods} for connection methods which support this. +@vindex tramp-sh-extra-args This approach has also the advantage, that settings in -@code{tramp-sh-extra-args} will be applied. For zsh, the trouble -with the shell prompt due to set zle options will be avoided. +@code{tramp-sh-extra-args} will be applied. For @command{zsh}, the +trouble with the shell prompt due to set zle options will be avoided. + +Similar problems can happen with the local shell Tramp uses to create +a process. Per default, it uses the command @command{/bin/sh} for +this, which could also be a link to another shell. In order to +overwrite this, you might apply + +@vindex tramp-encoding-shell +@lisp +(customize-set-variable 'tramp-encoding-shell "/usr/bin/zsh") +@end lisp + +This uses also the settings in @code{tramp-sh-extra-args}. @subsection Other remote shell setup hints commit 0691fdc410bf53eb82508d23ec19a1d4abda1c2a Author: Michael Albinus Date: Wed Oct 9 12:58:43 2019 +0200 Support zsh as local shell in Tramp (Bug#31924) * lisp/net/tramp-sh.el (tramp-sh-extra-args): Extend zsh arguments. Add :version. (tramp-maybe-open-connection): Use extra args for `tramp-encoding-shell'. (Bug#31924) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index a53eea429d..2e57f7e1c7 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -537,7 +537,7 @@ based on the Tramp and Emacs versions, and should not be set here." ;;;###tramp-autoload (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile") - ("/zsh\\'" . "-f +Z")) + ("/zsh\\'" . "-f +Z -V")) "Alist specifying extra arguments to pass to the remote shell. Entries are (REGEXP . ARGS) where REGEXP is a regular expression matching the shell file name and ARGS is a string specifying the @@ -547,6 +547,7 @@ This variable is only used when Tramp needs to start up another shell for tilde expansion. The extra arguments should typically prevent the shell from reading its init file." :group 'tramp + :version "27.1" :type '(alist :key-type regexp :value-type string)) (defconst tramp-actions-before-shell @@ -4869,6 +4870,7 @@ connection if a previous connection has died for some reason." ;; W32 systems. (process-coding-system-alist nil) (coding-system-for-read nil) + (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 @@ -4877,10 +4879,11 @@ connection if a previous connection has died for some reason." #'start-process (tramp-get-connection-name vec) (tramp-get-connection-buffer vec) - (if tramp-encoding-command-interactive - (list tramp-encoding-shell - tramp-encoding-command-interactive) - (list tramp-encoding-shell)))))) + (append + (list tramp-encoding-shell) + (and tramp-encoding-command-interactive + (list tramp-encoding-command-interactive)) + (and extra-args (split-string extra-args))))))) ;; Set sentinel and query flag. Initialize variables. (set-process-sentinel p #'tramp-process-sentinel) commit 76a9f03ca629d3e5a596c3aa7f62a4649ac2ae8a Author: Juanma Barranquero Date: Wed Oct 9 12:49:39 2019 +0200 Implement offsets for absolute line numbers * src/xdisp.c (syms_of_xdisp) : New variable to add an offset to absolute line numbers. (syms_of_xdisp) : Mention it in docstring. (maybe_produce_line_number): Use it. * doc/emacs/display.texi (Display Custom): Document it. * etc/NEWS (value): Announce it. * lisp/frame.el: Add `display-line-numbers-offset' to list of variables which should trigger redisplay of the current buffer. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 406feb8c12..cb37ef448e 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1855,6 +1855,13 @@ the variable @code{display-line-numbers-widen} to a non-@code{nil} value, line numbers will disregard any narrowing and will start at the first character of the buffer. +@vindex display-line-numbers-offset +If the value of @code{display-line-numbers-offset} is non-zero, it is +added to each absolute line number, and lines are counted from the +beginning of the buffer, as if @code{display-line-numbers-widen} were +non-@code{nil}. It has no effect when set to zero, or when line +numbers are not absolute. + @vindex display-line-numbers-width-start @vindex display-line-numbers-grow-only @vindex display-line-numbers-width diff --git a/etc/NEWS b/etc/NEWS index 2ca681ff9b..49aa7f6007 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -560,11 +560,15 @@ now prompts the user for the directory containing the desktop file. +++ ** display-line-numbers-mode + *** New faces 'line-number-major-tick' and 'line-number-minor-tick', and customizable variables 'display-line-numbers-major-tick' and 'display-line-numbers-minor-tick' can be used to highlight the line numbers of lines multiple of certain numbers. +*** New variable `display-line-numbers-offset', when non-zero, adds +an offset to absolute line numbers. + +++ ** winner *** A new variable, 'winner-boring-buffers-regexp', has been added. diff --git a/lisp/frame.el b/lisp/frame.el index 51b3b621ff..018c2f578e 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2726,6 +2726,7 @@ See also `toggle-frame-maximized'." display-line-numbers-widen display-line-numbers-major-tick display-line-numbers-minor-tick + display-line-numbers-offset display-fill-column-indicator display-fill-column-indicator-column display-fill-column-indicator-character diff --git a/src/xdisp.c b/src/xdisp.c index 52275a11b8..893ce9269c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22512,10 +22512,22 @@ maybe_produce_line_number (struct it *it) ptrdiff_t start_from, bytepos; ptrdiff_t this_line; bool first_time = false; - ptrdiff_t beg_byte = display_line_numbers_widen ? BEG_BYTE : BEGV_BYTE; - ptrdiff_t z_byte = display_line_numbers_widen ? Z_BYTE : ZV_BYTE; + ptrdiff_t beg_byte; + ptrdiff_t z_byte; + bool line_numbers_wide; void *itdata = bidi_shelve_cache (); + if (display_line_numbers_offset + && !display_line_numbers_widen + && !EQ (Vdisplay_line_numbers, Qvisual) + && !EQ (Vdisplay_line_numbers, Qrelative)) + line_numbers_wide = true; + else + line_numbers_wide = display_line_numbers_widen; + + beg_byte = line_numbers_wide ? BEG_BYTE : BEGV_BYTE; + z_byte = line_numbers_wide ? Z_BYTE : ZV_BYTE; + if (EQ (Vdisplay_line_numbers, Qvisual)) this_line = display_count_lines_visually (it); else @@ -22530,7 +22542,7 @@ maybe_produce_line_number (struct it *it) numbers, so we cannot use its data if the user wants line numbers that disregard narrowing, or if the buffer's narrowing has just changed. */ - && !(display_line_numbers_widen + && !(line_numbers_wide && (BEG_BYTE != BEGV_BYTE || Z_BYTE != ZV_BYTE)) && !current_buffer->clip_changed) { @@ -22620,6 +22632,8 @@ maybe_produce_line_number (struct it *it) lnum_offset = it->pt_lnum; else if (EQ (Vdisplay_line_numbers, Qvisual)) lnum_offset = 0; + else if (display_line_numbers_offset) + lnum_offset -= display_line_numbers_offset; /* Under 'relative', display the absolute line number for the current line, unless the user requests otherwise. */ @@ -34711,12 +34725,18 @@ To add a prefix to continuation lines, use `wrap-prefix'. */); DEFVAR_LISP ("display-line-numbers", Vdisplay_line_numbers, doc: /* Non-nil means display line numbers. + If the value is t, display the absolute number of each line of a buffer shown in a window. Absolute line numbers count from the beginning of -the current narrowing, or from buffer beginning. If the value is -`relative', display for each line not containing the window's point its -relative number instead, i.e. the number of the line relative to the -line showing the window's point. +the current narrowing, or from buffer beginning. The variable +`display-line-numbers-offset', if non-zero, is a signed offset added +to each absolute line number; it also forces line numbers to be counted +from the beginning of the buffer, as if `display-line-numbers-wide' +were non-nil. It has no effect when line numbers are not absolute. + +If the value is `relative', display for each line not containing the +window's point its relative number instead, i.e. the number of the line +relative to the line showing the window's point. In either case, line numbers are displayed at the beginning of each non-continuation line that displays buffer text, i.e. after each newline @@ -34757,6 +34777,15 @@ either `relative' or `visual'. */); DEFSYM (Qdisplay_line_numbers_widen, "display-line-numbers-widen"); Fmake_variable_buffer_local (Qdisplay_line_numbers_widen); + DEFVAR_INT ("display-line-numbers-offset", display_line_numbers_offset, + doc: /* A signed integer added to each absolute line number. +When this variable is non-zero, line numbers are always counted from +the beginning of the buffer even if `display-line-numbers-widen' is nil. +It has no effect when set to 0, or when line numbers are not absolute. */); + display_line_numbers_offset = 0; + DEFSYM (Qdisplay_line_numbers_offset, "display-line-numbers-offset"); + Fmake_variable_buffer_local (Qdisplay_line_numbers_offset); + DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator, doc: /* Non-nil means display the fill column indicator. */); Vdisplay_fill_column_indicator = false; commit 4b06250ef1fe98a766938862912383d2ee051dfb Author: Juanma Barranquero Date: Wed Oct 9 12:36:57 2019 +0200 Do not use tick faces beyond ZV (bug#37641) * src/xdisp.c (maybe_produce_line_number): Check beyond_zv before using a tick face for the line number. Move all face selection code outside the loop that draws the line number. diff --git a/src/xdisp.c b/src/xdisp.c index 1586a02e3d..52275a11b8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22657,29 +22657,33 @@ maybe_produce_line_number (struct it *it) int width_limit = tem_it.last_visible_x - tem_it.first_visible_x - 3 * FRAME_COLUMN_WIDTH (it->f); - /* Produce glyphs for the line number in a scratch glyph_row. */ - for (const char *p = lnum_buf; *p; p++) - { - /* For continuation lines and lines after ZV, instead of a line - number, produce a blank prefix of the same width. */ - if (lnum_face_id != current_lnum_face_id - && (EQ (Vdisplay_line_numbers, Qvisual) - ? this_line == 0 - : this_line == it->pt_lnum) - /* Avoid displaying the line-number-current-line face on - empty lines beyond EOB. */ - && it->what != IT_EOB) - tem_it.face_id = current_lnum_face_id; - else if (display_line_numbers_major_tick > 0 - && (lnum_to_display % display_line_numbers_major_tick == 0)) + + tem_it.face_id = lnum_face_id; + /* Avoid displaying any face other than line-number on + empty lines beyond EOB. */ + if (lnum_face_id != current_lnum_face_id + && (EQ (Vdisplay_line_numbers, Qvisual) + ? this_line == 0 + : this_line == it->pt_lnum) + && it->what != IT_EOB) + tem_it.face_id = current_lnum_face_id; + else if (!beyond_zv) + { + if (display_line_numbers_major_tick > 0 + && (lnum_to_display % display_line_numbers_major_tick == 0)) tem_it.face_id = merge_faces (it->w, Qline_number_major_tick, 0, DEFAULT_FACE_ID); else if (display_line_numbers_minor_tick > 0 && (lnum_to_display % display_line_numbers_minor_tick == 0)) tem_it.face_id = merge_faces (it->w, Qline_number_minor_tick, 0, DEFAULT_FACE_ID); - else - tem_it.face_id = lnum_face_id; + } + + /* Produce glyphs for the line number in a scratch glyph_row. */ + for (const char *p = lnum_buf; *p; p++) + { + /* For continuation lines and lines after ZV, instead of a line + number, produce a blank prefix of the same width. */ if (beyond_zv /* Don't display the same line number more than once. */ || (!EQ (Vdisplay_line_numbers, Qvisual) commit 8e0761c842b61b67da648d9ac295d42f4654792d Author: Eli Zaretskii Date: Wed Oct 9 13:08:01 2019 +0300 Improve doc strings in replace.el * lisp/replace.el (query-replace-read-from) (query-replace-compile-replacement, query-replace-read-to) (replace-string, replace-regexp, occur-mode-goto-occurrence) (occur-next-error, occur-rename-buffer, multi-occur) (multi-occur-in-matching-buffers): Describe all arguments in doc strings. (Bug#31207) diff --git a/lisp/replace.el b/lisp/replace.el index 5c0616e25f..d81eba3c7a 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -176,6 +176,7 @@ See `replace-regexp' and `query-replace-regexp-eval'.") (defun query-replace-read-from (prompt regexp-flag) "Query and return the `from' argument of a query-replace operation. +Prompt with PROMT. REGEXP-FLAG non-nil means the response should be a regexp. The return value can also be a pair (FROM . TO) indicating that the user wants to replace FROM with TO." (if query-replace-interactive @@ -253,6 +254,7 @@ wants to replace FROM with TO." (defun query-replace-compile-replacement (to regexp-flag) "Maybe convert a regexp replacement TO to Lisp. +REGEXP-FLAG non-nil means TO is a regexp. Returns a list suitable for `perform-replace' if necessary, the original string if not." (if (and regexp-flag @@ -293,7 +295,8 @@ the original string if not." (defun query-replace-read-to (from prompt regexp-flag) - "Query and return the `to' argument of a query-replace operation." + "Query and return the `to' argument of a query-replace operation. +Prompt with PROMPT. REGEXP-FLAG non-nil means the response should a regexp." (query-replace-compile-replacement (save-excursion (let* ((history-add-new-input nil) @@ -627,6 +630,9 @@ to the end of the buffer). Interactively, if Transient Mark mode is enabled and the mark is active, operates on the contents of the region; otherwise from point to the end of the buffer's accessible portion. +Arguments BACKWARD and REGION-NONCONTIGUOUS-P are passed +to `perform-replace' (which see). + Use \\\\[next-history-element] \ to pull the last incremental search string to the minibuffer that reads FROM-STRING. @@ -682,6 +688,9 @@ replace backward. Fourth and fifth arg START and END specify the region to operate on. +Arguments BACKWARD and REGION-NONCONTIGUOUS-P are passed +to `perform-replace' (which see). + In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP, and `\\=\\N' (where N is a digit) stands for whatever matched the Nth `\\(...\\)' (1-based) in REGEXP. @@ -1232,7 +1241,8 @@ To return to ordinary Occur mode, use \\[occur-cease-edit]." (defalias 'occur-mode-mouse-goto 'occur-mode-goto-occurrence) (defun occur-mode-goto-occurrence (&optional event) - "Go to the occurrence on the current line." + "Go to the occurrence specified by EVENT, a mouse click. +If not invoked by a mouse click, go to occurrence on the current line." (interactive (list last-nonmenu-event)) (let ((buffer (when event (current-buffer))) (pos @@ -1298,8 +1308,9 @@ To return to ordinary Occur mode, use \\[occur-cease-edit]." (occur-find-match n #'previous-single-property-change "No earlier matches")) (defun occur-next-error (&optional argp reset) - "Move to the Nth (default 1) next match in an Occur mode buffer. -Compatibility function for \\[next-error] invocations." + "Move to the ARGPth (default 1) next match in an Occur mode buffer. +RESET non-nil means rewind to the first match. +This is a compatibility function for \\[next-error] invocations." (interactive "p") (goto-char (cond (reset (point-min)) ((< argp 0) (line-beginning-position)) @@ -1409,11 +1420,12 @@ which means to discard all text properties." (defun occur-rename-buffer (&optional unique-p interactive-p) "Rename the current *Occur* buffer to *Occur: original-buffer-name*. Here `original-buffer-name' is the buffer name where Occur was originally run. -When given the prefix argument, or called non-interactively, the renaming -will not clobber the existing buffer(s) of that name, but use -`generate-new-buffer-name' instead. You can add this to `occur-hook' -if you always want a separate *Occur* buffer for each buffer where you -invoke `occur'." +If UNIQUE-P is non-nil (interactively, the prefix argument), or called +non-interactively with INTERACTIVE-P nil, the renaming will not clobber +the existing buffer(s) of that name, but will use `generate-new-buffer-name' +instead. +You can add this to `occur-hook' if you always want a separate +*Occur* buffer for each buffer where you invoke `occur'." (interactive "P\np") (with-current-buffer (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) @@ -1483,6 +1495,8 @@ is not modified." (defun multi-occur (bufs regexp &optional nlines) "Show all lines in buffers BUFS containing a match for REGEXP. +Optional argument NLINES specifies the number of context lines to show +with each match, see `list-matching-lines-default-context-lines'. This function acts on multiple buffers; otherwise, it is exactly like `occur'. When you invoke this command interactively, you must specify the buffer names that you want, one by one. @@ -1509,7 +1523,9 @@ See also `multi-occur-in-matching-buffers'." (defun multi-occur-in-matching-buffers (bufregexp regexp &optional allbufs) "Show all lines matching REGEXP in buffers specified by BUFREGEXP. Normally BUFREGEXP matches against each buffer's visited file name, -but if you specify a prefix argument, it matches against the buffer name. +but ALLBUFS non-nil (interactively, if you specify a prefix argument), +it matches against the buffer name and includes also buffers that +don't visit files. See also `multi-occur'." (interactive (cons commit 87d999a2f4dd0f0906e0b44a0f271b72f0e2e0e9 Author: Eli Zaretskii Date: Wed Oct 9 12:29:21 2019 +0300 Fix minor Texinfo errors in ELisp manual * doc/lispref/errors.texi (Standard Errors): Fix incorrect usage of @xref commands. (Bug#37660) * doc/lispref/internals.texi (Buffer Internals): Fix markup. (Bug#37639) diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index b25fb99399..45e7acbaa6 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -43,13 +43,13 @@ The message is @samp{Quit}. @xref{Quitting}. @item args-out-of-range The message is @samp{Args out of range}. This happens when trying to access an element beyond the range of a sequence, buffer, or other -container-like object. @xref{Sequences Arrays Vectors}, and -@xref{Text}. +container-like object. @xref{Sequences Arrays Vectors}, and see +@ref{Text}. @item arith-error The message is @samp{Arithmetic error}. This occurs when trying to perform integer division by zero. @xref{Numeric Conversions}, and -@xref{Arithmetic Operations}. +see @ref{Arithmetic Operations}. @item beginning-of-buffer The message is @samp{Beginning of buffer}. @xref{Character Motion}. @@ -172,7 +172,7 @@ syntax-parsing functions find invalid syntax or mismatched parentheses. Conventionally raised with three argument: a human-readable error message, the start of the obstacle that cannot be moved over, and the end of the obstacle. @xref{List Motion}, and -@xref{Parsing Expressions}. +see @ref{Parsing Expressions}. @item search-failed The message is @samp{Search failed}. @xref{Searching and Matching}. @@ -198,8 +198,8 @@ The message is the empty string. @xref{Signaling Errors}. @item user-search-failed This is like @samp{search-failed}, but doesn't trigger the debugger, -like @samp{user-error}. @xref{Signaling Errors}, and @xref{Searching -and Matching}. This is used for searching in Info files, @xref{Search +like @samp{user-error}. @xref{Signaling Errors}, and see @ref{Searching +and Matching}. This is used for searching in Info files, see @ref{Search Text,,,info,Info}. @item void-function diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index c52999e1cd..9fb826c93b 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -2020,8 +2020,8 @@ information. @item markers The markers that refer to this buffer. This is actually a single -marker, and successive elements in its marker @code{chain} are the other -markers referring to this buffer text. +marker, and successive elements in its marker @dfn{chain} (a linked +list) are the other markers referring to this buffer text. @item intervals The interval tree which records the text properties of this buffer. commit 13f7e07e7c386753f64691bcf12e43d3325131f1 Author: Lars Ingebrigtsen Date: Wed Oct 9 10:41:27 2019 +0200 Ensure that the pulse overlay is visible * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay): Make the pulse overlay have priority over the marked-region overlay (bug#29173). diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el index 7aaca833ca..ac3fb25e55 100644 --- a/lisp/cedet/pulse.el +++ b/lisp/cedet/pulse.el @@ -179,6 +179,9 @@ Optional argument FACE specifies the face to do the highlighting." ;; We don't support simultaneous highlightings. (pulse-momentary-unhighlight) (overlay-put o 'original-face (overlay-get o 'face)) + ;; Make this overlay take priority over the `transient-mark-mode' + ;; overlay. + (overlay-put o 'priority 1) (setq pulse-momentary-overlay o) (if (eq pulse-flag 'never) nil