commit 79ab873b9b679ec0aedb03ce246035d8e5d4b09c (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Sat Feb 22 04:21:10 2025 +0100 * admin/check-doc-strings: Reduce false positives. diff --git a/admin/check-doc-strings b/admin/check-doc-strings index b119b50885b..ced8989b2d2 100755 --- a/admin/check-doc-strings +++ b/admin/check-doc-strings @@ -256,7 +256,7 @@ while (my $file = ) { ## $maxargs \s*(\S+)\s*, ## $interactive - \s*((?:0|\"(?:(?:[^\\\"]|\\.)*)\"))\s*, + \s*((?:0|NULL|\"(?:(?:[^\\\"]|\\.)*)\"))\s*, ## $docstring \s*doc:\s*\/\*\s*(.*?)\s*\*\/ # attributes -- skip @@ -297,7 +297,7 @@ while (my $file = ) { $contents =~ s/(?:\s|;);.*//mog; my @matches = ($contents =~ - /\((def(?:un|subst|macro))\s+(\S+)\s+\(([^()]*)\)\s+\"((?:[^\\\"]|\\.)+)\"(.*?)\)/sgo); + /\((def(?:un|subst|macro)|cl-defun)\s+(\S+)\s+\(([^()]*)\)\s+\"((?:[^\\\"]|\\.)+)\"(.*?)\)/sgo); while (@matches) { my ($defform, $function, $parms, $docstring, $code_fragment) = splice (@matches, 0, 5); @@ -320,17 +320,21 @@ while (my $file = ) { my $contents = FileContents $file; $contents =~ s/(?:\s|;);.*//mog; - my @matches = ($contents =~ /^\((?:defalias|fset|define-function)\s+\'([A-Za-z0-9_-]+)\s+\'([A-Za-z0-9_-]+)/mog); + my @matches = ($contents =~ /^\((?:defalias|fset|define-function)\s+\'([A-Za-z0-9_<>=-]+)\s+[#]?\'([A-Za-z0-9_-]+)/mog); while (@matches) { my ($alias, $aliasee) = splice (@matches, 0, 2); print "alias $alias aliasee $aliasee\n"; if (exists $code_funtype{$aliasee}) { $code_funtype{$alias} = $code_funtype{$aliasee}; } + else {$code_funtype{$alias} = 1;} if (exists $code_arglist{$aliasee}) { $code_arglist{$alias} = $code_arglist{$aliasee}; } } } +# FIXME: Consider cl-defgeneric, minor and major modes. + foreach my $fun (sort keys %texi_funtype) { if (not exists $code_funtype{$fun}) { + next if $fun eq 'foo'; print "nuke-this-doc: $fun $texi_funtype{$fun}\n"; } } commit 1f60f86af5edba45a7d59f45ca174f6c288dde3f Author: F. Jason Park Date: Fri Feb 14 18:57:41 2025 -0800 Use .pem extension for client certs in ERC docs * doc/misc/erc.texi (Connecting): Change file-name extensions to .pem in all examples, and explain that the key and the cert can be combined into one file. (SASL): Use .pem extension for certs. * lisp/erc/erc.el (erc--warn-once-before-connect): Revise doc. (erc-tls): Use .pem extension for certs. (Bug#76278) diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index 1c0afa3b300..c47747a5b1f 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi @@ -866,15 +866,15 @@ Examples of use: @example (erc-tls :server "irc.libera.chat" :port 6697 :client-certificate - '("/home/bandali/my-cert.key" - "/home/bandali/my-cert.crt")) + (list (expand-file-name "~/key.pem") + (expand-file-name "~/cert.pem"))) @end example @example (erc-tls :server "irc.libera.chat" :port 6697 :client-certificate - `(,(expand-file-name "~/cert-libera.key") - ,(expand-file-name "~/cert-libera.crt"))) + '("/home/bandali/libera.pem" + "/home/bandali/libera.pem")) ; same file @end example @example @@ -882,16 +882,23 @@ Examples of use: :client-certificate t) @end example +Make sure to use absolute file names for the key and the cert. The +files themselves must be in @acronym{PEM}-encoded text format and can be +concatenated into a single file. + In the case of @code{:client-certificate t}, you will need to add a line like the following to your authinfo file (for example, @file{~/.authinfo.gpg}): @example -machine irc.libera.chat key /home/bandali/my-cert.key cert /home/bandali/my-cert.crt +machine irc.libera.chat key /home/bandali/key.pem cert /home/bandali/cert.pem @end example @xref{Help for users,,,auth, Emacs auth-source Library}, for more on the @file{.authinfo}/@file{.netrc} backend of @code{auth-source}. +If you invoke @code{erc-tls} interactively and need ERC to query +auth-source for a client cert, see the user option +@code{network-stream-use-client-certificates}. For other uses of auth-source throughout ERC, @pxref{auth-source, ERC's auth-source integration}. @end defun @@ -1244,7 +1251,7 @@ External (erc-tls :server "irc.libera.chat" :port 6697 :nick "aph" :client-certificate - '("/home/aph/my.key" "/home/aph/my.crt")) + '("/home/aph/key.pem" "/home/aph/cert.pem")) @end lisp You decide to switch things up and try out the @samp{EXTERNAL} @@ -1258,7 +1265,7 @@ Multiple networks @example # ~/.authinfo.gpg -machine irc.libera.chat key /home/aph/my.key cert /home/aph/my.crt +machine irc.libera.chat key /home/aph/key.pem cert /home/aph/cert.pem machine Example.Net login alyssa password sEcReT machine Example.Net login aph-bot password sesame @end example diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index e9e643a3df7..d377839733b 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1661,13 +1661,12 @@ capabilities." (defun erc--warn-once-before-connect (mode-var &rest args) "Display an \"error notice\" once. Expect ARGS to be `erc-button--display-error-notice-with-keys' -compatible parameters, except without any leading buffers or -processes. If we're in an ERC buffer with a network process when -called, print the notice immediately. Otherwise, if we're in a -server buffer, arrange to do so after local modules have been set -up and mode hooks have run. Otherwise, if MODE-VAR is a global -module, try again at most once the next time `erc-mode-hook' -runs." +compatible parameters, except without any leading buffers or processes. +If the current buffer has an `erc-server-process', print the notice +immediately. Otherwise, if it's a server buffer without a process, +arrange to do so on `erc-connect-pre-hook'. In non-ERC buffers, so long +as MODE-VAR belongs to a global module, try again at most once the next +time `erc-mode-hook' runs for any connection." (declare (indent 1)) (cl-assert (stringp (car args))) (if (derived-mode-p 'erc-mode) @@ -2921,8 +2920,8 @@ Example client certificate (CertFP) usage: (erc-tls :server \"irc.libera.chat\" :port 6697 :client-certificate - \\='(\"/home/bandali/my-cert.key\" - \"/home/bandali/my-cert.crt\")) + \\='(\"/home/bandali/my-key.pem\" + \"/home/bandali/my-cert.pem\")) See the alternative entry-point command `erc' as well as Info node `(erc) Connecting' for a fuller description of the various commit 1270e6aec5ff4b6f420d132a2249bb94095a3f11 Author: F. Jason Park Date: Tue Feb 18 19:20:45 2025 -0800 Don't kill window buffer in erc--split-line * lisp/erc/erc-backend.el (erc--split-line): Restore original window buffer before killing temp buffer. (Bug#76404) diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 713547a591a..e9b39a6f3f4 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -588,34 +588,35 @@ escape hatch for inhibiting their transmission.") (when (consp coding) (setq coding (car coding))) (setq coding (coding-system-change-eol-conversion coding 'unix)) - (unwind-protect - (with-temp-buffer - (set-window-buffer (selected-window) (current-buffer)) - (insert longline) - (goto-char (point-min)) - (while (not (eobp)) - (let ((upper (filepos-to-bufferpos erc-split-line-length - 'exact coding))) - (goto-char (or upper (point-max))) - (unless (eobp) - (skip-chars-backward "^ \t")) - (when (bobp) - (when erc--reject-unbreakable-lines - (user-error - (substitute-command-keys - (concat "Unbreakable line encountered " - "(Recover input with \\[erc-previous-command])")))) - (goto-char upper)) - (when-let* ((cmp (find-composition (point) (1+ (point))))) - (if (= (car cmp) (point-min)) - (goto-char (nth 1 cmp)) - (goto-char (car cmp))))) - (when (= (point-min) (point)) - (goto-char (point-max))) - (push (buffer-substring-no-properties (point-min) (point)) out) - (delete-region (point-min) (point))) - (or (nreverse out) (list ""))) - (set-window-buffer (selected-window) original-window-buf)))) + (with-temp-buffer + (unwind-protect + (progn + (set-window-buffer (selected-window) (current-buffer)) + (insert longline) + (goto-char (point-min)) + (while (not (eobp)) + (let ((upper (filepos-to-bufferpos erc-split-line-length + 'exact coding))) + (goto-char (or upper (point-max))) + (unless (eobp) + (skip-chars-backward "^ \t")) + (when (bobp) + (when erc--reject-unbreakable-lines + (user-error + (substitute-command-keys + (concat "Unbreakable line encountered (Recover input" + " with \\[erc-previous-command])")))) + (goto-char upper)) + (when-let* ((cmp (find-composition (point) (1+ (point))))) + (if (= (car cmp) (point-min)) + (goto-char (nth 1 cmp)) + (goto-char (car cmp))))) + (when (= (point-min) (point)) + (goto-char (point-max))) + (push (buffer-substring-no-properties (point-min) (point)) out) + (delete-region (point-min) (point))) + (or (nreverse out) (list ""))) + (set-window-buffer (selected-window) original-window-buf))))) ;; From Circe (defun erc-split-line (longline) commit 4ece0e2e46b1eeb315b9ebcdcee09679319128f9 Author: Stefan Kangas Date: Fri Feb 21 18:48:12 2025 +0100 Delete note on Emacs 19 modes from comint.el * lisp/comint.el: Delete note on how to convert pre-Emacs 20 modes to use comint.el. Emacs 20 was released in 1997, so it's safe to assume that any relevant code has been updated in the last three decades. diff --git a/lisp/comint.el b/lisp/comint.el index cece5545bfb..c1028bc93dc 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -4350,85 +4350,5 @@ return nil." (setq comint--indirect-buffer nil))) - -;;; Converting process modes to use comint mode -;;============================================================================ -;; The code in the Emacs 19 distribution has all been modified to use comint -;; where needed. However, there are `third-party' packages out there that -;; still use the old shell mode. Here's a guide to conversion. -;; -;; Renaming variables -;; Most of the work is renaming variables and functions. These are the common -;; ones: -;; Local variables: -;; last-input-start comint-last-input-start -;; last-input-end comint-last-input-end -;; shell-prompt-pattern comint-prompt-regexp -;; shell-set-directory-error-hook -;; Miscellaneous: -;; shell-set-directory -;; shell-mode-map comint-mode-map -;; Commands: -;; shell-send-input comint-send-input -;; shell-send-eof comint-delchar-or-maybe-eof -;; kill-shell-input comint-kill-input -;; interrupt-shell-subjob comint-interrupt-subjob -;; stop-shell-subjob comint-stop-subjob -;; quit-shell-subjob comint-quit-subjob -;; kill-shell-subjob comint-kill-subjob -;; kill-output-from-shell comint-delete-output -;; show-output-from-shell comint-show-output -;; copy-last-shell-input Use comint-previous-input/comint-next-input -;; -;; SHELL-SET-DIRECTORY is gone, its functionality taken over by -;; SHELL-DIRECTORY-TRACKER, the shell mode's comint-input-filter-functions. -;; Comint mode does not provide functionality equivalent to -;; shell-set-directory-error-hook; it is gone. -;; -;; comint-last-input-start is provided for modes which want to munge -;; the buffer after input is sent, perhaps because the inferior -;; insists on echoing the input. The LAST-INPUT-START variable in -;; the old shell package was used to implement a history mechanism, -;; but you should think twice before using comint-last-input-start -;; for this; the input history ring often does the job better. -;; -;; If you are implementing some process-in-a-buffer mode, called foo-mode, do -;; *not* create the comint-mode local variables in your foo-mode function. -;; This is not modular. Instead, call comint-mode, and let *it* create the -;; necessary comint-specific local variables. Then create the -;; foo-mode-specific local variables in foo-mode. Set the buffer's keymap to -;; be foo-mode-map, and its mode to be foo-mode. Set the comint-mode hooks -;; (comint-{prompt-regexp, input-filter, input-filter-functions, -;; get-old-input) that need to be different from the defaults. Call -;; foo-mode-hook, and you're done. Don't run the comint-mode hook yourself; -;; comint-mode will take care of it. The following example, from shell.el, -;; is typical: -;; -;; (defvar shell-mode-map -;; (let ((map (make-sparse-keymap))) -;; (set-keymap-parent map comint-mode-map) -;; (define-key map "\C-c\C-f" 'shell-forward-command) -;; (define-key map "\C-c\C-b" 'shell-backward-command) -;; (define-key map "\t" 'completion-at-point) -;; (define-key map "\M-?" -;; 'comint-dynamic-list-filename-completions) -;; map)) -;; -;; (define-derived-mode shell-mode comint-mode "Shell" -;; "Doc." -;; (setq comint-prompt-regexp shell-prompt-pattern) -;; (setq-local shell-directory-stack nil) -;; (add-hook 'comint-input-filter-functions 'shell-directory-tracker)) -;; -;; -;; Completion for comint-mode users -;; -;; For modes that use comint-mode, comint-dynamic-complete-functions is the -;; hook to add completion functions to. Functions on this list should return -;; the completion data according to the documentation of -;; `completion-at-point-functions' - - (provide 'comint) - ;;; comint.el ends here commit ecddc8227d9be8283d9bb47639a61c888a036896 Author: Jostein Kjønigsen Date: Fri Feb 21 15:09:26 2025 +0100 Fix identation in csharp-mode.el * lisp/progmodes/csharp-mode.el (csharp-ts-mode--indent-rules): Fix indentation for using statements and multiline lambdas. (Bug#75883) Patch based on bug report by Dino Chiesa . diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index b26ce4e34a5..6f3fd08089f 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -711,7 +711,9 @@ compilation and evaluation time conflicts." ((parent-is "object_type") parent-bol csharp-ts-mode-indent-offset) ((parent-is "enum_body") parent-bol csharp-ts-mode-indent-offset) ((parent-is "arrow_function") parent-bol csharp-ts-mode-indent-offset) - ((parent-is "parenthesized_expression") parent-bol csharp-ts-mode-indent-offset)))) + ((parent-is "parenthesized_expression") parent-bol csharp-ts-mode-indent-offset) + ((parent-is "using_statement") parent-bol 0) + ((parent-is "lambda_expression") parent-bol 0)))) (defvar csharp-ts-mode--keywords '("using" "namespace" "class" "if" "else" "throw" "new" "for" commit 8d4feb214b7eb802fec34269de11d30b9382cd83 Author: Stefan Kangas Date: Fri Feb 21 17:40:12 2025 +0100 New user option checkdoc-allow-quoting-nil-and-t * lisp/emacs-lisp/checkdoc.el (checkdoc-allow-quoting-nil-and-t): New user option that allows turning off the warning for having nil and t in quotes. (checkdoc-this-string-valid-engine): Use above new option. diff --git a/etc/NEWS b/etc/NEWS index 82a653c4e1e..b9b537ab4f5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -840,6 +840,11 @@ backend. This affects calls to 'warn', 'lwarn', 'display-warning', and 'message-box'. +--- +*** New user option 'checkdoc-allow-quoting-nil-and-t'. +Customizing this option to a non-nil value stops checkdoc from warning +for docstrings where symbols 'nil' and 't' are in quotes. + --- *** The default of 'checkdoc-verb-check-experimental-flag' is now nil. In most cases, having it enabled leads to a large amount of false diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 3541e3d0a57..95fa3a2027e 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -322,6 +322,14 @@ variable `checkdoc-common-verbs-wrong-voice' if you wish to add your own." Do not set this by hand, use a function like `checkdoc-current-buffer' with a universal argument.") +(defcustom checkdoc-allow-quoting-nil-and-t nil + "If non-nil, don't warn when the symbols nil and t are quoted. + +In other words, it allows writing them like this: \\=`nil\\=', \\=`t\\='." + :type 'boolean + :version "31.1") +;;;###autoload(put 'checkdoc-allow-quoting-nil-and-t 'safe-local-variable #'booleanp) + (defcustom checkdoc-symbol-words '("beginning-of-buffer" "beginning-of-line" "byte-code" "byte-compile" "command-line" "end-of-buffer" "end-of-line" @@ -1956,17 +1964,18 @@ Replace with \"%s\"?" original replace) (length ms))) nil))) ;; t and nil case - (save-excursion - (if (re-search-forward "\\([`‘]\\(t\\|nil\\)['’]\\)" e t) - (if (checkdoc-autofix-ask-replace - (match-beginning 1) (match-end 1) - (format "%s should not appear in quotes. Remove?" - (match-string 2)) - (match-string 2) t) - nil - (checkdoc-create-error - "Symbols t and nil should not appear in single quotes" - (match-beginning 1) (match-end 1))))) + (unless checkdoc-allow-quoting-nil-and-t + (save-excursion + (if (re-search-forward "\\([`‘]\\(t\\|nil\\)['’]\\)" e t) + (if (checkdoc-autofix-ask-replace + (match-beginning 1) (match-end 1) + (format "%s should not appear in quotes. Remove?" + (match-string 2)) + (match-string 2) t) + nil + (checkdoc-create-error + "Symbols t and nil should not appear in single quotes" + (match-beginning 1) (match-end 1)))))) ;; Here is some basic sentence formatting (checkdoc-sentencespace-region-engine (point) e) ;; Here are common proper nouns that should always appear capitalized. commit e7a35dac2fbe5777df531690c770b99e5f7561bb Author: Stefan Kangas Date: Thu Feb 20 14:06:46 2025 +0100 ; Delete superfluous comment diff --git a/lisp/loadup.el b/lisp/loadup.el index 383e30725b1..9089da9a988 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -392,7 +392,6 @@ (setq internal-make-interpreted-closure-function #'cconv-make-interpreted-closure)) (load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway) -;; tooltip.el is now required even on DOS to compile certain Lisp files. (load "tooltip") (load "international/iso-transl") ; Binds Alt-[ and friends. commit 3c93085650762c04ae3988dedc6b872b7f217143 Author: Stefan Kangas Date: Thu Feb 20 04:11:23 2025 +0100 Prefer defvar-keymap in admin/gitmerge.el * admin/gitmerge.el (gitmerge-mode-map): Prefer defvar-keymap. diff --git a/admin/gitmerge.el b/admin/gitmerge.el index a4f1efcff50..5bfb23dc3a2 100644 --- a/admin/gitmerge.el +++ b/admin/gitmerge.el @@ -95,18 +95,16 @@ If nil, the function `gitmerge-default-branch' guesses.") (defvar gitmerge-log-regexp "^\\([A-Z ]\\)\\s-*\\([0-9a-f]+\\) \\(.+?\\): \\(.*\\)$") -(defvar gitmerge-mode-map - (let ((map (make-keymap))) - (define-key map [(l)] #'gitmerge-show-log) - (define-key map [(d)] #'gitmerge-show-diff) - (define-key map [(f)] #'gitmerge-show-files) - (define-key map [(s)] #'gitmerge-toggle-skip) - (define-key map [(m)] #'gitmerge-start-merge) - ;; For convenience: - (define-key map [(n)] #'next-line) - (define-key map [(p)] #'previous-line) - map) - "Keymap for gitmerge major mode.") +(defvar-keymap gitmerge-mode-map + :doc "Keymap for gitmerge major mode." + "l" #'gitmerge-show-log + "d" #'gitmerge-show-diff + "f" #'gitmerge-show-files + "s" #'gitmerge-toggle-skip + "m" #'gitmerge-start-merge + ;; For convenience: + "n" #'next-line + "p" #'previous-line) (defvar gitmerge-mode-font-lock-keywords commit c24a142657bd025b111d089d7f79d8e4ace918c7 Author: Stefan Kangas Date: Thu Feb 20 04:08:30 2025 +0100 Prefer defvar-keymap in auth-source.el * lisp/auth-source.el (read-passwd-map): Prefer defvar-keymap. diff --git a/lisp/auth-source.el b/lisp/auth-source.el index e188b0b6f7b..376c061cd19 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -2514,13 +2514,11 @@ Adapt also mode line." (force-mode-line-update 'all) (read-passwd--hide-password))))) -(defvar read-passwd-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-map) - (define-key map "\C-u" #'delete-minibuffer-contents) ;bug#12570 - (define-key map "\t" #'read-passwd-toggle-visibility) - map) - "Keymap used while reading passwords.") +(defvar-keymap read-passwd-map + :doc "Keymap used while reading passwords." + :parent minibuffer-local-map + "C-u" #'delete-minibuffer-contents ;bug#12570 + "TAB" #'read-passwd-toggle-visibility) (define-minor-mode read-passwd-mode "Toggle visibility of password in minibuffer." commit ae439cc1b9f428a8247548f4ef3b992608a3c09b Author: Michael Albinus Date: Fri Feb 21 14:47:15 2025 +0100 Use a persistent directory as default directory in diff * lisp/vc/diff.el (diff-no-select): Use `temporary-file-directory' as default directory. Set default file permissions temporarily to #o600. (Bug#69606) diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 70497a97d56..875deb68724 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -187,8 +187,7 @@ returns the buffer used." (prin1-to-string new)))) (list (or old-alt old) (or new-alt new))))) - " ")) - (thisdir default-directory)) + " "))) (with-current-buffer buf (setq buffer-read-only t) (buffer-disable-undo (current-buffer)) @@ -199,25 +198,26 @@ returns the buffer used." (setq-local revert-buffer-function (lambda (_ignore-auto _noconfirm) (diff-no-select old new switches no-async (current-buffer)))) - (setq default-directory thisdir) + (setq default-directory temporary-file-directory) (setq diff-default-directory default-directory) (let ((inhibit-read-only t)) (insert command "\n")) - (if (and (not no-async) (fboundp 'make-process)) - (let ((proc (start-process "Diff" buf shell-file-name - shell-command-switch command))) - (set-process-filter proc #'diff-process-filter) - (set-process-sentinel - proc (lambda (proc _msg) - (with-current-buffer (process-buffer proc) - (diff-sentinel (process-exit-status proc) - old-alt new-alt))))) - ;; Async processes aren't available. - (let ((inhibit-read-only t)) - (diff-sentinel - (call-process shell-file-name nil buf nil - shell-command-switch command) - old-alt new-alt)))) + (with-file-modes #o600 + (if (and (not no-async) (fboundp 'make-process)) + (let ((proc (start-process "Diff" buf shell-file-name + shell-command-switch command))) + (set-process-filter proc #'diff-process-filter) + (set-process-sentinel + proc (lambda (proc _msg) + (with-current-buffer (process-buffer proc) + (diff-sentinel (process-exit-status proc) + old-alt new-alt))))) + ;; Async processes aren't available. + (let ((inhibit-read-only t)) + (diff-sentinel + (call-process shell-file-name nil buf nil + shell-command-switch command) + old-alt new-alt))))) buf)) (defun diff-process-filter (proc string)