From da23e607d33260c9aabaa3d136722a45457930dc Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 6 Dec 2021 19:24:09 +0200 Subject: [PATCH 01/23] Select the right buffer for event in context-menu functions (bug#9923) * lisp/mouse.el (context-menu-region): * lisp/progmodes/prog-mode.el (prog-context-menu): Switch to the buffer displayed by the window of the event before using syntax-ppss, char-after. --- lisp/mouse.el | 17 +++++++++-------- lisp/progmodes/prog-mode.el | 4 +++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index 5c645a4b895..8474a821118 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -479,14 +479,15 @@ Some context functions add menu items below the separator." `(menu-item "All" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) :help "Mark the whole buffer for a subsequent cut/copy")) - (when (let* ((pos (posn-point (event-end click))) - (char (when pos (char-after pos)))) - (or (and char (eq (char-syntax char) ?\")) - (nth 3 (save-excursion (syntax-ppss pos))))) - (define-key-after submenu [mark-string] - `(menu-item "String" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string)) - :help "Mark the string at click for a subsequent cut/copy"))) + (with-current-buffer (window-buffer (posn-window (event-end click))) + (when (let* ((pos (posn-point (event-end click))) + (char (when pos (char-after pos)))) + (or (and char (eq (char-syntax char) ?\")) + (nth 3 (save-excursion (syntax-ppss pos))))) + (define-key-after submenu [mark-string] + `(menu-item "String" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string)) + :help "Mark the string at click for a subsequent cut/copy")))) (define-key-after submenu [mark-line] `(menu-item "Line" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 4997c2746f2..e43f2ff90b5 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -87,7 +87,9 @@ 'mark-whole-buffer) ;; Include text-mode select menu only in strings and comments. - (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click))))) + (when (nth 8 (save-excursion + (with-current-buffer (window-buffer (posn-window (event-end click))) + (syntax-ppss (posn-point (event-end click)))))) (text-mode-context-menu menu click)) menu) From bdcf3c3504566fd61c42b06ee41cae5c074c3c03 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 7 Dec 2021 13:44:52 +0800 Subject: [PATCH 02/23] Cancel xwidget progress timer when buffer is killed * lisp/xwidget.el (xwidget-webkit-buffer-kill): New function. (xwidget-webkit-mode): Add `xwidget-webkit-buffer-kill' to `kill-buffer-hook'. (bug#52344) --- lisp/xwidget.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/xwidget.el b/lisp/xwidget.el index cf4396fec2d..ce9839ebd34 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -409,6 +409,11 @@ If N is omitted or nil, scroll backwards by one char." (with-current-buffer (xwidget-buffer xwidget) (force-mode-line-update))) +(defun xwidget-webkit-buffer-kill () + "Clean up an xwidget-webkit buffer before it is killed." + (when (timerp xwidget-webkit--progress-update-timer) + (cancel-timer xwidget-webkit--progress-update-timer))) + (defun xwidget-webkit-callback (xwidget xwidget-event-type) "Callback for xwidgets. XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget." @@ -479,6 +484,7 @@ If non-nil, plugins are enabled. Otherwise, disabled." (define-derived-mode xwidget-webkit-mode special-mode "xwidget-webkit" "Xwidget webkit view mode." (setq buffer-read-only t) + (add-hook 'kill-buffer-hook #'xwidget-webkit-buffer-kill) (setq-local tool-bar-map xwidget-webkit-tool-bar-map) (setq-local bookmark-make-record-function #'xwidget-webkit-bookmark-make-record) From 9a1e87ba4486df19259abf3564a0281d8be25e64 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 7 Dec 2021 08:06:12 +0100 Subject: [PATCH 03/23] Add vc-git-stash-pop to vc-dir-git-mode * lisp/vc/vc-git.el (vc-dir-git-mode-map): Add vc-git-stash-pop (bug#52158). --- lisp/vc/vc-git.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 3ceed365ee0..5c6a39aec96 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1874,7 +1874,8 @@ Returns nil if not possible." (defvar-keymap vc-dir-git-mode-map "z c" #'vc-git-stash - "z s" #'vc-git-stash-snapshot) + "z s" #'vc-git-stash-snapshot + "z p" #'vc-git-stash-pop) (define-minor-mode vc-dir-git-mode "A minor mode for git-specific commands in `vc-dir-mode' buffers. From 3939cb2a9ca33269d2d9f6cf1fa35637d9297830 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 11:39:46 +0100 Subject: [PATCH 04/23] Remove XEmacs compat code from strokes.el * lisp/strokes.el (strokes-mode): Remove XEmacs compat code; select-frame-hook does not exist in Emacs. --- lisp/strokes.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/strokes.el b/lisp/strokes.el index 91ddefd3738..db0eb83a3e6 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -1395,14 +1395,19 @@ Encode/decode your strokes with \\[strokes-encode-buffer], (strokes-load-user-strokes)) (add-hook 'kill-emacs-query-functions #'strokes-prompt-user-save-strokes) - (add-hook 'select-frame-hook - #'strokes-update-window-configuration) + ;; FIXME: Should this be something like `focus-in-hook'? + ;; That variable is obsolete, but `select-frame-hook' has + ;; never existed in Emacs. + ;;(add-hook 'select-frame-hook + ;; #'strokes-update-window-configuration) (strokes-update-window-configuration)) (t ; turn off strokes (if (get-buffer strokes-buffer-name) - (kill-buffer (get-buffer strokes-buffer-name))) - (remove-hook 'select-frame-hook - #'strokes-update-window-configuration)))) + (kill-buffer (get-buffer strokes-buffer-name))) + ;; FIXME: Same as above. + ;;(remove-hook 'select-frame-hook + ;; #'strokes-update-window-configuration) + ))) ;;;; strokes-xpm stuff (later may be separate)... From 092c03d2c30f8ca9d07da670d29ffd161fb24834 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 12:03:45 +0100 Subject: [PATCH 05/23] * lisp/view.el (view-mode-map): Convert to defvar-keymap. --- lisp/view.el | 124 +++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/lisp/view.el b/lisp/view.el index 3476ced3f79..321bc5f5660 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -36,8 +36,8 @@ ;;; Suggested key bindings: ;; -;; (define-key ctl-x-4-map "v" #'view-file-other-window) ; ^x4v -;; (define-key ctl-x-5-map "v" #'view-file-other-frame) ; ^x5v +;; (keymap-set ctl-x-4-map "v" #'view-file-other-window) ; C-x 4 v +;; (keymap-set ctl-x-5-map "v" #'view-file-other-frame) ; C-x 5 v ;; ;; You could also bind `view-file', `view-buffer', `view-buffer-other-window' and ;; `view-buffer-other-frame' to keys. @@ -142,68 +142,68 @@ that use View mode automatically.") (defvar-local view-overlay nil "Overlay used to display where a search operation found its match. This is local in each buffer, once it is used.") + -;; Define keymap inside defvar to make it easier to load changes. ;; Some redundant "less"-like key bindings below have been commented out. -(defvar view-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "C" #'View-kill-and-leave) - (define-key map "c" #'View-leave) - (define-key map "Q" #'View-quit-all) - (define-key map "E" #'View-exit-and-edit) - ;; (define-key map "v" #'View-exit) - (define-key map "e" #'View-exit) - (define-key map "q" #'View-quit) - ;; (define-key map "N" #'View-search-last-regexp-backward) - (define-key map "p" #'View-search-last-regexp-backward) - (define-key map "n" #'View-search-last-regexp-forward) - ;; (define-key map "?" #'View-search-regexp-backward) ; Less does this. - (define-key map "\\" #'View-search-regexp-backward) - (define-key map "/" #'View-search-regexp-forward) - (define-key map "r" #'isearch-backward) - (define-key map "s" #'isearch-forward) - (define-key map "m" #'point-to-register) - (define-key map "'" #'register-to-point) - (define-key map "x" #'exchange-point-and-mark) - (define-key map "@" #'View-back-to-mark) - (define-key map "." #'set-mark-command) - (define-key map "%" #'View-goto-percent) - ;; (define-key map "G" #'View-goto-line-last) - (define-key map "g" #'View-goto-line) - (define-key map "=" #'what-line) - (define-key map "F" #'View-revert-buffer-scroll-page-forward) - ;; (define-key map "k" #'View-scroll-line-backward) - (define-key map "y" #'View-scroll-line-backward) - ;; (define-key map "j" #'View-scroll-line-forward) - (define-key map "\n" #'View-scroll-line-forward) - (define-key map "\r" #'View-scroll-line-forward) - (define-key map "u" #'View-scroll-half-page-backward) - (define-key map "d" #'View-scroll-half-page-forward) - (define-key map "z" #'View-scroll-page-forward-set-page-size) - (define-key map "w" #'View-scroll-page-backward-set-page-size) - ;; (define-key map "b" #'View-scroll-page-backward) - (define-key map "\C-?" #'View-scroll-page-backward) - ;; (define-key map "f" #'View-scroll-page-forward) - (define-key map " " #'View-scroll-page-forward) - (define-key map [?\S-\ ] #'View-scroll-page-backward) - (define-key map "o" #'View-scroll-to-buffer-end) - (define-key map ">" #'end-of-buffer) - (define-key map "<" #'beginning-of-buffer) - (define-key map "-" #'negative-argument) - (define-key map "9" #'digit-argument) - (define-key map "8" #'digit-argument) - (define-key map "7" #'digit-argument) - (define-key map "6" #'digit-argument) - (define-key map "5" #'digit-argument) - (define-key map "4" #'digit-argument) - (define-key map "3" #'digit-argument) - (define-key map "2" #'digit-argument) - (define-key map "1" #'digit-argument) - (define-key map "0" #'digit-argument) - (define-key map "H" #'describe-mode) - (define-key map "?" #'describe-mode) ; Maybe do as less instead? See above. - (define-key map "h" #'describe-mode) - map)) +(defvar-keymap view-mode-map + :doc "Keymap for ‘view-mode’." + "C" #'View-kill-and-leave + "c" #'View-leave + "Q" #'View-quit-all + "E" #'View-exit-and-edit + ;; "v" #'View-exit + "e" #'View-exit + "q" #'View-quit + ;; "N" #'View-search-last-regexp-backward + "p" #'View-search-last-regexp-backward + "n" #'View-search-last-regexp-forward + ;; "?" #'View-search-regexp-backward ; Less does this. + "\\" #'View-search-regexp-backward + "/" #'View-search-regexp-forward + "r" #'isearch-backward + "s" #'isearch-forward + "m" #'point-to-register + "'" #'register-to-point + "x" #'exchange-point-and-mark + "@" #'View-back-to-mark + "." #'set-mark-command + "%" #'View-goto-percent + ;; "G" #'View-goto-line-last + "g" #'View-goto-line + "=" #'what-line + "F" #'View-revert-buffer-scroll-page-forward + ;; "k" #'View-scroll-line-backward + "y" #'View-scroll-line-backward + ;; "j" #'View-scroll-line-forward + "C-j" #'View-scroll-line-forward + "RET" #'View-scroll-line-forward + "u" #'View-scroll-half-page-backward + "d" #'View-scroll-half-page-forward + "z" #'View-scroll-page-forward-set-page-size + "w" #'View-scroll-page-backward-set-page-size + ;; "b" #'View-scroll-page-backward + "DEL" #'View-scroll-page-backward + ;; "f" #'View-scroll-page-forward + "SPC" #'View-scroll-page-forward + "S-SPC" #'View-scroll-page-backward + "o" #'View-scroll-to-buffer-end + ">" #'end-of-buffer + "<" #'beginning-of-buffer + "-" #'negative-argument + "9" #'digit-argument + "8" #'digit-argument + "7" #'digit-argument + "6" #'digit-argument + "5" #'digit-argument + "4" #'digit-argument + "3" #'digit-argument + "2" #'digit-argument + "1" #'digit-argument + "0" #'digit-argument + "H" #'describe-mode + "?" #'describe-mode ; Maybe do as less instead? See above. + "h" #'describe-mode) + ;;; Commands that enter or exit view mode. From 8aa2aac5002873cfc44899dc570e843742ea7855 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 12:31:21 +0100 Subject: [PATCH 06/23] Remove obsolete values from image-mode-auto-resize * lisp/image-mode.el (image-auto-resize): Remove obsolete options fit-height and fit-width. (image-transform-resize): Document that fit-height and fit-width are obsolete. (image-auto-resize-max-scale-percent): Fix defcustom const :tag. --- lisp/image-mode.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index c2b145d1a2e..6ff7859c835 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -60,15 +60,11 @@ Its value should be one of the following: - nil, meaning no resizing. - t, meaning to scale the image down to fit in the window. - `fit-window', meaning to fit the image to the window. - - `fit-height', meaning to fit the image to the window height. - - `fit-width', meaning to fit the image to the window width. - A number, which is a scale factor (the default size is 1). Resizing will always preserve the aspect ratio of the image." :type '(choice (const :tag "No resizing" nil) (const :tag "Fit to window" fit-window) - (const :tag "Fit to window height" fit-height) - (const :tag "Fit to window width" fit-width) (other :tag "Scale down to fit window" t) (number :tag "Scale factor" 1)) :version "29.1" @@ -78,7 +74,7 @@ Resizing will always preserve the aspect ratio of the image." "Max size (in percent) to scale up to when `image-auto-resize' is `fit-window'. Can be either a number larger than 100, or nil, which means no max size." - :type '(choice (const nil "No max") + :type '(choice (const :tag "No max" nil) natnum) :version "29.1" :group 'image) @@ -100,9 +96,11 @@ Its value should be one of the following: - nil, meaning no resizing. - t, meaning to scale the image down to fit in the window. - `fit-window', meaning to fit the image to the window. + - A number, which is a scale factor (the default size is 1). + +There is also support for these values, obsolete since Emacs 29.1: - `fit-height', meaning to fit the image to the window height. - `fit-width', meaning to fit the image to the window width. - - A number, which is a scale factor (the default size is 1). Resizing will always preserve the aspect ratio of the image.") From 00e6aeacf2540b0dc621208577c1c725e3a533b2 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 12:59:18 +0100 Subject: [PATCH 07/23] image-dired: Fix behavior of slideshow command * lisp/image-dired.el (image-dired-slideshow-start): Fix behavior to match documentation. Minor simplification of docstring. --- etc/NEWS | 11 +++++++---- lisp/image-dired.el | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a8b7dc56bac..3bdbdde5513 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -583,13 +583,16 @@ used for images that are flagged for deletion in the Dired buffer associated with Image-Dired. --- -*** The 'image-dired-slideshow-start' command has been revamped. +*** 'image-dired-slideshow-start' is now bound to 'S'. +It is bound in both the thumbnail and display buffer. + +--- +*** The 'image-dired-slideshow-start' command no longer prompts. It no longer inconveniently prompts for a number of images and a delay: it runs indefinitely, but stops automatically on any command. You can set the delay with a prefix argument, or a negative prefix -argument to prompt anyways. Customize the user option -'image-dired-slideshow-delay' to change the default, which is 5 -seconds. It is bound to 'S' in the thumbnail and display buffer. +argument to prompt for a delay. Customize the user option +'image-dired-slideshow-delay' to change the default from 5 seconds. --- *** Support for bookmark.el. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index fe0c3b7c226..33f28a3440f 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1777,21 +1777,22 @@ This is used by `image-dired-slideshow-start'." (image-dired-slideshow-stop))) (defun image-dired-slideshow-start (&optional arg) - "Start a slideshow. -Wait `image-dired-slideshow-delay' seconds before showing the -next image. + "Start a slideshow, waiting `image-dired-slideshow-delay' between images. With prefix argument ARG, wait that many seconds before going to the next image. With a negative prefix argument, prompt user for the delay." (interactive "P" image-dired-thumbnail-mode image-dired-display-image-mode) - (let ((delay (if (> arg 0) - arg - (string-to-number - (read-string - (let ((delay (number-to-string image-dired-slideshow-delay))) - (format-prompt "Delay, in seconds. Decimals are accepted" delay) delay)))))) + (let ((delay (if (not arg) + image-dired-slideshow-delay + (if (> arg 0) + arg + (string-to-number + (let ((delay (number-to-string image-dired-slideshow-delay))) + (read-string + (format-prompt "Delay, in seconds. Decimals are accepted" delay)) + delay)))))) (setq image-dired--slideshow-timer (run-with-timer 0 delay From db56e32d1241a6573cb7b688362669abec28e648 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 13:28:39 +0100 Subject: [PATCH 08/23] * etc/tutorials/TUTORIAL: Say that there is usually a delete key. --- etc/tutorials/TUTORIAL | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/tutorials/TUTORIAL b/etc/tutorials/TUTORIAL index cbb333470a0..c5f2e684c42 100644 --- a/etc/tutorials/TUTORIAL +++ b/etc/tutorials/TUTORIAL @@ -304,8 +304,8 @@ position, type . This is the key on the keyboard usually labeled "Backspace"--the same one you normally use, outside Emacs, to delete the last character typed. -There may also be another key on your keyboard labeled , but -that's not the one we refer to as . +There is usually another key on your keyboard labeled , but +that's not the one we refer to as in Emacs. >> Do this now--type a few characters, then delete them by typing a few times. Don't worry about this file From c94b81bfc1877e4e7057c66cb73bd0942e9fd218 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 14:34:29 +0100 Subject: [PATCH 09/23] Remove some unnecessary references to Emacs 22 * lisp/cedet/semantic/fw.el: * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): * lisp/emulation/viper-util.el (viper-frame-value): * lisp/mail/rmail.el (rmail-delete-headers): * lisp/mh-e/mh-e.el (mh-inc-spool-list): Remove some unnecessary references to Emacs 22. --- lisp/cedet/semantic/fw.el | 2 -- lisp/emacs-lisp/bytecomp.el | 3 +-- lisp/emulation/viper-util.el | 3 --- lisp/mail/rmail.el | 8 +------- lisp/mh-e/mh-e.el | 2 +- 5 files changed, 3 insertions(+), 15 deletions(-) diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el index 16e8ce8de95..3502cda500e 100644 --- a/lisp/cedet/semantic/fw.el +++ b/lisp/cedet/semantic/fw.el @@ -66,8 +66,6 @@ (defalias 'semantic-mode-line-update #'force-mode-line-update) -;; Since Emacs 22 major mode functions should use `run-mode-hooks' to -;; run major mode hooks. (define-obsolete-function-alias 'semantic-run-mode-hooks #'run-mode-hooks "28.1") ;; Fancy compat usage now handled in cedet-compat diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index b1afa6fe611..644d9f1a470 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2230,8 +2230,7 @@ With argument ARG, insert value in current buffer after the form." (byte-compile-depth 0) (byte-compile-maxdepth 0) (byte-compile-output nil) - ;; This allows us to get the positions of symbols read; it's - ;; new in Emacs 22.1. + ;; This allows us to get the positions of symbols read. (read-with-symbol-positions inbuffer) (read-symbol-positions-list nil) ;; #### This is bound in b-c-close-variables. diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 71043b189db..0af54b37432 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -79,9 +79,6 @@ (defmacro viper-frame-value (variable) "Return the value of VARIABLE local to the current frame, if there is one. Otherwise return the normal value." - ;; Frame-local variables are obsolete from Emacs 22.2 onwards, - ;; so we do it by hand instead. - ;; Buffer-local values take precedence over frame-local ones. `(if (local-variable-p ',variable) ,variable ;; Distinguish between no frame parameter and a frame parameter diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 9fbc9ba180f..afcb7f39bf2 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4125,10 +4125,8 @@ typically for purposes of moderating a list." "A regexp that matches the separator before the text of a failed message.") (defvar mail-mime-unsent-header "^Content-Type: message/rfc822 *$" - "A regexp that matches the header of a MIME body part with a failed message.") + "A regexp that matches the header of a MIME body part with a failed message.") -;; This is a cut-down version of rmail-clear-headers from Emacs 22. -;; It doesn't have the same functionality, hence the name change. (defun rmail-delete-headers (regexp) "Delete any mail headers matching REGEXP. The message should be narrowed to just the headers." @@ -4136,10 +4134,6 @@ The message should be narrowed to just the headers." (goto-char (point-min)) (while (re-search-forward regexp nil t) (beginning-of-line) - ;; This code from Emacs 22 doesn't seem right, since r-n-h is - ;; just for display. -;;; (if (looking-at rmail-nonignored-headers) -;;; (forward-line 1) (delete-region (point) (save-excursion (if (re-search-forward "\n[^ \t]" nil t) diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 4e1ca2897bc..17faff0716c 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -1607,7 +1607,7 @@ on the \"INS\" button. Enter a \"Spool File\" of \"~/mail/mh-e\", a \"Folder\" of \"mh-e\", and a \"Key Binding\" of \"m\". You can use \"xbuffy\" to automate the incorporation of this mail -using the Emacs 22 command \"emacsclient\" as follows: +using \"emacsclient\" as follows: box ~/mail/mh-e title mh-e From 6e50d86ca20f4057208a1a19f2a6c6c19ea3ad03 Mon Sep 17 00:00:00 2001 From: Lele Gaifax Date: Tue, 7 Dec 2021 07:42:04 +0100 Subject: [PATCH 10/23] Add the new packages section to the Italian tutorial * etc/tutorials/TUTORIAL.it (INSTALLAZIONE DI ULTERIORI PACCHETTI): Translate from recently added INSTALLING PACKAGES section in the English version. (Bug#52345) (CONCLUSIONI): Reword paragraph, to better convey the original intent. --- etc/tutorials/TUTORIAL.it | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/etc/tutorials/TUTORIAL.it b/etc/tutorials/TUTORIAL.it index 68bf40332ef..aa2fb4560a7 100644 --- a/etc/tutorials/TUTORIAL.it +++ b/etc/tutorials/TUTORIAL.it @@ -1178,14 +1178,27 @@ quei file. Dired è descritta nel manuale Emacs nel nodo chiamato Il manuale descrive molte altre funzionalità di Emacs. +* INSTALLAZIONE DI ULTERIORI PACCHETTI + +Ci sono tantissimi pacchetti che estendono le funzionalità di Emacs, +scritti dalla comunità. Questi pacchetti includono il supporto a +nuovi linguaggi, aggiungono temi addizionali, rendono possibile +interoperare con applicazioni esterne e molto, molto altro. + +Per vedere una lista di tutti i pacchetti disponibili, inserisci +M-x list-packages. Nell'elenco che viene mostrato, puoi installare o +disinstallare pacchetti, o leggerne la descrizione. Consulta il +manuale per ulteriori informazioni sulla gestione dei pacchetti. + + * CONCLUSIONI ------------- Per chiudere una sessione di Emacs si usa C-x C-c. -Questo documento è stato creato per essere utile a tutti i nuovi -utenti, se qualcosa per te è stato poco chiaro non dare la colpa a te -stesso: lamentati! +Questo documento è pensato per essere comprensibile a tutti i nuovi +utenti, quindi se hai trovato qualcosa di poco chiaro, non dare la +colpa a te stesso: lamentati! * COPIA From 1d0a60113fd155c77ef5ea4ea44fcba3504adcbf Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 7 Dec 2021 16:20:13 +0100 Subject: [PATCH 11/23] Make a more robust check in Tramp using scripts * lisp/net/tramp-sh.el (tramp-find-inline-encoding): Check, whether scripts in `tramp-remote-coding-commands' are expandable. --- lisp/net/tramp-sh.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index c2a02312474..72eb63d3929 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4597,6 +4597,8 @@ Goes through the list `tramp-local-coding-commands' and (value (symbol-value rem-enc))) (while (string-match "-" name) (setq name (replace-match "_" nil t name))) + (unless (tramp-expand-script vec value) + (throw 'wont-work-remote nil)) (tramp-maybe-send-script vec value name) (setq rem-enc name))) (tramp-message @@ -4614,6 +4616,8 @@ Goes through the list `tramp-local-coding-commands' and (value (symbol-value rem-dec))) (while (string-match "-" name) (setq name (replace-match "_" nil t name))) + (unless (tramp-expand-script vec value) + (throw 'wont-work-remote nil)) (tramp-maybe-send-script vec value name) (setq rem-dec name))) (tramp-message From 691470ec4ed7010c37e956e4f26b9fafb790bc17 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 7 Dec 2021 08:58:45 -0800 Subject: [PATCH 12/23] * doc/misc/eshell.texi (Built-ins): Fix xref. --- doc/misc/eshell.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index 4e5288ea6d8..a87dd4308c5 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -632,7 +632,7 @@ disabled by default. @item setq @cmindex setq Set variable values, using the function @code{setq} like a command. -@xref{Setting variables,,, elisp, GNU Emacs Lisp Reference Manual}. +@xref{Setting Variables,,, elisp, GNU Emacs Lisp Reference Manual}. @item source @cmindex source From 77a30e1e88daed4cb47fd567dcae25a260eb1ef2 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 18:27:41 +0100 Subject: [PATCH 13/23] browse-url: Remove support for Netscape * lisp/net/browse-url.el (browse-url-netscape-program) (browse-url-netscape-arguments) (browse-url-netscape-startup-arguments) (browse-url-netscape-new-window-is-tab) (browse-url-netscape-version, browse-url-netscape) (browse-url-netscape-sentinel, browse-url-netscape-reload) (browse-url-netscape-send): Delete, thus removing support for the long defunct Netscape web browser. * etc/NEWS: Announce its removal. --- etc/NEWS | 6 ++ lisp/net/browse-url.el | 127 +---------------------------------------- 2 files changed, 8 insertions(+), 125 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 3bdbdde5513..4bfa1eed85d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -684,6 +684,12 @@ When calling 'abbreviate-file-name' on a Tramp filename, the result will abbreviate the user's home directory, for example by abbreviating "/ssh:user@host:/home/user" to "/ssh:user@host:~". +** Browse URL + +*** Support for the Netscape web browser has been removed. +This support has been obsolete since Emacs 25.1. The final version of +the Netscape web browser was released in February, 2008. + * New Modes and Packages in Emacs 29.1 diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index d39cc361e56..990bc41d984 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -240,33 +240,6 @@ be used instead." :version "27.1" :type 'regexp) -(defcustom browse-url-netscape-program "netscape" - ;; Info about netscape-remote from Karl Berry. - "The name by which to invoke Netscape. - -The free program `netscape-remote' from - is said to start -up very much quicker than `netscape'. Reported to compile on a GNU -system, given vroot.h from the same directory, with cc flags - -DSTANDALONE -L/usr/X11R6/lib -lXmu -lX11." - :type 'string) - -(make-obsolete-variable 'browse-url-netscape-program nil "25.1") - -(defcustom browse-url-netscape-arguments nil - "A list of strings to pass to Netscape as arguments." - :type '(repeat (string :tag "Argument"))) - -(make-obsolete-variable 'browse-url-netscape-arguments nil "25.1") - -(defcustom browse-url-netscape-startup-arguments browse-url-netscape-arguments - "A list of strings to pass to Netscape when it starts up. -Defaults to the value of `browse-url-netscape-arguments' at the time -`browse-url' is loaded." - :type '(repeat (string :tag "Argument"))) - -(make-obsolete-variable 'browse-url-netscape-startup-arguments nil "25.1") - (defcustom browse-url-browser-display nil "The X display for running the browser, if not same as Emacs's." :type '(choice string (const :tag "Default" nil))) @@ -373,7 +346,7 @@ Defaults to the value of `browse-url-epiphany-arguments' at the time :type 'string :version "29.1") -;; GNOME means of invoking either Mozilla or Netscape. +;; GNOME means of invoking Mozilla. (defvar browse-url-gnome-moz-program "gnome-moz-remote") (make-obsolete-variable 'browse-url-gnome-moz-program nil "25.1") @@ -420,15 +393,6 @@ If non-nil, then open the URL in a new tab rather than a new window if `browse-url-epiphany' is asked to open it in a new window." :type 'boolean) -(defcustom browse-url-netscape-new-window-is-tab nil - "Whether to open up new windows in a tab or a new window. -If non-nil, then open the URL in a new tab rather than a new -window if `browse-url-netscape' is asked to open it in a new -window." - :type 'boolean) - -(make-obsolete-variable 'browse-url-netscape-new-window-is-tab nil "25.1") - (defcustom browse-url-new-window-flag nil "Non-nil means always open a new browser window with appropriate browsers. Passing an interactive argument to \\[browse-url], or specific browser @@ -525,14 +489,6 @@ You might want to set this to somewhere with restricted read permissions for privacy's sake." :type 'string) -(defcustom browse-url-netscape-version 3 - "The version of Netscape you are using. -This affects how URL reloading is done; the mechanism changed -incompatibly at version 4." - :type 'number) - -(make-obsolete-variable 'browse-url-netscape-version nil "25.1") - (defcustom browse-url-text-browser "lynx" "The name of the text browser to invoke." :type 'string @@ -1009,8 +965,6 @@ The optional NEW-WINDOW argument is not used." (function-put 'browse-url-default-macosx-browser 'browse-url-browser-kind 'external) -;; --- Netscape --- - (defun browse-url-process-environment () "Set DISPLAY in the environment to the X display the browser will use. This is either the value of variable `browse-url-browser-display' if @@ -1055,7 +1009,6 @@ instead of `browse-url-new-window-flag'." ((executable-find browse-url-chromium-program) 'browse-url-chromium) ;;; ((executable-find browse-url-galeon-program) 'browse-url-galeon) ((executable-find browse-url-kde-program) 'browse-url-kde) -;;; ((executable-find browse-url-netscape-program) 'browse-url-netscape) ((executable-find browse-url-chrome-program) 'browse-url-chrome) ((executable-find browse-url-webpositive-program) 'browse-url-webpositive) ((executable-find browse-url-xterm-program) 'browse-url-text-xterm) @@ -1089,82 +1042,6 @@ The optional argument IGNORED is not used." (function-put 'browse-url-xdg-open 'browse-url-browser-kind 'external) -;;;###autoload -(defun browse-url-netscape (url &optional new-window) - "Ask the Netscape WWW browser to load URL. -Default to the URL around or before point. The strings in variable -`browse-url-netscape-arguments' are also passed to Netscape. - -When called interactively, if variable `browse-url-new-window-flag' is -non-nil, load the document in a new Netscape window, otherwise use a -random existing one. A non-nil interactive prefix argument reverses -the effect of `browse-url-new-window-flag'. - -If `browse-url-netscape-new-window-is-tab' is non-nil, then -whenever a document would otherwise be loaded in a new window, it -is loaded in a new tab in an existing window instead. - -When called non-interactively, optional second argument NEW-WINDOW is -used instead of `browse-url-new-window-flag'." - (declare (obsolete nil "25.1")) - (interactive (browse-url-interactive-arg "URL: ")) - (setq url (browse-url-encode-url url)) - (let* ((process-environment (browse-url-process-environment)) - (process - (apply #'start-process - (concat "netscape " url) nil - browse-url-netscape-program - (append - browse-url-netscape-arguments - (if (eq window-system 'w32) - (list url) - (append - (if new-window '("-noraise")) - (list "-remote" - (concat "openURL(" url - (if (browse-url-maybe-new-window - new-window) - (if browse-url-netscape-new-window-is-tab - ",new-tab" - ",new-window")) - ")")))))))) - (set-process-sentinel process - (lambda (process _change) - (browse-url-netscape-sentinel process url))))) - -(function-put 'browse-url-netscape 'browse-url-browser-kind 'external) - -(defun browse-url-netscape-sentinel (process url) - "Handle a change to the process communicating with Netscape." - (declare (obsolete nil "25.1")) - (or (eq (process-exit-status process) 0) - (let* ((process-environment (browse-url-process-environment))) - ;; Netscape not running - start it - (message "Starting %s..." browse-url-netscape-program) - (apply #'start-process (concat "netscape" url) nil - browse-url-netscape-program - (append browse-url-netscape-startup-arguments (list url)))))) - -(defun browse-url-netscape-reload () - "Ask Netscape to reload its current document. -How depends on `browse-url-netscape-version'." - (declare (obsolete nil "25.1")) - (interactive) - ;; Backwards incompatibility reported by - ;; . - (browse-url-netscape-send (if (>= browse-url-netscape-version 4) - "xfeDoCommand(reload)" - "reload"))) - -(defun browse-url-netscape-send (command) - "Send a remote control command to Netscape." - (declare (obsolete nil "25.1")) - (let* ((process-environment (browse-url-process-environment))) - (apply #'start-process "netscape" nil - browse-url-netscape-program - (append browse-url-netscape-arguments - (list "-remote" command))))) - ;;;###autoload (defun browse-url-mozilla (url &optional new-window) "Ask the Mozilla WWW browser to load URL. @@ -1418,7 +1295,7 @@ currently selected window instead." ;;;###autoload (defun browse-url-gnome-moz (url &optional new-window) - "Ask Mozilla/Netscape to load URL via the GNOME program `gnome-moz-remote'. + "Ask Mozilla to load URL via the GNOME program `gnome-moz-remote'. Default to the URL around or before point. The strings in variable `browse-url-gnome-moz-arguments' are also passed. From 8f7da3ecb5e9d03b776a7c6caeb5c76e9ef680dc Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 7 Dec 2021 19:57:14 +0200 Subject: [PATCH 14/23] Improve before-make-frame-hook and after-make-frame-functions docs. * lisp/frame.el (before-make-frame-hook) (after-make-frame-functions): * doc/lispref/frames.texi (Creating Frames): Mention that these functions will be run for the initial frame only if added to the hook in early-init file. (Bug#38143) --- doc/lispref/frames.texi | 4 +++- lisp/frame.el | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 923ff19997e..00332fed0bf 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -171,7 +171,9 @@ usually not run for the initial frame, since Emacs reads the initial file only after creating that frame. However, if the initial frame is specified to use a separate minibuffer frame (@pxref{Minibuffers and Frames}), the functions will be run for both, the minibuffer-less and -the minibuffer frame. +the minibuffer frame. Alternatively, you can add functions to these +hooks in your ``early init file'' (@pxref{Init File}), in which case +they will be in effect for the initial frame as well. @defvar frame-inherited-parameters This variable specifies the list of frame parameters that a newly diff --git a/lisp/frame.el b/lisp/frame.el index 1319759e74d..dc7c628e81e 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -808,12 +808,16 @@ also select the new frame." new-frame)) (defvar before-make-frame-hook nil - "Functions to run before `make-frame' creates a new frame.") + "Functions to run before `make-frame' creates a new frame. +Note that these functions are usually not run for the initial +frame, unless you add them to the hook in your early-init file.") (defvar after-make-frame-functions nil "Functions to run after `make-frame' created a new frame. The functions are run with one argument, the newly created -frame.") +frame. +Note that these functions are usually not run for the initial +frame, unless you add them to the hook in your early-init file.") (defvar after-setting-font-hook nil "Functions to run after a frame's font has been changed.") From 9168abd7f52a0bdc42fd09617a9e1cecb7aaee89 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 7 Dec 2021 20:17:11 +0200 Subject: [PATCH 15/23] * etc/tutorials/TUTORIAL.he: Add section about package management. --- etc/tutorials/TUTORIAL.he | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/etc/tutorials/TUTORIAL.he b/etc/tutorials/TUTORIAL.he index 465768aa87c..fc4b769599e 100644 --- a/etc/tutorials/TUTORIAL.he +++ b/etc/tutorials/TUTORIAL.he @@ -985,6 +985,17 @@ find-file. בנוסף, מדריך למשתמש מתאר עוד הרבה מאד תכונות של Emacs. +* התקנת חבילות הרחבה +-------------------- +קיימות לא מעט חבילות תוכנה עבור Emacs אשר מרחיבות את היכולות שלו. חבילות +הרחבה אלו נכתבו ע״י קהילת משתמשי Emacs והן מהוות אוסף עשיר של תכונות +התומכות בשפות תכנות נוספות, ערכות נושא נוספות, תוספים לשילוב יישומים +חיצוניים, ועוד ועוד. + +לצפיה ברשימת חבילות ההרחבה הזמינות, יש להקיש M-x list-packages. בתצוגה +שתיפתח בעקבות זאת תוכלו לעיין בתיאור של חבילות, לבחור חבילות להתקנה במחשב +שלכם, להסיר חבילות, ועוד. פרטים נוספים לגבי ניהול חבילות הרחבה ניתן למצוא +במדריך למשתמש. * לסיום ------- From 9013e4ea194d0a41c9577cccef177e98dbe1268e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 19:31:21 +0100 Subject: [PATCH 16/23] browse-url: Remove support for Galeon * lisp/net/browse-url.el (browse-url-galeon-program) (browse-url-galeon-arguments) (browse-url-galeon-startup-arguments) (browse-url-galeon-new-window-is-tab, browse-url-galeon) (browse-url-galeon-sentinel): Delete, thus removing support for the long defunct Galeon web browser. * etc/NEWS: Announce its removal. --- etc/NEWS | 6 ++++ lisp/net/browse-url.el | 79 ------------------------------------------ 2 files changed, 6 insertions(+), 79 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 4bfa1eed85d..d5ed2ded8c5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -686,10 +686,16 @@ will abbreviate the user's home directory, for example by abbreviating ** Browse URL +--- *** Support for the Netscape web browser has been removed. This support has been obsolete since Emacs 25.1. The final version of the Netscape web browser was released in February, 2008. +--- +*** Support for the Galeon web browser has been removed. +This support has been obsolete since Emacs 25.1. The final version of +the Galeon web browser was released in September, 2008. + * New Modes and Packages in Emacs 29.1 diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 990bc41d984..e30c36ea4d5 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -307,26 +307,6 @@ Defaults to the value of `browse-url-firefox-arguments' at the time :type '(repeat (string :tag "Argument")) :version "24.1") -(defcustom browse-url-galeon-program "galeon" - "The name by which to invoke Galeon." - :type 'string) - -(make-obsolete-variable 'browse-url-galeon-program nil "25.1") - -(defcustom browse-url-galeon-arguments nil - "A list of strings to pass to Galeon as arguments." - :type '(repeat (string :tag "Argument"))) - -(make-obsolete-variable 'browse-url-galeon-arguments nil "25.1") - -(defcustom browse-url-galeon-startup-arguments browse-url-galeon-arguments - "A list of strings to pass to Galeon when it starts up. -Defaults to the value of `browse-url-galeon-arguments' at the time -`browse-url' is loaded." - :type '(repeat (string :tag "Argument"))) - -(make-obsolete-variable 'browse-url-galeon-startup-arguments nil "25.1") - (defcustom browse-url-epiphany-program "epiphany" "The name by which to invoke Epiphany." :type 'string) @@ -379,14 +359,6 @@ If non-nil, then open the URL in a new buffer rather than a new window if (make-obsolete-variable 'browse-url-conkeror-new-window-is-buffer nil "28.1") -(defcustom browse-url-galeon-new-window-is-tab nil - "Whether to open up new windows in a tab or a new window. -If non-nil, then open the URL in a new tab rather than a new window if -`browse-url-galeon' is asked to open it in a new window." - :type 'boolean) - -(make-obsolete-variable 'browse-url-galeon-new-window-is-tab nil "25.1") - (defcustom browse-url-epiphany-new-window-is-tab nil "Whether to open up new windows in a tab or a new window. If non-nil, then open the URL in a new tab rather than a new window if @@ -1007,7 +979,6 @@ instead of `browse-url-new-window-flag'." ((executable-find browse-url-mozilla-program) 'browse-url-mozilla) ((executable-find browse-url-firefox-program) 'browse-url-firefox) ((executable-find browse-url-chromium-program) 'browse-url-chromium) -;;; ((executable-find browse-url-galeon-program) 'browse-url-galeon) ((executable-find browse-url-kde-program) 'browse-url-kde) ((executable-find browse-url-chrome-program) 'browse-url-chrome) ((executable-find browse-url-webpositive-program) 'browse-url-webpositive) @@ -1162,56 +1133,6 @@ The optional argument NEW-WINDOW is not used." (function-put 'browse-url-chrome 'browse-url-browser-kind 'external) -;;;###autoload -(defun browse-url-galeon (url &optional new-window) - "Ask the Galeon WWW browser to load URL. -Default to the URL around or before point. The strings in variable -`browse-url-galeon-arguments' are also passed to Galeon. - -When called interactively, if variable `browse-url-new-window-flag' is -non-nil, load the document in a new Galeon window, otherwise use a -random existing one. A non-nil interactive prefix argument reverses -the effect of `browse-url-new-window-flag'. - -If `browse-url-galeon-new-window-is-tab' is non-nil, then whenever a -document would otherwise be loaded in a new window, it is loaded in a -new tab in an existing window instead. - -When called non-interactively, optional second argument NEW-WINDOW is -used instead of `browse-url-new-window-flag'." - (declare (obsolete nil "25.1")) - (interactive (browse-url-interactive-arg "URL: ")) - (setq url (browse-url-encode-url url)) - (let* ((process-environment (browse-url-process-environment)) - (process (apply #'start-process - (concat "galeon " url) - nil - browse-url-galeon-program - (append - browse-url-galeon-arguments - (if (browse-url-maybe-new-window new-window) - (if browse-url-galeon-new-window-is-tab - '("--new-tab") - '("--new-window" "--noraise")) - '("--existing")) - (list url))))) - (set-process-sentinel process - (lambda (process _change) - (browse-url-galeon-sentinel process url))))) - -(function-put 'browse-url-galeon 'browse-url-browser-kind 'external) - -(defun browse-url-galeon-sentinel (process url) - "Handle a change to the process communicating with Galeon." - (declare (obsolete nil "25.1")) - (or (eq (process-exit-status process) 0) - (let* ((process-environment (browse-url-process-environment))) - ;; Galeon is not running - start it - (message "Starting %s..." browse-url-galeon-program) - (apply #'start-process (concat "galeon " url) nil - browse-url-galeon-program - (append browse-url-galeon-startup-arguments (list url)))))) - (defun browse-url-epiphany (url &optional new-window) "Ask the Epiphany WWW browser to load URL. Default to the URL around or before point. The strings in variable From beed398eb5e49680b731aeacd553d357759043c1 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 19:46:21 +0100 Subject: [PATCH 17/23] browse-url: Refactor code to find executable * lisp/net/browse-url.el (browse-url--find-executable): Extract from... (browse-url-firefox-program, browse-url-chrome-program) (browse-url-chromium-program): ...here. --- lisp/net/browse-url.el | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index e30c36ea4d5..d317256f06d 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -258,11 +258,13 @@ Defaults to the value of `browse-url-mozilla-arguments' at the time `browse-url' is loaded." :type '(repeat (string :tag "Argument"))) +(defun browse-url--find-executable (candidates default) + (while (and candidates (not (executable-find (car candidates)))) + (setq candidates (cdr candidates))) + (or (car candidates) default)) + (defcustom browse-url-firefox-program - (let ((candidates '("icecat" "iceweasel" "firefox"))) - (while (and candidates (not (executable-find (car candidates)))) - (setq candidates (cdr candidates))) - (or (car candidates) "firefox")) + (browse-url--find-executable '("icecat" "iceweasel") "firefox") "The name by which to invoke Firefox or a variant of it." :type 'string) @@ -280,10 +282,8 @@ Defaults to the value of `browse-url-firefox-arguments' at the time "it no longer has any effect." "24.5") (defcustom browse-url-chrome-program - (let ((candidates '("google-chrome-stable" "google-chrome"))) - (while (and candidates (not (executable-find (car candidates)))) - (setq candidates (cdr candidates))) - (or (car candidates) "chromium")) + (browse-url--find-executable '("google-chrome-stable" "google-chrome") + "chromium") "The name by which to invoke the Chrome browser." :type 'string :version "25.1") @@ -294,10 +294,7 @@ Defaults to the value of `browse-url-firefox-arguments' at the time :version "25.1") (defcustom browse-url-chromium-program - (let ((candidates '("chromium" "chromium-browser"))) - (while (and candidates (not (executable-find (car candidates)))) - (setq candidates (cdr candidates))) - (or (car candidates) "chromium")) + (browse-url--find-executable '("chromium" "chromium-browser") "chromium") "The name by which to invoke Chromium." :type 'string :version "24.1") From 5364c571988b2bfba05870450a66767f7c134ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= Date: Tue, 7 Dec 2021 21:16:23 +0100 Subject: [PATCH 18/23] Improve yanking in the middle of comint process output * lisp/comint.el (comint--unmark-string-as-output): New function to remove unwanted properties from text yanked from comint buffers. (comint-mode): Use it as a 'filter-buffer-substring-function'. (comint-output-filter): Set 'insert-in-front-hooks' text property on process output such that text yanked by the user in the middle of process output is marked as process output (Bug#3735). (comint--mark-as-output): New function. (comint--mark-yanked-as-output): New function. --- lisp/comint.el | 54 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/lisp/comint.el b/lisp/comint.el index 544f0b8b820..5f99f560cf3 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -730,6 +730,8 @@ Entry to this mode runs the hooks on `comint-mode-hook'." (or (file-remote-p default-directory) "")) (setq-local comint-accum-marker (make-marker)) (setq-local font-lock-defaults '(nil t)) + (add-function :filter-return (local 'filter-buffer-substring-function) + #'comint--unmark-string-as-output) (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) (add-hook 'isearch-mode-hook 'comint-history-isearch-setup nil t) (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t) @@ -1815,7 +1817,8 @@ Ignore duplicates if `comint-input-ignoredups' is non-nil." (ring-insert comint-input-ring cmd))) (defconst comint--prompt-rear-nonsticky - '(field inhibit-line-move-field-capture read-only font-lock-face) + '( field inhibit-line-move-field-capture read-only font-lock-face + insert-in-front-hooks) "Text properties we set on the prompt and don't want to leak past it.") (defun comint-send-input (&optional no-newline artificial) @@ -2152,14 +2155,7 @@ Make backspaces delete the previous character." (goto-char (process-mark process)) ; In case a filter moved it. (unless comint-use-prompt-regexp - (with-silent-modifications - (add-text-properties comint-last-output-start (point) - `(rear-nonsticky - ,comint--prompt-rear-nonsticky - front-sticky - (field inhibit-line-move-field-capture) - field output - inhibit-line-move-field-capture t)))) + (comint--mark-as-output comint-last-output-start (point))) ;; Highlight the prompt, where we define `prompt' to mean ;; the most recent output that doesn't end with a newline. @@ -2191,6 +2187,46 @@ Make backspaces delete the previous character." ,comint--prompt-rear-nonsticky))) (goto-char saved-point))))))) +(defun comint--mark-as-output (beg end) + (with-silent-modifications + (add-text-properties + beg end + `(rear-nonsticky + ,comint--prompt-rear-nonsticky + front-sticky + (field inhibit-line-move-field-capture) + field output + inhibit-line-move-field-capture t + ;; Text inserted by a user in the middle of process output + ;; should be marked as output. This is needed for commands + ;; such as `yank' or `just-one-space' which don't use + ;; `insert-and-inherit' and thus bypass default text property + ;; inheritance. + insert-in-front-hooks + (,#'comint--mark-as-output ,#'comint--mark-yanked-as-output))))) + +(defun comint--mark-yanked-as-output (beg end) + ;; `yank' removes the field text property from the text it inserts + ;; due to `yank-excluded-properties', so arrange for this text + ;; property to be reapplied in the `after-change-functions'. + (let (fun) + (setq + fun + (lambda (beg1 end1 _len1) + (remove-hook 'after-change-functions fun t) + (when (and (= beg beg1) + (= end end1)) + (comint--mark-as-output beg1 end1)))) + (add-hook 'after-change-functions fun nil t))) + +(defun comint--unmark-string-as-output (string) + (remove-list-of-text-properties + 0 (length string) + '( rear-nonsticky front-sticky field + inhibit-line-move-field-capture insert-in-front-hooks) + string) + string) + (defun comint-preinput-scroll-to-bottom () "Go to the end of buffer in all windows showing it. Movement occurs if point in the selected window is not after the process mark, From 10655ce02f97d474d1fc0c34af9975f36720cc3e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 7 Dec 2021 23:28:44 +0100 Subject: [PATCH 19/23] image-dired: Navigate from image display buffer * lisp/image-dired.el (image-dired-mark-thumb-original-file) (image-dired-unmark-thumb-original-file) (image-dired-flag-thumb-original-file) (image-dired-toggle-mark-thumb-original-file) (image-dired-unmark-all-marks) (image-dired-display-next-thumbnail-original) (image-dired-display-previous-thumbnail-original): Make commands usable from image-dired-display-image-mode. (image-dired-display-image-mode-map): Bind above commands. (image-dired--with-thumbnail-buffer): New macro. --- etc/NEWS | 12 +++++- lisp/image-dired.el | 89 ++++++++++++++++++++++++++------------------- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d5ed2ded8c5..e8e0c910ef0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -552,6 +552,16 @@ user options that are no longer needed are now obsolete: 'image-dired-display-window-width-correction', 'image-dired-temp-image-file'. +--- +*** Navigation and marking commands now work in image display buffer. +The following new bindings have been added: + + n / SPC image-dired-display-previous-thumbnail-original + p / DEL image-dired-display-next-thumbnail-original + m image-dired-mark-thumb-original-file + d image-dired-flag-thumb-original-file + u image-dired-unmark-thumb-original-file + --- *** Reduce dependency on external "exiftool" command. The 'image-dired-copy-with-exif-file-name' no longer requires an @@ -562,7 +572,7 @@ external "exiftool" command to be available. The user options --- *** New command for the thumbnail buffer. The new command 'image-dired-unmark-all-marks' has been added. It is -bound to 'U' in the thumbnail buffer. +bound to 'U' in the thumbnail and display buffer. --- *** Support Thumbnail Managing Standard v0.9.0 (Dec 2020). diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 33f28a3440f..d75ccfece11 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1445,11 +1445,20 @@ for. The default is to look for `dired-marker-char'." "In Dired, return t if file on current line is flagged for deletion." (image-dired-dired-file-marked-p dired-del-marker)) +(defmacro image-dired--with-thumbnail-buffer (&rest body) + (declare (indent defun) (debug t)) + `(if-let ((buf (get-buffer image-dired-thumbnail-buffer))) + (with-current-buffer buf + (if-let ((win (get-buffer-window buf))) + (with-selected-window win + ,@body) + ,@body)) + (user-error "No such buffer: %s" image-dired-thumbnail-buffer))) + (defmacro image-dired--on-file-in-dired-buffer (&rest body) "Run BODY with point on file at point in Dired buffer. Should be called from commands in `image-dired-thumbnail-mode'." - (declare (indent defun) - (debug 1)) + (declare (indent defun) (debug t)) `(let ((file-name (image-dired-original-file-name)) (dired-buf (image-dired-associated-dired-buffer))) (if (not (and dired-buf file-name)) @@ -1461,40 +1470,45 @@ Should be called from commands in `image-dired-thumbnail-mode'." (defun image-dired-mark-thumb-original-file () "Mark original image file in associated Dired buffer." - (interactive nil image-dired-thumbnail-mode) - (image-dired--on-file-in-dired-buffer - (dired-mark 1)) - (image-dired-forward-image)) + (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) + (image-dired--with-thumbnail-buffer + (image-dired--on-file-in-dired-buffer + (dired-mark 1)) + (image-dired-forward-image))) (defun image-dired-unmark-thumb-original-file () "Unmark original image file in associated Dired buffer." - (interactive nil image-dired-thumbnail-mode) - (image-dired--on-file-in-dired-buffer - (dired-unmark 1)) - (image-dired-forward-image)) + (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) + (image-dired--with-thumbnail-buffer + (image-dired--on-file-in-dired-buffer + (dired-unmark 1)) + (image-dired-forward-image))) (defun image-dired-flag-thumb-original-file () "Flag original image file for deletion in associated Dired buffer." - (interactive nil image-dired-thumbnail-mode) - (image-dired--on-file-in-dired-buffer - (dired-flag-file-deletion 1)) - (image-dired-forward-image)) + (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) + (image-dired--with-thumbnail-buffer + (image-dired--on-file-in-dired-buffer + (dired-flag-file-deletion 1)) + (image-dired-forward-image))) (defun image-dired-toggle-mark-thumb-original-file () "Toggle mark on original image file in associated Dired buffer." - (interactive nil image-dired-thumbnail-mode) - (image-dired--on-file-in-dired-buffer - (if (image-dired-dired-file-marked-p) - (dired-unmark 1) - (dired-mark 1)))) + (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) + (image-dired--with-thumbnail-buffer + (image-dired--on-file-in-dired-buffer + (if (image-dired-dired-file-marked-p) + (dired-unmark 1) + (dired-mark 1))))) (defun image-dired-unmark-all-marks () "Remove all marks from all files in associated Dired buffer. Also update the marks in the thumbnail buffer." - (interactive nil image-dired-thumbnail-mode) - (with-current-buffer (image-dired-associated-dired-buffer) - (dired-unmark-all-marks)) - (image-dired-thumb-update-marks)) + (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) + (image-dired--with-thumbnail-buffer + (with-current-buffer (image-dired-associated-dired-buffer) + (dired-unmark-all-marks)) + (image-dired-thumb-update-marks))) (defun image-dired-jump-original-dired-buffer () "Jump to the Dired buffer associated with the current image file. @@ -1638,16 +1652,16 @@ You probably want to use this together with (defvar image-dired-display-image-mode-map (let ((map (make-sparse-keymap))) (define-key map "S" #'image-dired-slideshow-start) + (define-key map (kbd "SPC") #'image-dired-display-next-thumbnail-original) + (define-key map (kbd "DEL") #'image-dired-display-previous-thumbnail-original) + (define-key map "n" #'image-dired-display-next-thumbnail-original) + (define-key map "p" #'image-dired-display-previous-thumbnail-original) + (define-key map "m" #'image-dired-mark-thumb-original-file) + (define-key map "d" #'image-dired-flag-thumb-original-file) + (define-key map "u" #'image-dired-unmark-thumb-original-file) + (define-key map "U" #'image-dired-unmark-all-marks) ;; Disable keybindings from `image-mode-map' that doesn't make sense here. (define-key map "o" nil) ; image-save - (define-key map "n" nil) ; image-next-file - (define-key map "p" nil) ; image-previous-file - ;; FIXME: Should be replaced with image-dired commands. - (define-key map (kbd "DEL") nil) ; image-next-file - (define-key map (kbd "SPC") nil) ; image-next-file - ;; FIXME: Should be replaced with image-dired commands. - (define-key map "m" nil) ; image-mode-mark-file - (define-key map "u" nil) ; image-mode-unmark-file map) "Keymap for `image-dired-display-image-mode'.") @@ -2129,16 +2143,17 @@ function. The result is a couple of new files in ;;; Thumbnail mode (cont.) (defun image-dired-display-next-thumbnail-original (&optional arg) - "In thumbnail buffer, move to next thumbnail and display the image. + "Move to the next image in the thumbnail buffer and display it. With prefix ARG, move that many thumbnails." - (interactive "p" image-dired-thumbnail-mode) - (image-dired-forward-image arg t) - (image-dired-display-thumbnail-original-image)) + (interactive "p" image-dired-thumbnail-mode image-dired-display-image-mode) + (image-dired--with-thumbnail-buffer + (image-dired-forward-image arg t) + (image-dired-display-thumbnail-original-image))) (defun image-dired-display-previous-thumbnail-original (arg) - "In thumbnail buffer, move to previous thumbnail and display image. + "Move to the previous image in the thumbnail buffer and display it. With prefix ARG, move that many thumbnails." - (interactive "p" image-dired-thumbnail-mode) + (interactive "p" image-dired-thumbnail-mode image-dired-display-image-mode) (image-dired-display-next-thumbnail-original (- arg))) From b9c43acdd6286bf51ab561aabe84e3dcd3a30eff Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 8 Dec 2021 01:38:25 +0100 Subject: [PATCH 20/23] Check decoding results in webp_load before using it * src/image.c (webp_load): Check whether we were able to decode the image before using it. --- src/image.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/image.c b/src/image.c index 65bf22b9814..cd0f3f697f8 100644 --- a/src/image.c +++ b/src/image.c @@ -9039,6 +9039,12 @@ webp_load (struct frame *f, struct image *img) /* Linear [r0, g0, b0, r1, g1, b1, ...] order. */ decoded = WebPDecodeRGB (contents, size, &width, &height); + if (!decoded) + { + image_error ("Error when interpreting WebP image data"); + goto webp_error1; + } + if (!(width <= INT_MAX && height <= INT_MAX && check_image_size (f, width, height))) { From 13556f32ba55e29601b10db273a95c3c9eae4651 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 8 Dec 2021 01:12:10 +0100 Subject: [PATCH 21/23] ; * lisp/textmodes/texinfo.el: Remove stale comment. The referenced variable was removed two decades ago. --- lisp/textmodes/texinfo.el | 1 - 1 file changed, 1 deletion(-) diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 71db33bae35..dbf30dabe59 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -4,7 +4,6 @@ ;; Foundation, Inc. ;; Author: Robert J. Chassell -;; Date: [See date below for texinfo-version] ;; Maintainer: emacs-devel@gnu.org ;; Keywords: maint, tex, docs From 7d7f3d98dc0380d62ce1b1f5d051d25459134a9c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 8 Dec 2021 01:52:39 +0100 Subject: [PATCH 22/23] Pacify svg_load_image compiler warning * src/image.c (svg_load_image): Fix compiler warning from gcc (Debian 11.2.0-10). --- src/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/image.c b/src/image.c index cd0f3f697f8..49b14c49154 100644 --- a/src/image.c +++ b/src/image.c @@ -10456,7 +10456,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, /* Get the image dimensions. */ #if LIBRSVG_CHECK_VERSION (2, 46, 0) - gdouble gviewbox_width, gviewbox_height; + gdouble gviewbox_width = 0, gviewbox_height = 0; gboolean has_viewbox = FALSE; # if LIBRSVG_CHECK_VERSION (2, 52, 1) has_viewbox = rsvg_handle_get_intrinsic_size_in_pixels (rsvg_handle, From 176c63287ffdf56634984494f6610102737f393e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 8 Dec 2021 01:55:50 +0100 Subject: [PATCH 23/23] Convert etc-authors-mode-map to defvar-keymap * lisp/textmodes/etc-authors-mode.el (etc-authors-mode-map): Convert to defvar-keymap. --- lisp/textmodes/etc-authors-mode.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el index 8b5fefd3b7d..a79a1ecf4bb 100644 --- a/lisp/textmodes/etc-authors-mode.el +++ b/lisp/textmodes/etc-authors-mode.el @@ -115,12 +115,10 @@ With a prefix arg ARG, move point that many authors backward." (interactive "p" etc-authors-mode) (etc-authors-next-author (- arg))) -(defvar etc-authors-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "n" #'etc-authors-next-author) - (define-key map "p" #'etc-authors-prev-author) - map) - "Keymap for `etc-authors-mode'.") +(defvar-keymap etc-authors-mode-map + :doc "Keymap for `etc-authors-mode'." + "n" #'etc-authors-next-author + "p" #'etc-authors-prev-author) ;;;###autoload (define-derived-mode etc-authors-mode special-mode "Authors View"