commit 92ec47981acd353658782ce2e094e9f270d8bd8d (HEAD, refs/remotes/origin/master) Author: Alan Third Date: Mon Aug 17 20:58:47 2020 +0100 Get rid of build-time checks around NS tabbar code (bug#33118) * src/nsterm.m ([EmacsView initFrameFromEmacs:]): Get rid of version checks. diff --git a/src/nsterm.m b/src/nsterm.m index c1d133a00e..98c5b69d68 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7669,11 +7669,8 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f /* macOS Sierra automatically enables tabbed windows. We can't allow this to be enabled until it's available on a Free system. Currently it only happens by accident and is buggy anyway. */ -#if defined (NS_IMPL_COCOA) \ - && MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 +#ifdef NS_IMPL_COCOA if ([win respondsToSelector: @selector(setTabbingMode:)]) -#endif [win setTabbingMode: NSWindowTabbingModeDisallowed]; #endif commit 411a6fd290682f5ae88597194aef164a4a2545d9 Author: Lars Ingebrigtsen Date: Tue Aug 18 23:33:58 2020 +0200 Remove some compat code from viper-*.el * lisp/emulation/viper-util.el (viper-check-minibuffer-overlay): * lisp/emulation/viper-cmd.el (viper-minibuffer-standard-hook) (viper-minibuffer-real-start, viper-submit-report): No need to check whether minibuffer-prompt-end is defined. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 5518af4997..9ae7523b43 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -1886,15 +1886,11 @@ Undo previous insertion and inserts new." (or unread-command-events executing-kbd-macro (sit-for 840)) - (if (fboundp 'minibuffer-prompt-end) - (delete-region (minibuffer-prompt-end) (point-max)) - (erase-buffer)) + (delete-region (minibuffer-prompt-end) (point-max)) (insert viper-initial))) (defsubst viper-minibuffer-real-start () - (if (fboundp 'minibuffer-prompt-end) - (minibuffer-prompt-end) - (point-min))) + (minibuffer-prompt-end)) (defun viper-minibuffer-post-command-hook() (when (active-minibuffer-window) @@ -4738,8 +4734,7 @@ Please, specify your level now: ")) (viper-color-display-p (if (viper-window-display-p) (viper-color-display-p) 'non-x)) - (viper-frame-parameters (if (fboundp 'frame-parameters) - (frame-parameters (selected-frame)))) + (viper-frame-parameters (frame-parameters (selected-frame))) (viper-minibuffer-emacs-face (if (viper-has-face-support-p) (facep viper-minibuffer-emacs-face) diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 61bc26614e..83e45e1cd0 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -786,14 +786,11 @@ Otherwise return the normal value." (defun viper-check-minibuffer-overlay () (if (overlayp viper-minibuffer-overlay) (move-overlay - viper-minibuffer-overlay - (if (fboundp 'minibuffer-prompt-end) (minibuffer-prompt-end) 1) - (1+ (buffer-size))) + viper-minibuffer-overlay (minibuffer-prompt-end) (1+ (buffer-size))) (setq viper-minibuffer-overlay ;; make overlay open-ended (make-overlay - (if (fboundp 'minibuffer-prompt-end) (minibuffer-prompt-end) 1) - (1+ (buffer-size)) + (minibuffer-prompt-end) (1+ (buffer-size)) (current-buffer) nil 'rear-advance)))) commit cb202551f702c7b4695bf672420e7fbb14503b69 Author: Lars Ingebrigtsen Date: Tue Aug 18 23:23:42 2020 +0200 Remove some compat code from descr-text.el * lisp/descr-text.el (describe-text-properties-1): button.el is pre-loaded, so remove check for it. diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 55f0b7dcb4..d6da428063 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -141,8 +141,7 @@ otherwise." (wid-field (get-char-property pos 'field)) (wid-button (get-char-property pos 'button)) (wid-doc (get-char-property pos 'widget-doc)) - ;; If button.el is not loaded, we have no buttons in the text. - (button (and (fboundp 'button-at) (button-at pos))) + (button (button-at pos)) (button-type (and button (button-type button))) (button-label (and button (button-label button))) (widget (or wid-field wid-button wid-doc))) commit b906ef38fc68ea39b914c89c3c5eab5adfd03a2e Author: Lars Ingebrigtsen Date: Tue Aug 18 23:22:36 2020 +0200 Remove some compat code from viper-cmd.el * lisp/emulation/viper-cmd.el (viper-next-line-at-bol): No need to check for button-at. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index b10a533a77..5518af4997 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -2883,7 +2883,7 @@ If point is on a widget or a button, simulate clicking on that widget/button." (and (consp widget) (get (widget-type widget) 'widget-type)))) (widget-button-press (point)) - (if (and (fboundp 'button-at) (fboundp 'push-button) (button-at (point))) + (if (button-at (point)) (push-button) ;; not a widget or a button (save-excursion commit 556ff983e73251c10d51a5995707058ea1d67965 Author: Lars Ingebrigtsen Date: Tue Aug 18 23:18:50 2020 +0200 Remove some compat code from ps-print.el * lisp/ps-print.el: Don't make a face-list alias. diff --git a/lisp/ps-print.el b/lisp/ps-print.el index d9e59586cc..1ca4a23ab2 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -6275,10 +6275,6 @@ If FACE is not a valid face name, use default face." (goto-char to)) -;; Ensure that face-list is fbound. -(or (fboundp 'face-list) (defalias 'face-list 'list-faces)) - - (defun ps-build-reference-face-lists () (setq ps-print-face-alist nil) (if ps-auto-font-detect commit 80a42824299e69462448575782a39350805c3d7e Author: Lars Ingebrigtsen Date: Tue Aug 18 23:17:47 2020 +0200 Remove some compat code from forms.el * lisp/forms.el (forms-mode): make-face always exists. diff --git a/lisp/forms.el b/lisp/forms.el index fcb6075f94..83daabdcd6 100644 --- a/lisp/forms.el +++ b/lisp/forms.el @@ -504,12 +504,9 @@ Commands: Equivalent keys in read-only mode: (setq forms-new-record-filter nil) (setq forms-modified-record-filter nil) - ;; If running Emacs 19 under X, setup faces to show read-only and - ;; read-write fields. - (if (fboundp 'make-face) - (progn - (make-local-variable 'forms-ro-face) - (make-local-variable 'forms-rw-face))) + ;; Setup faces to show read-only and read-write fields. + (make-local-variable 'forms-ro-face) + (make-local-variable 'forms-rw-face) ;; eval the buffer, should set variables ;;(message "forms: processing control file...") @@ -609,16 +606,14 @@ Commands: Equivalent keys in read-only mode: (setq forms--mode-setup t) ;; Copy desired faces to the actual variables used by the forms formatter. - (if (fboundp 'make-face) + (make-local-variable 'forms--ro-face) + (make-local-variable 'forms--rw-face) + (if forms-read-only (progn - (make-local-variable 'forms--ro-face) - (make-local-variable 'forms--rw-face) - (if forms-read-only - (progn - (setq forms--ro-face forms-ro-face) - (setq forms--rw-face forms-ro-face)) - (setq forms--ro-face forms-ro-face) - (setq forms--rw-face forms-rw-face)))) + (setq forms--ro-face forms-ro-face) + (setq forms--rw-face forms-ro-face)) + (setq forms--ro-face forms-ro-face) + (setq forms--rw-face forms-rw-face)) ;; Make more local variables. (make-local-variable 'forms--file-buffer) commit 1a3105106900157337fda085c5bc534582af454d Author: Lars Ingebrigtsen Date: Tue Aug 18 23:15:09 2020 +0200 Remove some compat code from smiley.el * lisp/gnus/smiley.el (smiley-style): face-attribute is always defined. diff --git a/lisp/gnus/smiley.el b/lisp/gnus/smiley.el index d41f32801e..5504a52078 100644 --- a/lisp/gnus/smiley.el +++ b/lisp/gnus/smiley.el @@ -56,14 +56,11 @@ (defvar smiley-data-directory) -(defcustom smiley-style - (if (and (fboundp 'face-attribute) - ;; In batch mode, attributes can be unspecified. - (condition-case nil - (>= (face-attribute 'default :height) 160) - (error nil))) - 'medium - 'low-color) +;; In batch mode, attributes can be unspecified. +(defcustom smiley-style (if (ignore-errors + (>= (face-attribute 'default :height) 160)) + 'medium + 'low-color) "Smiley style." :type '(choice (const :tag "small, 3 colors" low-color) ;; 13x14 (const :tag "medium, ~10 colors" medium) ;; 16x16 commit ace7eeb505a2bc49a73be1736421ab9174031f7a Author: Lars Ingebrigtsen Date: Tue Aug 18 23:12:39 2020 +0200 Remove some compat code from chart.el * lisp/emacs-lisp/chart.el (chart-face-list): set-face-background-pixmap is always defined. diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 2321ac1ed5..964836a32a 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -105,9 +105,7 @@ Useful if new Emacs is used on B&W display.") (car cl) "white")) (set-face-foreground nf "black") - (if (and chart-face-use-pixmaps - pl - (fboundp 'set-face-background-pixmap)) + (if (and chart-face-use-pixmaps pl) (condition-case nil (set-face-background-pixmap nf (car pl)) (error (message "Cannot set background pixmap %s" (car pl))))) commit 3c76397bbcad361a17087a24ff706f78b6abde3f Author: Lars Ingebrigtsen Date: Tue Aug 18 23:11:02 2020 +0200 Remove some compat code from htmlfontify.el * lisp/htmlfontify.el (hfy-color-vals): color-values is always defined. diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 6265537e88..4d653972c9 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -556,10 +556,7 @@ If a window system is unavailable, calls `hfy-fallback-color-values'." '(1 2 3)) ;;(message ">> %s" color) (if window-system - (if (fboundp 'color-values) - (color-values color) - ;;(message "[%S]" window-system) - (x-color-values color)) + (color-values color) ;; blarg - tty colors are no good - go fetch some X colors: (hfy-fallback-color-values color)))) (define-obsolete-function-alias 'hfy-colour-vals #'hfy-color-vals "27.1") commit 66d8322e034679ef3a05e5747b3a4c7400712a69 Author: Lars Ingebrigtsen Date: Tue Aug 18 23:09:53 2020 +0200 Remove some compat code from ps files * lisp/ps-def.el (ps-color-device): Ditto. * lisp/ps-print.el (ps-color-scale): Make into an obsolete alias. (ps-begin-job): Adjust caller. * lisp/progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate): Ditto. diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index 08cf802bcb..22c70bf734 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -4527,7 +4527,7 @@ end (let* ((ebnf-tree tree) (ps-color-p (and ebnf-color-p (ps-color-device))) (ps-print-color-scale (if ps-color-p - (float (car (ps-color-values "white"))) + (float (car (color-values "white"))) 1.0)) (ebnf-total (length ebnf-tree)) (ebnf-nprod 0) @@ -4629,7 +4629,7 @@ end (let* ((ebnf-tree tree) (ps-color-p (and ebnf-color-p (ps-color-device))) (ps-print-color-scale (if ps-color-p - (float (car (ps-color-values "white"))) + (float (car (color-values "white"))) 1.0)) ps-zebra-stripes ps-line-number ps-razzle-dazzle ps-print-hook diff --git a/lisp/ps-def.el b/lisp/ps-def.el index f532511b97..65e8011f77 100644 --- a/lisp/ps-def.el +++ b/lisp/ps-def.el @@ -58,21 +58,11 @@ (define-obsolete-function-alias 'ps-frame-parameter #'frame-parameter "28.1") ;; Return t if the device (which can be changed during an emacs session) can -;; handle colors. This function is not yet implemented for GNU emacs. +;; handle colors. (defun ps-color-device () - (if (fboundp 'color-values) - (funcall 'color-values "Green") - t)) - - -(defun ps-color-values (x-color) - (cond - ((fboundp 'color-values) - (funcall 'color-values x-color)) - ((fboundp 'x-color-values) - (funcall 'x-color-values x-color)) - (t - (error "No available function to determine X color values")))) + (color-values "Green")) + +(define-obsolete-function-alias 'ps-color-values #'color-values "28.1") (defun ps-face-bold-p (face) diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 17b486bca1..d9e59586cc 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -3856,7 +3856,7 @@ It can be retrieved with `(ps-get ALIST-SYM KEY)'." (defun ps-color-scale (color) ;; Scale 16-bit X-COLOR-VALUE to PostScript color value in [0, 1] interval. (mapcar #'(lambda (value) (/ value ps-print-color-scale)) - (ps-color-values color))) + (color-values color))) (defun ps-face-underlined-p (face) @@ -5752,7 +5752,7 @@ XSTART YSTART are the relative position for the first page in a sheet.") ;; evaluated at dump-time because X isn't initialized. ps-color-p (and ps-print-color-p (ps-color-device)) ps-print-color-scale (if ps-color-p - (float (car (ps-color-values "white"))) + (float (car (color-values "white"))) 1.0) ps-default-background (ps-rgb-color (cond commit 5a6ed46c74dae55092d43d0078b86e5158cdc717 Author: Lars Ingebrigtsen Date: Tue Aug 18 23:05:22 2020 +0200 Remove some compat code from woman.el * lisp/woman.el (woman-fontify): Don't check for functions always defined. diff --git a/lisp/woman.el b/lisp/woman.el index c0e27c5707..891a1263ac 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -914,8 +914,8 @@ Troff emulation is experimental and largely untested. :group 'faces) (defcustom woman-fontify - (or (and (fboundp 'display-color-p) (display-color-p)) - (and (fboundp 'display-graphic-p) (display-graphic-p)) + (or (display-color-p) + (display-graphic-p) (x-display-color-p)) "If non-nil then WoMan assumes that face support is available. It defaults to a non-nil value if the display supports either colors commit a9086efcf1c5b26e9f5f63f39fda10709cc8555f Author: Basil L. Contovounesios Date: Tue Aug 18 21:29:41 2020 +0100 Replace last uses of idlwave-get-buffer-visiting * lisp/progmodes/idlw-help.el (idlwave-help-with-source): * lisp/progmodes/idlw-shell.el (idlwave-shell-set-bp-in-module) (idlwave-shell-delete-temp-files, idlwave-shell-save-and-action): Replace last occurrences of deprecated idlwave-get-buffer-visiting with now-equivalent find-buffer-visiting. diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el index d3a2308e06..ec4fd58886 100644 --- a/lisp/progmodes/idlw-help.el +++ b/lisp/progmodes/idlw-help.el @@ -267,7 +267,6 @@ support." (declare-function idlwave-find-class-definition "idlwave") (declare-function idlwave-find-inherited-class "idlwave") (declare-function idlwave-find-struct-tag "idlwave") -(declare-function idlwave-get-buffer-visiting "idlwave") (declare-function idlwave-in-quote "idlwave") (declare-function idlwave-make-full-name "idlwave") (declare-function idlwave-members-only "idlwave") @@ -880,7 +879,7 @@ This function can be used as `idlwave-extra-help-function'." (setq in-buf ; structure-tag completion is always in current buffer (if struct-tag idlwave-current-tags-buffer - (idlwave-get-buffer-visiting file))) + (find-buffer-visiting file))) ;; see if file is in a visited buffer, insert those contents (if in-buf (progn diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index f875915ca8..99ac0877c8 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -2640,7 +2640,7 @@ Assumes that `idlwave-shell-sources-alist' contains an entry for that module." (if (or (not source-file) (not (file-regular-p source-file)) (not (setq buf - (or (idlwave-get-buffer-visiting source-file) + (or (find-buffer-visiting source-file) (find-file-noselect source-file))))) (progn (message "The source file for module %s is probably not compiled" @@ -3241,8 +3241,7 @@ Does not work for a region with multiline blocks - use "Delete the temporary files and kill associated buffers." (if (stringp idlwave-shell-temp-pro-file) (condition-case nil - (let ((buf (idlwave-get-buffer-visiting - idlwave-shell-temp-pro-file))) + (let ((buf (find-buffer-visiting idlwave-shell-temp-pro-file))) (if (buffer-live-p buf) (kill-buffer buf)) (delete-file idlwave-shell-temp-pro-file)) @@ -3788,7 +3787,7 @@ handled by this command." (save-buffer) (setq idlwave-shell-last-save-and-action-file (buffer-file-name))) (idlwave-shell-last-save-and-action-file - (if (setq buf (idlwave-get-buffer-visiting + (if (setq buf (find-buffer-visiting idlwave-shell-last-save-and-action-file)) (with-current-buffer buf (save-buffer)))) commit 442a945df7c408bffbd6ab13145880cbb090ad9c Author: Stefan Kangas Date: Tue Aug 18 21:03:40 2020 +0200 * lisp/vt-control.el: Use lexical-binding. diff --git a/lisp/vt-control.el b/lisp/vt-control.el index fc3a514f92..d4c14197bd 100644 --- a/lisp/vt-control.el +++ b/lisp/vt-control.el @@ -1,4 +1,4 @@ -;;; vt-control.el --- Common VTxxx control functions +;;; vt-control.el --- Common VTxxx control functions -*- lexical-binding:t -*- ;; Copyright (C) 1993-1994, 2001-2020 Free Software Foundation, Inc. commit f45e79233c25631267864887631816afeb1f6b78 Author: Philip K Date: Tue Aug 18 21:19:21 2020 +0200 Fix Libravatar federation handling * lisp/image/gravatar.el (gravatar--service-libravatar): Implement correct algorithm (bug#40354). diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index 7441964095..3543be6de9 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -151,10 +151,11 @@ to track whether you're reading a specific mail." (save-match-data (if (not (string-match ".+@\\(.+\\)" addr)) (funcall callback "https://seccdn.libravatar.org/avatar") - (let* ((domain (match-string 1 addr)) - (records '(("_avatars-sec" . "https") - ("_avatars" . "http"))) - (func + (let ((domain (match-string 1 addr)) + (records '(("_avatars-sec" . "https") + ("_avatars" . "http"))) + func) + (setq func (lambda (result) (cond ((and @@ -205,7 +206,7 @@ to track whether you're reading a specific mail." (concat (caar records) "._tcp." domain) func 'SRV)) (t ;fallback - (funcall callback "https://seccdn.libravatar.org/avatar")))))) + (funcall callback "https://seccdn.libravatar.org/avatar"))))) (dns-query-asynchronous (concat (caar records) "._tcp." domain) func 'SRV t))))) commit ea0e09cf2cc925efbd265470ccc3c615e848c692 Author: Philip K Date: Tue Aug 18 21:18:06 2020 +0200 Fix Libravatar federation handling * lisp/image/gravatar.el (gravatar--service-libravatar): Implement correct algorithm (bug#40354). diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index e917033562..7441964095 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -151,25 +151,64 @@ to track whether you're reading a specific mail." (save-match-data (if (not (string-match ".+@\\(.+\\)" addr)) (funcall callback "https://seccdn.libravatar.org/avatar") - (let ((domain (match-string 1 addr)) - (records '(("_avatars-sec" . "https") - ("_avatars" . "http"))) - func) - (setq func + (let* ((domain (match-string 1 addr)) + (records '(("_avatars-sec" . "https") + ("_avatars" . "http"))) + (func (lambda (result) (cond - (result - (funcall callback (format "%s://%s/avatar" - (cdar records) result))) - ((> (length records) 1) - (pop records) + ((and + result ;there is a result + (let* ((data (mapcar (lambda (record) + (dns-get 'data (cdr record))) + (dns-get 'answers result))) + (priorities (mapcar (lambda (r) + (dns-get 'priority r)) + data)) + (max-priority (if priorities + (apply #'max priorities) + 0)) + (sum 0) top) + ;; Attempt to find all records with the same maximal + ;; priority, and calculate the sum of their weights. + (dolist (ent data) + (when (= max-priority (dns-get 'priority ent)) + (setq sum (+ sum (dns-get 'weight ent))) + (push ent top))) + ;; In case there is more than one maximal priority + ;; record, choose one at random, while taking the + ;; individual record weights into consideration. + (catch 'done + (dolist (ent top) + (when (and (or (= 0 sum) + (<= 0 (random sum) + (dns-get 'weight ent))) + ;; Ensure that port and domain data are + ;; valid. In case non of the results + ;; were valid, `catch' will evaluate to + ;; nil, and the next cond clause will be + ;; tested. + (<= 1 (dns-get 'port ent) 65535) + (string-match-p "\\`[-.0-9A-Za-z]+\\'" + (dns-get 'target ent))) + (funcall callback + (url-normalize-url + (format "%s://%s:%s/avatar" + (cdar records) + (dns-get 'target ent) + (dns-get 'port ent)))) + (throw 'done t)) + (setq sum (- sum (dns-get 'weight ent)))))))) + ((setq records (cdr records)) + ;; In case there are at least two methods. (dns-query-asynchronous (concat (caar records) "._tcp." domain) func 'SRV)) - (t - (funcall callback "https://seccdn.libravatar.org/avatar"))))) + (t ;fallback + (funcall callback "https://seccdn.libravatar.org/avatar")))))) (dns-query-asynchronous - (concat (caar records) "._tcp." domain) func 'SRV))))) + (concat (caar records) "._tcp." domain) + func 'SRV t))))) (defun gravatar-hash (mail-address) "Return the Gravatar hash for MAIL-ADDRESS." commit b4f05274c7a8facbf2a817ec14d234605959c4de Author: Robert Pluim Date: Tue Aug 18 20:31:37 2020 +0200 Fix truncated command names in process-attributes under Macos * src/sysdep.c (system_process_attributes): Fix truncation of command names in process-attributes under Macos (bug#36287). diff --git a/src/sysdep.c b/src/sysdep.c index b1371cd411..a1050c4309 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -53,6 +53,10 @@ along with GNU Emacs. If not, see . */ # include #endif +#ifdef DARWIN_OS +# include +#endif + #ifdef __FreeBSD__ /* Sparc/ARM machine/frame.h has 'struct frame' which conflicts with Emacs's 'struct frame', so rename it. */ @@ -3871,8 +3875,21 @@ system_process_attributes (Lisp_Object pid) if (gr) attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); + char pathbuf[PROC_PIDPATHINFO_MAXSIZE]; + char *comm; + + if (proc_pidpath (proc_id, pathbuf, sizeof(pathbuf)) > 0) + { + if ((comm = strrchr (pathbuf, '/'))) + comm++; + else + comm = pathbuf; + } + else + comm = proc.kp_proc.p_comm; + decoded_comm = (code_convert_string_norecord - (build_unibyte_string (proc.kp_proc.p_comm), + (build_unibyte_string (comm), Vlocale_coding_system, 0)); attrs = Fcons (Fcons (Qcomm, decoded_comm), attrs); commit c70b5e8ad005d881506b7394d70b45825c036ea0 Author: Stefan Kangas Date: Sun Aug 9 23:42:06 2020 +0200 Rearrange and clean up code in time.el (Bug#40863) * lisp/time.el (world-clock, zoneinfo-style-world-list) (legacy-style-world-list, world-clock-list) (time--display-world-list, world-clock-time-format) (world-clock-timer-enable, world-clock-timer-second): Move definitions closer to 'world-clock' code. Remove redundant :group args. (display-time-mail-file, display-time-mail-directory) (display-time-mail-function) (display-time-default-load-average) (display-time-load-average-threshold, display-time-day-and-date) (display-time-interval, display-time-24hr-format) (display-time-hook, display-time-mail-face) (display-time-use-mail-icon, display-time-mail-string) (display-time-format, display-time-string-forms): Remove redundant :group args. diff --git a/lisp/time.el b/lisp/time.el index fe918c5400..96b49ddabd 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -34,23 +34,20 @@ :group 'mode-line :group 'mail) - (defcustom display-time-mail-file nil "File name of mail inbox file, for indicating existence of new mail. Non-nil and not a string means don't check for mail; nil means use default, which is system-dependent, and is the same as used by Rmail." :type '(choice (const :tag "None" none) (const :tag "Default" nil) - (file :format "%v")) - :group 'display-time) + (file :format "%v"))) (defcustom display-time-mail-directory nil "Name of mail inbox directory, for indicating existence of new mail. Any nonempty regular file in the directory is regarded as newly arrived mail. If nil, do not check a directory for arriving mail." :type '(choice (const :tag "None" nil) - (directory :format "%v")) - :group 'display-time) + (directory :format "%v"))) (defcustom display-time-mail-function nil "Function to call, for indicating existence of new mail. @@ -58,8 +55,7 @@ If nil, that means use the default method: check that the file specified by `display-time-mail-file' is nonempty or that the directory `display-time-mail-directory' contains nonempty files." :type '(choice (const :tag "Default" nil) - (function)) - :group 'display-time) + (function))) (defcustom display-time-default-load-average 0 "Which load average value will be shown in the mode line. @@ -74,8 +70,7 @@ The value can be one of: :type '(choice (const :tag "1 minute load" 0) (const :tag "5 minutes load" 1) (const :tag "15 minutes load" 2) - (const :tag "None" nil)) - :group 'display-time) + (const :tag "None" nil))) (defvar display-time-load-average nil "Value of the system's load average currently shown on the mode line. @@ -85,27 +80,23 @@ This is an internal variable; setting it has no effect.") (defcustom display-time-load-average-threshold 0.1 "Load-average values below this value won't be shown in the mode line." - :type 'number - :group 'display-time) + :type 'number) ;;;###autoload (defcustom display-time-day-and-date nil "\ Non-nil means \\[display-time] should display day and date as well as time." - :type 'boolean - :group 'display-time) + :type 'boolean) (defvar display-time-timer nil) (defcustom display-time-interval 60 "Seconds between updates of time in the mode line." - :type 'integer - :group 'display-time) + :type 'integer) (defcustom display-time-24hr-format nil "Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23. A value of nil means 1 <= hh <= 12, and an AM/PM suffix is used." - :type 'boolean - :group 'display-time) + :type 'boolean) (defvar display-time-string nil "String used in mode lines to display a time string. @@ -115,106 +106,12 @@ It should not be set directly, but is instead updated by the (defcustom display-time-hook nil "List of functions to be called when the time is updated on the mode line." - :type 'hook - :group 'display-time) + :type 'hook) (defvar display-time-server-down-time nil "Time when mail file's file system was recorded to be down. If that file system seems to be up, the value is nil.") -(defgroup world-clock nil - "Display a world clock." - :group 'display-time) - -(defcustom zoneinfo-style-world-list - '(("America/Los_Angeles" "Seattle") - ("America/New_York" "New York") - ("Europe/London" "London") - ("Europe/Paris" "Paris") - ("Asia/Calcutta" "Bangalore") - ("Asia/Tokyo" "Tokyo")) - "Alist of zoneinfo-style time zones and places for `world-clock'. -Each element has the form (TIMEZONE LABEL). -TIMEZONE should be a string of the form AREA/LOCATION, where AREA is -the name of a region -- a continent or ocean, and LOCATION is the name -of a specific location, e.g., a city, within that region. -LABEL is a string to display as the label of that TIMEZONE's time." - :group 'world-clock - :type '(repeat (list string string)) - :version "23.1") - -(defcustom legacy-style-world-list - '(("PST8PDT" "Seattle") - ("EST5EDT" "New York") - ("GMT0BST" "London") - ("CET-1CDT" "Paris") - ("IST-5:30" "Bangalore") - ("JST-9" "Tokyo")) - "Alist of traditional-style time zones and places for `world-clock'. -Each element has the form (TIMEZONE LABEL). -TIMEZONE should be a string of the form: - - std[+|-]offset[dst[offset][,date[/time],date[/time]]] - -See the documentation of the TZ environment variable on your system, -for more details about the format of TIMEZONE. -LABEL is a string to display as the label of that TIMEZONE's time." - :group 'world-clock - :type '(repeat (list string string)) - :version "23.1") - -(defcustom world-clock-list t - "Alist of time zones and places for `world-clock' to display. -Each element has the form (TIMEZONE LABEL). -TIMEZONE should be in a format supported by your system. See the -documentation of `zoneinfo-style-world-list' and -`legacy-style-world-list' for two widely used formats. LABEL is -a string to display as the label of that TIMEZONE's time. - -If the value is t instead of an alist, use the value of -`zoneinfo-style-world-list' if it works on this platform, and of -`legacy-style-world-list' otherwise." - :group 'world-clock - :type '(choice (const :tag "Default" t) - (repeat :tag "List of zones and labels" - (list (string :tag "Zone") (string :tag "Label")))) - :version "28.1") - -(defun time--display-world-list () - (if (listp world-clock-list) - world-clock-list - ;; Determine if zoneinfo style timezones are supported by testing that - ;; America/New York and Europe/London return different timezones. - (let ((nyt (format-time-string "%z" nil "America/New_York")) - (gmt (format-time-string "%z" nil "Europe/London"))) - (if (string-equal nyt gmt) - legacy-style-world-list - zoneinfo-style-world-list)))) - -(defcustom world-clock-time-format "%A %d %B %R %Z" - "Time format for `world-clock', see `format-time-string'." - :group 'world-clock - :type 'string - :version "28.1") - -(defcustom world-clock-buffer-name "*wclock*" - "Name of the `world-clock' buffer." - :group 'world-clock - :type 'string - :version "28.1") - -(defcustom world-clock-timer-enable t - "If non-nil, a timer will update the `world-clock' buffer." - :group 'world-clock - :type 'boolean - :version "28.1") - -(defcustom world-clock-timer-second 60 - "Interval in seconds for updating the `world-clock' buffer." - :group 'world-clock - :type 'integer - :version "28.1") - ;;;###autoload (defun display-time () "Enable display of time, load level, and mail flag in mode lines. @@ -251,14 +148,12 @@ See `display-time-use-mail-icon' and `display-time-mail-face'.") "Non-nil means use an icon as mail indicator on a graphic display. Otherwise use `display-time-mail-string'. The icon may consume less of the mode line. It is specified by `display-time-mail-icon'." - :group 'display-time :type 'boolean) ;; Fixme: maybe default to the character if we can display Unicode. (defcustom display-time-mail-string "Mail" "String to use as the mail indicator in `display-time-string-forms'. This can use the Unicode letter character if you can display it." - :group 'display-time :version "22.1" :type '(choice (const "Mail") ;; Use :tag here because the Lucid menu won't display @@ -272,8 +167,7 @@ See the function `format-time-string' for an explanation of how to write this string. If this is nil, the defaults depend on `display-time-day-and-date' and `display-time-24hr-format'." :type '(choice (const :tag "Default" nil) - string) - :group 'display-time) + string)) (defcustom display-time-string-forms '((if (and (not display-time-format) display-time-day-and-date) @@ -327,8 +221,7 @@ For example: (if mail \" Mail\" \"\")) would give mode line times like `94/12/30 21:07:48 (UTC)'." - :type '(repeat sexp) - :group 'display-time) + :type '(repeat sexp)) (defun display-time-event-handler () (display-time-update) @@ -536,6 +429,92 @@ runs the normal hook `display-time-hook' after each update." ;;; World clock +(defgroup world-clock nil + "Display a world clock." + :group 'display-time) + +(defcustom zoneinfo-style-world-list + '(("America/Los_Angeles" "Seattle") + ("America/New_York" "New York") + ("Europe/London" "London") + ("Europe/Paris" "Paris") + ("Asia/Calcutta" "Bangalore") + ("Asia/Tokyo" "Tokyo")) + "Alist of zoneinfo-style time zones and places for `world-clock'. +Each element has the form (TIMEZONE LABEL). +TIMEZONE should be a string of the form AREA/LOCATION, where AREA is +the name of a region -- a continent or ocean, and LOCATION is the name +of a specific location, e.g., a city, within that region. +LABEL is a string to display as the label of that TIMEZONE's time." + :type '(repeat (list string string)) + :version "23.1") + +(defcustom legacy-style-world-list + '(("PST8PDT" "Seattle") + ("EST5EDT" "New York") + ("GMT0BST" "London") + ("CET-1CDT" "Paris") + ("IST-5:30" "Bangalore") + ("JST-9" "Tokyo")) + "Alist of traditional-style time zones and places for `world-clock'. +Each element has the form (TIMEZONE LABEL). +TIMEZONE should be a string of the form: + + std[+|-]offset[dst[offset][,date[/time],date[/time]]] + +See the documentation of the TZ environment variable on your system, +for more details about the format of TIMEZONE. +LABEL is a string to display as the label of that TIMEZONE's time." + :type '(repeat (list string string)) + :version "23.1") + +(defcustom world-clock-list t + "Alist of time zones and places for `world-clock' to display. +Each element has the form (TIMEZONE LABEL). +TIMEZONE should be in a format supported by your system. See the +documentation of `zoneinfo-style-world-list' and +`legacy-style-world-list' for two widely used formats. LABEL is +a string to display as the label of that TIMEZONE's time. + +If the value is t instead of an alist, use the value of +`zoneinfo-style-world-list' if it works on this platform, and of +`legacy-style-world-list' otherwise." + :type '(choice (const :tag "Default" t) + (repeat :tag "List of zones and labels" + (list (string :tag "Zone") (string :tag "Label")))) + :version "28.1") + +(defun time--display-world-list () + (if (listp world-clock-list) + world-clock-list + ;; Determine if zoneinfo style timezones are supported by testing that + ;; America/New York and Europe/London return different timezones. + (let ((nyt (format-time-string "%z" nil "America/New_York")) + (gmt (format-time-string "%z" nil "Europe/London"))) + (if (string-equal nyt gmt) + legacy-style-world-list + zoneinfo-style-world-list)))) + +(defcustom world-clock-time-format "%A %d %B %R %Z" + "Time format for `world-clock', see `format-time-string'." + :type 'string + :version "28.1") + +(defcustom world-clock-buffer-name "*wclock*" + "Name of the `world-clock' buffer." + :type 'string + :version "28.1") + +(defcustom world-clock-timer-enable t + "If non-nil, a timer will update the `world-clock' buffer." + :type 'boolean + :version "28.1") + +(defcustom world-clock-timer-second 60 + "Interval in seconds for updating the `world-clock' buffer." + :type 'integer + :version "28.1") + (defface world-clock-label '((t :inherit font-lock-variable-name-face)) "Face for time zone label in `world-clock' buffer.") commit d8d04e309d0752a0eb9505889ef99d96b0c63d20 Author: Stefan Kangas Date: Sat May 2 16:08:33 2020 +0200 Rename 'display-time-world' to 'world-clock' (Bug#40863) * lisp/time.el (world-clock-list, world-clock-time-format) (world-clock-buffer-name, world-clock-timer-enable) (world-clock-timer-second, world-clock-label, world-clock-mode) (world-clock-display, world-clock, world-clock-update): Rename from 'display-time-world-*' and update all uses. (world-clock): New defgroup. (zoneinfo-style-world-list, legacy-style-world-list): Use :group 'world-clock'. (display-time-world-list, display-time-world-time-format) (display-time-world-buffer-name) (display-time-world-timer-enable) (display-time-world-timer-second): Make into obsolete variable aliases for the new names. * lisp/time.el (display-time-world-mode) (display-time-world-display, display-time-world) (display-time-world-timer): Make into obsolete function aliases for the new names. * etc/NEWS: Announce the above changes. diff --git a/etc/NEWS b/etc/NEWS index 8085f96740..89fc12ab6d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -894,6 +894,31 @@ easily bind this menu to down-mouse-3 (usually the right mouse button) instead of mouse-2 (the default) by customizing the new option 'flyspell-use-mouse-3-for-menu'. +** Time + +--- +*** 'display-time-world' has been renamed to 'world-clock'. +'world-clock' creates a buffer with an updating time display using +several time zones. It is hoped that the new names are more +discoverable. + +The following functions have been renamed: + + 'display-time-world' to 'world-clock' + 'display-time-world-mode' to 'world-clock-mode' + 'display-time-world-display' to 'world-clock-display' + 'display-time-world-timer' to 'world-clock-update' + +The following options have been renamed: + + 'display-time-world-list' to 'world-clock-list' + 'display-time-world-time-format' to 'world-clock-time-format' + 'display-time-world-buffer-name' to 'world-clock-buffer-name' + 'display-time-world-timer-enable' to 'world-clock-timer-enable' + 'display-time-world-timer-second' to 'world-clock-timer-second' + +The old names are now obsolete. + * New Modes and Packages in Emacs 28.1 diff --git a/lisp/time.el b/lisp/time.el index 3625940334..fe918c5400 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -25,8 +25,7 @@ ;; Facilities to display current time/date and a new-mail indicator ;; in the Emacs mode line. The entry point is `display-time'. -;; Display time world in a buffer, the entry point is -;; `display-time-world'. +;; Use `world-clock' to display world clock in a buffer. ;;; Code: @@ -123,6 +122,10 @@ It should not be set directly, but is instead updated by the "Time when mail file's file system was recorded to be down. If that file system seems to be up, the value is nil.") +(defgroup world-clock nil + "Display a world clock." + :group 'display-time) + (defcustom zoneinfo-style-world-list '(("America/Los_Angeles" "Seattle") ("America/New_York" "New York") @@ -130,13 +133,13 @@ If that file system seems to be up, the value is nil.") ("Europe/Paris" "Paris") ("Asia/Calcutta" "Bangalore") ("Asia/Tokyo" "Tokyo")) - "Alist of zoneinfo-style time zones and places for `display-time-world'. + "Alist of zoneinfo-style time zones and places for `world-clock'. Each element has the form (TIMEZONE LABEL). TIMEZONE should be a string of the form AREA/LOCATION, where AREA is the name of a region -- a continent or ocean, and LOCATION is the name of a specific location, e.g., a city, within that region. LABEL is a string to display as the label of that TIMEZONE's time." - :group 'display-time + :group 'world-clock :type '(repeat (list string string)) :version "23.1") @@ -147,7 +150,7 @@ LABEL is a string to display as the label of that TIMEZONE's time." ("CET-1CDT" "Paris") ("IST-5:30" "Bangalore") ("JST-9" "Tokyo")) - "Alist of traditional-style time zones and places for `display-time-world'. + "Alist of traditional-style time zones and places for `world-clock'. Each element has the form (TIMEZONE LABEL). TIMEZONE should be a string of the form: @@ -156,12 +159,12 @@ TIMEZONE should be a string of the form: See the documentation of the TZ environment variable on your system, for more details about the format of TIMEZONE. LABEL is a string to display as the label of that TIMEZONE's time." - :group 'display-time + :group 'world-clock :type '(repeat (list string string)) :version "23.1") -(defcustom display-time-world-list t - "Alist of time zones and places for `display-time-world' to display. +(defcustom world-clock-list t + "Alist of time zones and places for `world-clock' to display. Each element has the form (TIMEZONE LABEL). TIMEZONE should be in a format supported by your system. See the documentation of `zoneinfo-style-world-list' and @@ -171,16 +174,15 @@ a string to display as the label of that TIMEZONE's time. If the value is t instead of an alist, use the value of `zoneinfo-style-world-list' if it works on this platform, and of `legacy-style-world-list' otherwise." - - :group 'display-time + :group 'world-clock :type '(choice (const :tag "Default" t) (repeat :tag "List of zones and labels" (list (string :tag "Zone") (string :tag "Label")))) - :version "23.1") + :version "28.1") (defun time--display-world-list () - (if (listp display-time-world-list) - display-time-world-list + (if (listp world-clock-list) + world-clock-list ;; Determine if zoneinfo style timezones are supported by testing that ;; America/New York and Europe/London return different timezones. (let ((nyt (format-time-string "%z" nil "America/New_York")) @@ -189,29 +191,29 @@ If the value is t instead of an alist, use the value of legacy-style-world-list zoneinfo-style-world-list)))) -(defcustom display-time-world-time-format "%A %d %B %R %Z" - "Format of the time displayed, see `format-time-string'." - :group 'display-time +(defcustom world-clock-time-format "%A %d %B %R %Z" + "Time format for `world-clock', see `format-time-string'." + :group 'world-clock :type 'string - :version "23.1") + :version "28.1") -(defcustom display-time-world-buffer-name "*wclock*" - "Name of the world clock buffer." - :group 'display-time +(defcustom world-clock-buffer-name "*wclock*" + "Name of the `world-clock' buffer." + :group 'world-clock :type 'string - :version "23.1") + :version "28.1") -(defcustom display-time-world-timer-enable t - "If non-nil, a timer will update the world clock." - :group 'display-time +(defcustom world-clock-timer-enable t + "If non-nil, a timer will update the `world-clock' buffer." + :group 'world-clock :type 'boolean - :version "23.1") + :version "28.1") -(defcustom display-time-world-timer-second 60 - "Interval in seconds for updating the world clock." - :group 'display-time +(defcustom world-clock-timer-second 60 + "Interval in seconds for updating the `world-clock' buffer." + :group 'world-clock :type 'integer - :version "23.1") + :version "28.1") ;;;###autoload (defun display-time () @@ -508,18 +510,43 @@ runs the normal hook `display-time-hook' after each update." (remove-hook 'rmail-after-get-new-mail-hook 'display-time-event-handler))) - -(defface display-time-world-label + +;;; Obsolete names + +(define-obsolete-variable-alias 'display-time-world-list + 'world-clock-list "28.1") +(define-obsolete-variable-alias 'display-time-world-time-format + 'world-clock-time-format "28.1") +(define-obsolete-variable-alias 'display-time-world-buffer-name + 'world-clock-buffer-name "28.1") +(define-obsolete-variable-alias 'display-time-world-timer-enable + 'world-clock-timer-enable "28.1") +(define-obsolete-variable-alias 'display-time-world-timer-second + 'world-clock-timer-second "28.1") + +(define-obsolete-function-alias 'display-time-world-mode + #'world-clock-mode "28.1") +(define-obsolete-function-alias 'display-time-world-display + #'world-clock-display "28.1") +(define-obsolete-function-alias 'display-time-world + #'world-clock "28.1") +(define-obsolete-function-alias 'display-time-world-timer + #'world-clock-update "28.1") + + +;;; World clock + +(defface world-clock-label '((t :inherit font-lock-variable-name-face)) - "Face for time zone label.") + "Face for time zone label in `world-clock' buffer.") -(define-derived-mode display-time-world-mode special-mode "World clock" +(define-derived-mode world-clock-mode special-mode "World clock" "Major mode for buffer that displays times in various time zones. -See `display-time-world'." - (setq revert-buffer-function #'display-time-world-timer) +See `world-clock'." + (setq revert-buffer-function #'world-clock-update) (setq show-trailing-whitespace nil)) -(defun display-time-world-display (alist) +(defun world-clock-display (alist) "Replace current buffer text with times in various zones, based on ALIST." (let ((inhibit-read-only t) (buffer-undo-list t) @@ -531,7 +558,7 @@ See `display-time-world'." (let* ((label (cadr zone)) (width (string-width label))) (push (cons label - (format-time-string display-time-world-time-format + (format-time-string world-clock-time-format now (car zone))) result) (when (> width max-width) @@ -540,35 +567,36 @@ See `display-time-world'." (dolist (timedata (nreverse result)) (insert (format fmt (propertize (car timedata) - 'face 'display-time-world-label) + 'face 'world-clock-label) (cdr timedata)))) (delete-char -1)) (goto-char (point-min))) ;;;###autoload -(defun display-time-world () - "Enable updating display of times in various time zones. -`display-time-world-list' specifies the zones. -To turn off the world time display, go to that window and type `\\[quit-window]'." +(defun world-clock () + "Display a world clock buffer with times in various time zones. +The variable `world-clock-list' specifies which time zones to use. +To turn off the world time display, go to the window and type `\\[quit-window]'." (interactive) - (when (and display-time-world-timer-enable - (not (get-buffer display-time-world-buffer-name))) - (run-at-time t display-time-world-timer-second 'display-time-world-timer)) - (pop-to-buffer display-time-world-buffer-name) - (display-time-world-display (time--display-world-list)) - (display-time-world-mode) + (when (and world-clock-timer-enable + (not (get-buffer world-clock-buffer-name))) + (run-at-time t world-clock-timer-second #'world-clock-update)) + (pop-to-buffer world-clock-buffer-name) + (world-clock-display (time--display-world-list)) + (world-clock-mode) (fit-window-to-buffer)) -(defun display-time-world-timer (&optional _arg _noconfirm) - (if (get-buffer display-time-world-buffer-name) - (with-current-buffer (get-buffer display-time-world-buffer-name) - (display-time-world-display (time--display-world-list))) +(defun world-clock-update (&optional _arg _noconfirm) + "Update the `world-clock' buffer." + (if (get-buffer world-clock-buffer-name) + (with-current-buffer (get-buffer world-clock-buffer-name) + (world-clock-display (time--display-world-list))) ;; cancel timer (let ((list timer-list)) (while list (let ((elt (pop list))) (when (equal (symbol-name (timer--function elt)) - "display-time-world-timer") + "world-clock-update") (cancel-timer elt))))))) ;;;###autoload commit 64da2e80966049222486c3f9f1757504c3a42331 Author: Stefan Kangas Date: Sun Apr 26 10:16:06 2020 +0200 Improve display-time-world UI (Bug#40863) * lisp/time.el (display-time-world-mode): Set 'revert-buffer-function' to 'display-time-world-timer'. (display-time-world-label): New face. (display-time-world-display): Use the new face. Move point to new buffer on creation and resize. diff --git a/lisp/time.el b/lisp/time.el index 44fd1a7e33..3625940334 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -509,9 +509,14 @@ runs the normal hook `display-time-hook' after each update." 'display-time-event-handler))) +(defface display-time-world-label + '((t :inherit font-lock-variable-name-face)) + "Face for time zone label.") + (define-derived-mode display-time-world-mode special-mode "World clock" "Major mode for buffer that displays times in various time zones. See `display-time-world'." + (setq revert-buffer-function #'display-time-world-timer) (setq show-trailing-whitespace nil)) (defun display-time-world-display (alist) @@ -533,7 +538,10 @@ See `display-time-world'." (setq max-width width)))) (setq fmt (concat "%-" (int-to-string max-width) "s %s\n")) (dolist (timedata (nreverse result)) - (insert (format fmt (car timedata) (cdr timedata)))) + (insert (format fmt + (propertize (car timedata) + 'face 'display-time-world-label) + (cdr timedata)))) (delete-char -1)) (goto-char (point-min))) @@ -541,18 +549,17 @@ See `display-time-world'." (defun display-time-world () "Enable updating display of times in various time zones. `display-time-world-list' specifies the zones. -To turn off the world time display, go to that window and type `q'." +To turn off the world time display, go to that window and type `\\[quit-window]'." (interactive) (when (and display-time-world-timer-enable (not (get-buffer display-time-world-buffer-name))) (run-at-time t display-time-world-timer-second 'display-time-world-timer)) - (with-current-buffer (get-buffer-create display-time-world-buffer-name) - (display-time-world-display (time--display-world-list)) - (display-buffer display-time-world-buffer-name - (cons nil '((window-height . fit-window-to-buffer)))) - (display-time-world-mode))) + (pop-to-buffer display-time-world-buffer-name) + (display-time-world-display (time--display-world-list)) + (display-time-world-mode) + (fit-window-to-buffer)) -(defun display-time-world-timer () +(defun display-time-world-timer (&optional _arg _noconfirm) (if (get-buffer display-time-world-buffer-name) (with-current-buffer (get-buffer display-time-world-buffer-name) (display-time-world-display (time--display-world-list))) commit 070c60665e71ac9dddf073c9c49c1f8e91a9811f Author: Stefan Kangas Date: Tue Aug 18 20:16:06 2020 +0200 Remove the "Recent message" section from the bug reports * lisp/mail/emacsbug.el (report-emacs-bug): Don't include "Recent messages" since it has privacy implications. Problem reported by Lars Ingebrigtsen in: https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg01099.html (bug#39185). diff --git a/etc/NEWS b/etc/NEWS index c608c612a4..8085f96740 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -815,6 +815,11 @@ window after starting). This variable defaults to nil. ** Miscellaneous +--- +*** 'M-x report-emacs-bug' will no longer include "Recent messages" section. +These were taken from the "*Messages*" buffer, and may inadvertently +leak information from the reporting user. + --- *** 'count-windows' now takes an optional parameter ALL-FRAMES. The semantics are as with 'walk-windows'. diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index efbc066855..6b9e1db5fc 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -324,18 +324,6 @@ usually do not have translators for other languages.\n\n"))) (let ((os (ignore-errors (report-emacs-bug--os-description)))) (if (stringp os) (insert "System Description: " os "\n\n"))) - (let ((message-buf (get-buffer "*Messages*"))) - (if message-buf - (let (beg-pos - (end-pos message-end-point)) - (with-current-buffer message-buf - (goto-char end-pos) - (forward-line -10) - (setq beg-pos (point))) - (terpri (current-buffer) t) - (insert "Recent messages:\n") - (insert-buffer-substring message-buf beg-pos end-pos)))) - (insert "\n") (when (and system-configuration-options (not (equal system-configuration-options ""))) (insert "Configured using:\n 'configure " commit 8d0f8a8a3670979115ac4b1de5c448b1f62f68e0 Author: Lars Ingebrigtsen Date: Tue Aug 18 20:10:44 2020 +0200 srecode-utest-project test should now work on Hydra, hopefully diff --git a/test/lisp/cedet/srecode-utest-template.el b/test/lisp/cedet/srecode-utest-template.el index 41e67fd1e3..7c5bbc599a 100644 --- a/test/lisp/cedet/srecode-utest-template.el +++ b/test/lisp/cedet/srecode-utest-template.el @@ -323,7 +323,6 @@ INSIDE SECTION: ARG HANDLER ONE") (ert-deftest srecode-utest-project () "Test that project filtering works." - :expected-result (if (getenv "EMACS_HYDRA_CI") :failed :passed) ; fixme (save-excursion (let ((testbuff (find-file-noselect srecode-utest-testfile)) (temp nil)) commit 206ce48fb0f635dcc67ef00586af8cf595fcb17c Author: Lars Ingebrigtsen Date: Tue Aug 18 11:06:48 2020 -0700 Fix a big in the srecore test setup * test/lisp/cedet/srecode-utest-template.el (srecode-utest-project): Set the current directory in the project so that we'll find it later (bug#42533). The in-project directory is /tmp, which is not actually what it is on many machines that have the temporary directory somewhere else. diff --git a/test/lisp/cedet/srecode-utest-template.el b/test/lisp/cedet/srecode-utest-template.el index 63c33a3c44..41e67fd1e3 100644 --- a/test/lisp/cedet/srecode-utest-template.el +++ b/test/lisp/cedet/srecode-utest-template.el @@ -347,6 +347,10 @@ INSIDE SECTION: ARG HANDLER ONE") ;; Load the application templates, and make sure we can find them. (srecode-load-tables-for-mode major-mode 'tests) + (dolist (table (oref (srecode-table) tables)) + (when (gethash "test" (oref table contexthash)) + (oset table project default-directory))) + (setq temp (srecode-template-get-table (srecode-table) "test-project" "test" commit a711f7012545231a77ff4c5b33af87611701a212 Author: Stefan Kangas Date: Tue Aug 18 19:02:21 2020 +0200 * lisp/savehist.el: Doc fix. diff --git a/lisp/savehist.el b/lisp/savehist.el index fcfdb47c7e..4e52efe7f1 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -4,7 +4,7 @@ ;; Author: Hrvoje Nikšić ;; Maintainer: emacs-devel@gnu.org -;; Keywords: minibuffer +;; Keywords: convenience, minibuffer ;; Version: 24 ;; This file is part of GNU Emacs. @@ -27,7 +27,7 @@ ;; Many editors (e.g. Vim) have the feature of saving minibuffer ;; history to an external file after exit. This package provides the ;; same feature in Emacs. When set up, it saves recorded minibuffer -;; histories to a file (`~/.emacs-history' by default). Additional +;; histories to a file (`~/.emacs.d/history' by default). Additional ;; variables may be specified by customizing ;; `savehist-additional-variables'. commit 495aa532f1a6486295dc502f22a3300d8f61be16 Author: Pip Cet Date: Tue Aug 18 18:27:05 2020 +0200 Fix minor bugs in image.c * test/src/image-tests.el (image-test-circular-specs): New file. * src/image.c (parse_image_spec): Return failure for circular lists. (valid_image_p): Don't look at odd-numbered list elements expecting to find a property name. (image_spec_value): Handle circular lists. (equal_lists): Introduce. (search_image_cache): Use `equal_lists' (bug#36403). diff --git a/src/image.c b/src/image.c index e236b38921..643b3d0a1f 100644 --- a/src/image.c +++ b/src/image.c @@ -803,17 +803,23 @@ valid_image_p (Lisp_Object object) { Lisp_Object tail = XCDR (object); FOR_EACH_TAIL_SAFE (tail) - if (EQ (XCAR (tail), QCtype)) - { - tail = XCDR (tail); - if (CONSP (tail)) - { - struct image_type const *type = lookup_image_type (XCAR (tail)); - if (type) - return type->valid_p (object); - } - break; - } + { + if (EQ (XCAR (tail), QCtype)) + { + tail = XCDR (tail); + if (CONSP (tail)) + { + struct image_type const *type = + lookup_image_type (XCAR (tail)); + if (type) + return type->valid_p (object); + } + break; + } + tail = XCDR (tail); + if (! CONSP (tail)) + return false; + } } return false; @@ -899,7 +905,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, return false; plist = XCDR (spec); - while (CONSP (plist)) + FOR_EACH_TAIL_SAFE (plist) { Lisp_Object key, value; @@ -913,7 +919,6 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, if (!CONSP (plist)) return false; value = XCAR (plist); - plist = XCDR (plist); /* Find key in KEYWORDS. Error if not found. */ for (i = 0; i < nkeywords; ++i) @@ -921,7 +926,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, break; if (i == nkeywords) - continue; + goto maybe_done; /* Record that we recognized the keyword. If a keyword was found more than once, it's an error. */ @@ -1009,14 +1014,20 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, if (EQ (key, QCtype) && !(EQ (type, value) || EQ (type, Qnative_image))) return false; - } - /* Check that all mandatory fields are present. */ - for (i = 0; i < nkeywords; ++i) - if (keywords[i].count < keywords[i].mandatory_p) - return false; + maybe_done: + if (EQ (XCDR (plist), Qnil)) + { + /* Check that all mandatory fields are present. */ + for (i = 0; i < nkeywords; ++i) + if (keywords[i].mandatory_p && keywords[i].count == 0) + return false; + + return true; + } + } - return NILP (plist); + return false; } @@ -1031,9 +1042,8 @@ image_spec_value (Lisp_Object spec, Lisp_Object key, bool *found) eassert (valid_image_p (spec)); - for (tail = XCDR (spec); - CONSP (tail) && CONSP (XCDR (tail)); - tail = XCDR (XCDR (tail))) + tail = XCDR (spec); + FOR_EACH_TAIL_SAFE (tail) { if (EQ (XCAR (tail), key)) { @@ -1041,6 +1051,9 @@ image_spec_value (Lisp_Object spec, Lisp_Object key, bool *found) *found = 1; return XCAR (XCDR (tail)); } + tail = XCDR (tail); + if (! CONSP (tail)) + break; } if (found) @@ -1584,6 +1597,16 @@ make_image_cache (void) return c; } +/* Compare two lists (one of which must be proper), comparing each + element with `eq'. */ +static bool +equal_lists (Lisp_Object a, Lisp_Object b) +{ + while (CONSP (a) && CONSP (b) && EQ (XCAR (a), XCAR (b))) + a = XCDR (a), b = XCDR (b); + + return EQ (a, b); +} /* Find an image matching SPEC in the cache, and return it. If no image is found, return NULL. */ @@ -1610,7 +1633,7 @@ search_image_cache (struct frame *f, Lisp_Object spec, EMACS_UINT hash) for (img = c->buckets[i]; img; img = img->next) if (img->hash == hash - && !NILP (Fequal (img->spec, spec)) + && !equal_lists (img->spec, spec) && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) break; diff --git a/test/manual/image-circular-tests.el b/test/manual/image-circular-tests.el new file mode 100644 index 0000000000..33ea3ea954 --- /dev/null +++ b/test/manual/image-circular-tests.el @@ -0,0 +1,144 @@ +;;; image-tests.el --- Test suite for image-related functions. + +;; Copyright (C) 2019 Free Software Foundation, Inc. + +;; Author: Pip Cet +;; Keywords: internal +;; Human-Keywords: internal + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) + +(ert-deftest image-test-duplicate-keywords () + "Test that duplicate keywords in an image spec lead to rejection." + (should-error (image-size `(image :type xbm :type xbm :width 1 :height 1 + :data ,(bool-vector t)) + t))) + +(ert-deftest image-test-circular-plist () + "Test that a circular image spec is rejected." + (should-error + (let ((l `(image :type xbm :width 1 :height 1 :data ,(bool-vector t)))) + (setcdr (last l) '#1=(:invalid . #1#)) + (image-size l t)))) + +(ert-deftest image-test-:type-property-value () + "Test that :type is allowed as a property value in an image spec." + (should (equal (image-size `(image :dummy :type :type xbm :width 1 :height 1 + :data ,(bool-vector t)) + t) + (cons 1 1)))) + +(ert-deftest image-test-circular-specs () + "Test that circular image spec property values do not cause infinite recursion." + (should + (let* ((circ1 (cons :dummy nil)) + (circ2 (cons :dummy nil)) + (spec1 `(image :type xbm :width 1 :height 1 + :data ,(bool-vector 1) :ignored ,circ1)) + (spec2 `(image :type xbm :width 1 :height 1 + :data ,(bool-vector 1) :ignored ,circ2))) + (setcdr circ1 circ1) + (setcdr circ2 circ2) + (and (equal (image-size spec1 t) (cons 1 1)) + (equal (image-size spec2 t) (cons 1 1)))))) + +(provide 'image-tests) +;;; image-tests.el ends here. +;;; image-tests.el --- tests for image.el -*- lexical-binding: t -*- + +;; Copyright (C) 2019-2020 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'image) +(eval-when-compile + (require 'cl-lib)) + +(defconst image-tests--emacs-images-directory + (expand-file-name "../etc/images" (getenv "EMACS_TEST_DIRECTORY")) + "Directory containing Emacs images.") + +(ert-deftest image--set-property () + "Test `image--set-property' behavior." + (let ((image (list 'image))) + ;; Add properties. + (setf (image-property image :scale) 1) + (should (equal image '(image :scale 1))) + (setf (image-property image :width) 8) + (should (equal image '(image :scale 1 :width 8))) + (setf (image-property image :height) 16) + (should (equal image '(image :scale 1 :width 8 :height 16))) + ;; Delete properties. + (setf (image-property image :type) nil) + (should (equal image '(image :scale 1 :width 8 :height 16))) + (setf (image-property image :scale) nil) + (should (equal image '(image :width 8 :height 16))) + (setf (image-property image :height) nil) + (should (equal image '(image :width 8))) + (setf (image-property image :width) nil) + (should (equal image '(image))))) + +(ert-deftest image-type-from-file-header-test () + "Test image-type-from-file-header." + (should (eq (if (image-type-available-p 'svg) 'svg) + (image-type-from-file-header + (expand-file-name "splash.svg" + image-tests--emacs-images-directory))))) + +(ert-deftest image-rotate () + "Test `image-rotate'." + (cl-letf* ((image (list 'image)) + ((symbol-function 'image--get-imagemagick-and-warn) + (lambda () image))) + (let ((current-prefix-arg '(4))) + (call-interactively #'image-rotate)) + (should (equal image '(image :rotation 270.0))) + (call-interactively #'image-rotate) + (should (equal image '(image :rotation 0.0))) + (image-rotate) + (should (equal image '(image :rotation 90.0))) + (image-rotate 0) + (should (equal image '(image :rotation 90.0))) + (image-rotate 1) + (should (equal image '(image :rotation 91.0))) + (image-rotate 1234.5) + (should (equal image '(image :rotation 245.5))) + (image-rotate -154.5) + (should (equal image '(image :rotation 91.0))))) + +;;; image-tests.el ends here commit 52d7aa76b1c4564c700b70b63ba4cb4b2dd0b3f7 Author: Philip K Date: Tue Aug 18 18:06:13 2020 +0200 Fix issues with OpenPGP header * doc/misc/message.texi (OpenPGP Header): Mention correct hook * lisp/gnus/message.el (message-openpgp-header): Improve customize type (message-add-openpgp-header): Insert header into correct buffer (bug#42913). diff --git a/doc/misc/message.texi b/doc/misc/message.texi index 204a6386e0..55b166eb8b 100644 --- a/doc/misc/message.texi +++ b/doc/misc/message.texi @@ -1265,7 +1265,7 @@ for a long time. For more details, see To use this in Message, say: @lisp -(add-hook 'message-send-hook 'message-add-openpgp-header) +(add-hook 'message-header-setup-hook 'message-add-openpgp-header) @end lisp @noindent diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ab625be9e3..07ff489038 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2751,16 +2751,17 @@ OpenPGP header will be left out. If all the values are nil, or `message-openpgp-header' is itself nil, the OpenPGP header will not be inserted." :type '(choice - (const nil :tag "Don't add OpenPGP header") - (list (choice (string :tag "ID") - (const nil :tag "No ID")) + (const :tag "Don't add OpenPGP header" nil) + (list :tag "Use OpenPGP header" + (choice (string :tag "ID") + (const :tag "No ID" nil)) (choice (string :tag "Key") - (const nil :tag "No Key")) - (choice (other nil :tag "None") - (const "unprotected" :tag "Unprotected") - (const "sign" :tag "Sign") - (const "encrypt" :tag "Encrypt") - (const "signencrypt" :tag "Sign and Encrypt")))) + (const :tag "No Key" nil)) + (choice (other :tag "None" nil) + (const :tag "Unprotected" "unprotected") + (const :tag "Sign" "sign") + (const :tag "Encrypt" "encrypt") + (const :tag "Sign and Encrypt" "signencrypt")))) :version "28.1") (defun message-add-openpgp-header () @@ -2768,32 +2769,34 @@ will not be inserted." Header will be constructed as specified in `message-openpgp-header'. -Consider adding this function to `message-send-hook'." +Consider adding this function to `message-header-setup-hook'" ;; See https://tools.ietf.org/html/draft-josefsson-openpgp-mailnews-header (when (and message-openpgp-header (or (nth 0 message-openpgp-header) (nth 1 message-openpgp-header) (nth 2 message-openpgp-header))) - (with-temp-buffer - (insert "OpenPGP: ") - ;; add ID - (let (need-sep) - (when (nth 0 message-openpgp-header) - (insert "id=" (nth 0 message-openpgp-header)) - (setq need-sep t)) - ;; add URL - (when (nth 1 message-openpgp-header) - (when need-sep (insert "; ")) - (if (string-match-p ";") - (insert "url=\"" (nth 1 message-openpgp-header) "\"") - (insert "url=\"" (nth 1 message-openpgp-header) "\"")) - (setq need-sep t)) - ;; add preference - (when (nth 2 message-openpgp-header) - (when need-sep (insert "; ")) - (insert "preference=" (nth 2 message-openpgp-header)))) - ;; insert header - (message-add-header (buffer-string))))) + (message-add-header + (with-temp-buffer + (insert "OpenPGP: ") + ;; add ID + (let (need-sep) + (when (nth 0 message-openpgp-header) + (insert "id=" (nth 0 message-openpgp-header)) + (setq need-sep t)) + ;; add URL + (when (nth 1 message-openpgp-header) + (when need-sep (insert "; ")) + (if (string-match-p ";") + (insert "url=\"" (nth 1 message-openpgp-header) "\"") + (insert "url=\"" (nth 1 message-openpgp-header) "\"")) + (setq need-sep t)) + ;; add preference + (when (nth 2 message-openpgp-header) + (when need-sep (insert "; ")) + (insert "preference=" (nth 2 message-openpgp-header)))) + ;; insert header + (buffer-string))) + (message-sort-headers))) commit 4670969e6791c76460c647b5f86317ddb75898bc Author: Kalle Olavi Niemitalo Date: Tue Aug 18 17:03:07 2020 +0200 Fix buffer overflow in x-send-client-message * xselect.c (x_fill_property_data): Add parameter NELEMENTS_MAX. * xterm.h (x_fill_property_data): Update prototype. * xselect.c (Fx_send_client_event): Update call. This fixes a buffer overflow in event.xclient.data. * xfns.c (Fx_change_window_property): Update call (bug#23482). Copyright-paperwork-exempt: yes diff --git a/src/xfns.c b/src/xfns.c index d56fc0ad05..78f977bf0a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5890,7 +5890,8 @@ If WINDOW-ID is non-nil, change the property of that window instead elsize = element_format == 32 ? sizeof (long) : element_format >> 3; data = xnmalloc (nelements, elsize); - x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format); + x_fill_property_data (FRAME_X_DISPLAY (f), value, data, nelements, + element_format); } else { diff --git a/src/xselect.c b/src/xselect.c index bf50c598b2..383aebf96c 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2276,23 +2276,28 @@ x_check_property_data (Lisp_Object data) DPY is the display use to look up X atoms. DATA is a Lisp list of values to be converted. - RET is the C array that contains the converted values. It is assumed - it is big enough to hold all values. + RET is the C array that contains the converted values. + NELEMENTS_MAX is the number of values that will fit in RET. + Any excess values in DATA are ignored. FORMAT is 8, 16 or 32 and denotes char/short/long for each C value to be stored in RET. Note that long is used for 32 even if long is more than 32 bits (see man pages for XChangeProperty, XGetWindowProperty and XClientMessageEvent). */ void -x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format) +x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, + int nelements_max, int format) { unsigned long val; unsigned long *d32 = (unsigned long *) ret; unsigned short *d16 = (unsigned short *) ret; unsigned char *d08 = (unsigned char *) ret; + int nelements; Lisp_Object iter; - for (iter = data; CONSP (iter); iter = XCDR (iter)) + for (iter = data, nelements = 0; + CONSP (iter) && nelements < nelements_max; + iter = XCDR (iter), nelements++) { Lisp_Object o = XCAR (iter); @@ -2593,7 +2598,9 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest; memset (event.xclient.data.l, 0, sizeof (event.xclient.data.l)); + /* event.xclient.data can hold 20 chars, 10 shorts, or 5 longs. */ x_fill_property_data (dpyinfo->display, values, event.xclient.data.b, + 5 * 32 / event.xclient.format, event.xclient.format); /* If event mask is 0 the event is sent to the client that created diff --git a/src/xterm.h b/src/xterm.h index bc10043c54..db8d584781 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1207,6 +1207,7 @@ extern int x_check_property_data (Lisp_Object); extern void x_fill_property_data (Display *, Lisp_Object, void *, + int, int); extern Lisp_Object x_property_data_to_lisp (struct frame *, const unsigned char *, commit 06738a40d10706e36ca0dc767ed3a0ef6fe17078 Merge: 192247bb04 362ca83a3b Author: Glenn Morris Date: Tue Aug 18 07:51:08 2020 -0700 Merge from origin/emacs-27 362ca83a3b (origin/emacs-27) Let Emacs start even if curdir is inacce... dd989c0ea0 * etc/NEWS: Mention GnuPG 2.0 through 2.1.5 issue (Bug#428... 4542b750cc Fix bug with ~/Emacs file not being read at init 9b403d624e ; Fix last change 6bff65a626 ; * doc/lispref/sequences.texi (Sequence Functions): Typo ... 3c4edfd85e Prevent from frozen frame after `C-z' in Lucid builds 98e8241992 Document the 'flex' completion style 19fa8b7ca3 Note that Emacs needs systemd support if systemd is used t... # Conflicts: # etc/NEWS commit 192247bb04104da156ca3f00e174b6bf669eb0af Merge: 013ddd1e5d 8ff5e346fe Author: Glenn Morris Date: Tue Aug 18 07:51:07 2020 -0700 ; Merge from origin/emacs-27 The following commit was skipped: 8ff5e346fe Regexps cannot infloop; fix manual commit 013ddd1e5dcea1515e849eb9dea5b9c864407bd0 Merge: 23e6c36645 cf0ee6f49b Author: Glenn Morris Date: Tue Aug 18 07:51:05 2020 -0700 Merge from origin/emacs-27 cf0ee6f49b ; spelling fixes 16f4f26632 Fix startup working dir bug on NeXTSTEP commit 23e6c36645bb8f07f55ba94af21cebaaab2c91d3 Author: Lars Ingebrigtsen Date: Tue Aug 18 16:45:29 2020 +0200 Implement a cache for all types of gravatars * lisp/image/gravatar.el (gravatar-automatic-caching): Made obsolete. (gravatar-cache-ttl): Ditto. (gravatar--cache): New variable to cache gravatars in-memory. (gravatar-retrieve): Maintain the cache. (gravatar--prune-cache): Remove old entries. (gravatar-retrieved): Remove use of the old-style cache (bug#40355). diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index d1091e57cb..e917033562 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -39,6 +39,7 @@ "Whether to cache retrieved gravatars." :type 'boolean :group 'gravatar) +(make-obsolete-variable 'gravatar-automatic-caching nil "28.1") (defcustom gravatar-cache-ttl 2592000 "Time to live in seconds for gravatar cache entries. @@ -48,6 +49,7 @@ is retrieved anew. The default value is 30 days." ;; Restricted :type to number of seconds. :version "27.1" :group 'gravatar) +(make-obsolete-variable 'gravatar-cache-ttl nil "28.1") (defcustom gravatar-rating "g" "Most explicit Gravatar rating level to allow. @@ -206,19 +208,50 @@ to track whether you're reading a specific mail." (search-forward "\n\n" nil t) (buffer-substring (point) (point-max))))) +(defvar gravatar--cache (make-hash-table :test 'equal) + "Cache for gravatars.") + ;;;###autoload (defun gravatar-retrieve (mail-address callback &optional cbargs) "Asynchronously retrieve a gravatar for MAIL-ADDRESS. When finished, call CALLBACK as (apply CALLBACK GRAVATAR CBARGS), where GRAVATAR is either an image descriptor, or the symbol `error' if the retrieval failed." - (gravatar-build-url - mail-address - (lambda (url) - (if (url-cache-expired url gravatar-cache-ttl) - (url-retrieve url #'gravatar-retrieved (list callback cbargs) t) - (with-current-buffer (url-fetch-from-cache url) - (gravatar-retrieved () callback cbargs)))))) + (let ((cached (gethash mail-address gravatar--cache))) + (gravatar--prune-cache) + (if cached + (apply callback (cdr cached) cbargs) + ;; Nothing in the cache, fetch it. + (gravatar-build-url + mail-address + (lambda (url) + (url-retrieve + url + (lambda (status) + (let* ((data (and (not (plist-get status :error)) + (gravatar-get-data))) + (image (and data (create-image data nil t)))) + ;; Store the image in the cache. + (when image + (setf (gethash mail-address gravatar--cache) + (cons (time-convert (current-time) 'integer) + image))) + (prog1 + (apply callback (if data image 'error) cbargs) + (kill-buffer)))) + nil t)))))) + +(defun gravatar--prune-cache () + (let ((expired nil) + (time (- (time-convert (current-time) 'integer) + ;; Twelve hours. + (* 12 60 60)))) + (maphash (lambda (key val) + (when (< (car val) time) + (push key expired))) + gravatar--cache) + (dolist (key expired) + (remhash key gravatar--cache)))) ;;;###autoload (defun gravatar-retrieve-synchronously (mail-address) @@ -229,10 +262,8 @@ retrieval failed." (gravatar-build-url mail-address (lambda (u) (setq url u))) (while (not url) (sleep-for 0.01)) - (with-current-buffer (if (url-cache-expired url gravatar-cache-ttl) - (url-retrieve-synchronously url t) - (url-fetch-from-cache url)) - (gravatar-retrieved () #'identity)))) + (with-current-buffer (url-retrieve-synchronously url t) + (gravatar-retrieved nil #'identity)))) (defun gravatar-retrieved (status cb &optional cbargs) "Handle Gravatar response data in current buffer. @@ -241,10 +272,6 @@ an image descriptor, or the symbol `error' on failure. This function is intended as a callback for `url-retrieve'." (let ((data (unless (plist-get status :error) (gravatar-get-data)))) - (and data ; Only cache on success. - url-current-object ; Only cache if not already cached. - gravatar-automatic-caching - (url-store-in-cache)) (prog1 (apply cb (if data (create-image data nil t) 'error) cbargs) (kill-buffer)))) commit 82893e9e8e0dae5cbd3ae26a7ee92896fcadfdae Author: Clément Pit-Claudel Date: Tue Aug 18 16:06:29 2020 +0200 Fix ert ability to peek inside structures when comparing unequal values * lisp/emacs-lisp/ert.el (ert--explain-equal-rec): Treat records as arrays (bug#40562). Also add support for cl-structs. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 764354b03b..241eece05b 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -515,7 +515,14 @@ Returns nil if they are." `(cdr ,cdr-x) (cl-assert (equal a b) t) nil)))))))) - ((pred arrayp) + ((pred cl-struct-p) + (cl-loop for slot in (cl-struct-slot-info (type-of a)) + for ai across a + for bi across b + for xf = (ert--explain-equal-rec ai bi) + do (when xf (cl-return `(struct-field ,(car slot) ,xf))) + finally (cl-assert (equal a b) t))) + ((or (pred arrayp) (pred recordp)) ;; For mixed unibyte/multibyte string comparisons, make both multibyte. (when (and (stringp a) (xor (multibyte-string-p a) (multibyte-string-p b))) commit 21c580566e348511a68968cd91215651f88a9336 Author: Stefan Kangas Date: Thu Aug 13 02:59:11 2020 +0200 Remove reference to Emacs Lisp List from FAQ * doc/misc/efaq.texi (Packages that do not come with Emacs): Remove reference to Emacs Lisp List. (Bug#41681) diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 62dcc0b753..3c1244101f 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -3464,7 +3464,6 @@ see @ref{Packages that do not come with Emacs}. @cindex Finding other packages @cindex Lisp packages that do not come with Emacs @cindex Packages, those that do not come with Emacs -@cindex Emacs Lisp List @cindex Emacs Lisp Archive The easiest way to add more features to your Emacs is to use the @@ -3500,10 +3499,6 @@ The @uref{https://emacswiki.org, Emacs Wiki} contains pointers to some additional extensions. @uref{https://wikemacs.org, WikEmacs} is an alternative wiki for Emacs. -@uref{http://www.damtp.cam.ac.uk/user/sje30/emacs/ell.html, The Emacs -Lisp List (ELL)}, has pointers to many Emacs Lisp files, but at time -of writing it is no longer being updated. - It is impossible for us to list here all the sites that offer Emacs Lisp packages. If you are interested in a specific feature, then after checking Emacs itself and GNU ELPA, a web search is often the commit 901dabf7fcaf41d5c70f6fd938618a747e0577d5 Author: Lars Ingebrigtsen Date: Tue Aug 18 15:35:56 2020 +0200 Add NEWS entry for the count-lines change diff --git a/etc/NEWS b/etc/NEWS index 4b22c7e5f9..c608c612a4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -815,6 +815,10 @@ window after starting). This variable defaults to nil. ** Miscellaneous +--- +*** 'count-windows' now takes an optional parameter ALL-FRAMES. +The semantics are as with 'walk-windows'. + --- *** Killing virtual ido buffers interactively will make them go away. Previously, killing a virtual ido buffer with 'ido-kill-buffer' didn't commit a9603c77f8b08ff17cccd2938dd22206e37871fe Author: Jen-Chieh Shen Date: Tue Aug 18 15:25:21 2020 +0200 Add optional ALL-FRAMES arfument to count-windows * lisp/window.el (count-windows): Allow counting the windows on all frames (bug#42872). diff --git a/lisp/window.el b/lisp/window.el index c02c9f37ee..bb34a6d7b4 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2642,12 +2642,17 @@ and no others." "Return t if WINDOW is the currently active minibuffer window." (and (window-live-p window) (eq window (active-minibuffer-window)))) -(defun count-windows (&optional minibuf) +(defun count-windows (&optional minibuf all-frames) "Return the number of live windows on the selected frame. + The optional argument MINIBUF specifies whether the minibuffer -window shall be counted. See `walk-windows' for the precise -meaning of this argument." - (length (window-list-1 nil minibuf))) +window is included in the count. + +If ALL-FRAMES is non-nil, count the windows in all frames instead +just the selected frame. + +See `walk-windows' for the precise meaning of this argument." + (length (window-list-1 nil minibuf all-frames))) ;;; Resizing windows. (defun window--size-to-pixel (window size &optional horizontal pixelwise round-maybe) commit ae098c3e726da4d926f824f7caf28456f2a7c003 Author: Stefan Kangas Date: Tue Aug 18 12:43:16 2020 +0200 Rename new option to flyspell-use-mouse-3-for-menu * lisp/textmodes/flyspell.el (flyspell-use-mouse-3-for-menu): Rename from 'flyspell-correct-on-mouse-3'. The previous name did not make it clear that it's about opening a menu. (Bug#11680) (flyspell--set-use-mouse-3-for-menu): Rename from 'flyspell--set-correct-on-mouse-3'. Bind menu to 'down-mouse-3' instead of 'mouse-3' to be more in line with user expectations. (flyspell-mode): Use the above new names. * doc/emacs/fixit.texi (Spelling): * etc/NEWS: Update documentation to use the new name. Suggested by Stefan Monnier . diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index 507e780f58..6633848716 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi @@ -447,7 +447,7 @@ use @code{flyspell-region} or @code{flyspell-buffer} for that. it with @kbd{mouse-2} (@code{flyspell-correct-word}) to display a menu of possible corrections and actions. If you want this menu on @kbd{mouse-3} instead, customize the variable -@code{flyspell-correct-on-mouse-3}. In addition, @kbd{C-.} or +@code{flyspell-use-mouse-3-for-menu}. In addition, @kbd{C-.} or @kbd{@key{ESC}-@key{TAB}} (@code{flyspell-auto-correct-word}) will propose various successive corrections for the word at point, and @w{@kbd{C-c $}} (@code{flyspell-correct-word-before-point}) will pop diff --git a/etc/NEWS b/etc/NEWS index 61b25d3a2e..4b22c7e5f9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -881,9 +881,9 @@ Otherwise, it will use 'xwidget-webkit-last-session'. *** Corrections and actions menu can be optionally bound to mouse-3. When Flyspell mode highlights a word as misspelled, you can click on it to display a menu of possible corrections and actions. You can now -easily bind this menu to mouse-3 (usually the right mouse button) +easily bind this menu to down-mouse-3 (usually the right mouse button) instead of mouse-2 (the default) by customizing the new option -'flyspell-correct-on-mouse-3'. +'flyspell-use-mouse-3-for-menu'. * New Modes and Packages in Emacs 28.1 diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 8608f85088..23f96d7e0e 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -446,19 +446,19 @@ like \"Some." "Minor mode keymap for Flyspell mode--for the whole buffer.") ;; correct on mouse 3 -(defun flyspell--set-correct-on-mouse-3 (var value) +(defun flyspell--set-use-mouse-3-for-menu (var value) (set-default var value) (if value (progn (define-key flyspell-mouse-map [mouse-2] nil) - (define-key flyspell-mouse-map [mouse-3] 'flyspell-correct-word)) + (define-key flyspell-mouse-map [down-mouse-3] 'flyspell-correct-word)) (define-key flyspell-mouse-map [mouse-2] 'flyspell-correct-word) - (define-key flyspell-mouse-map [mouse-3] nil))) + (define-key flyspell-mouse-map [down-mouse-3] nil))) -(defcustom flyspell-correct-on-mouse-3 nil +(defcustom flyspell-use-mouse-3-for-menu nil "Non-nil means to bind `mouse-3' to `flyspell-correct-word'. If this is set, also unbind `mouse-2'." :type 'boolean - :set 'flyspell--set-correct-on-mouse-3 + :set 'flyspell--set-use-mouse-3-for-menu :version "28.1") ;; dash character machinery @@ -531,8 +531,8 @@ in your init file. (if flyspell-mode (condition-case err (progn - (when flyspell-correct-on-mouse-3 - (flyspell--set-correct-on-mouse-3 'flyspell-correct-on-mouse-3 t)) + (when flyspell-use-mouse-3-for-menu + (flyspell--set-use-mouse-3-for-menu 'flyspell-use-mouse-3-for-menu t)) (flyspell-mode-on)) (error (message "Error enabling Flyspell mode:\n%s" (cdr err)) (flyspell-mode -1))) commit e0c19e8dced9cc0149dc64a7494988bbfe765846 Author: Lars Ingebrigtsen Date: Tue Aug 18 12:31:22 2020 +0200 Trim titles in eww so that the host from the URL is visible * lisp/net/eww.el (eww-update-header-line-format): Trim the line of the title so that the host bit of the URL is visible (bug#42898). diff --git a/lisp/net/eww.el b/lisp/net/eww.el index e7170b3e6d..04deb5bee0 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -672,9 +672,30 @@ Currently this means either text/html or application/xhtml+xml." (setq header-line-format (and eww-header-line-format (let ((title (plist-get eww-data :title)) - (peer (plist-get eww-data :peer))) + (peer (plist-get eww-data :peer)) + (url (plist-get eww-data :url))) (when (zerop (length title)) (setq title "[untitled]")) + ;; Limit the length of the title so that the host name + ;; of the URL is always visible. + (when url + (let* ((parsed (url-generic-parse-url url)) + (host-length (length (format "%s://%s" + (url-type parsed) + (url-host parsed)))) + (width (window-width))) + (cond + ;; The host bit is wider than the window, so nix + ;; the title. + ((> (+ host-length 5) width) + (setq title "")) + ;; Trim the title. + ((> (+ (length title) host-length 2) width) + (setq title (concat + (substring title 0 (- width + host-length + 5)) + "...")))))) ;; This connection has is https. (when peer (setq title @@ -686,7 +707,7 @@ Currently this means either text/html or application/xhtml+xml." "%" "%%" (format-spec eww-header-line-format - `((?u . ,(or (plist-get eww-data :url) "")) + `((?u . ,(or url "")) (?t . ,title)))))))) (defun eww-tag-title (dom) commit 75233e3ee088ba84d6935c559ee67a79ccf2477d Author: Lars Ingebrigtsen Date: Tue Aug 18 12:12:02 2020 +0200 Remove some compat code from esh-io.el * lisp/eshell/esh-io.el (eshell-set-output-handle): Remove check for null-device, which is always bound. diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index 0aa4ec4d16..b415486190 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el @@ -382,12 +382,7 @@ it defaults to `insert'." "Set handle INDEX, using MODE, to point to TARGET." (when target (if (and (stringp target) - (or (cond - ((boundp 'null-device) - (string= target null-device)) - ((boundp 'grep-null-device) - (string= target grep-null-device)) - (t nil)) + (or (string= target null-device) (string= target "/dev/null"))) (aset eshell-current-handles index nil) (let ((where (eshell-get-target target mode)) commit e0e3fe4e7de5395a042e8a14d95ba78b0045789f Author: Lars Ingebrigtsen Date: Tue Aug 18 12:10:29 2020 +0200 Remove some compat code from ediff * lisp/vc/ediff-init.el (ediff-convert-standard-filename): Make obsolete. * lisp/vc/ediff-util.el (ediff-setup): Adjust callers. (ediff-make-temp-file): Ditto. diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index f5177bca11..04926af16e 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -1573,9 +1573,8 @@ This default should work without changes." (defun ediff-convert-standard-filename (fname) - (if (fboundp 'convert-standard-filename) - (convert-standard-filename fname) - fname)) + (declare (obsolete convert-standard-filename "28.1")) + (convert-standard-filename fname)) (define-obsolete-function-alias 'ediff-with-syntax-table #'with-syntax-table "27.1") diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index e31f43dded..f56d31c713 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -240,18 +240,16 @@ to invocation.") startup-hooks setup-parameters &optional merge-buffer-file) (run-hooks 'ediff-before-setup-hook) - ;; ediff-convert-standard-filename puts file names in the form appropriate + ;; convert-standard-filename puts file names in the form appropriate ;; for the OS at hand. - (setq file-A (ediff-convert-standard-filename (expand-file-name file-A))) - (setq file-B (ediff-convert-standard-filename (expand-file-name file-B))) + (setq file-A (convert-standard-filename (expand-file-name file-A))) + (setq file-B (convert-standard-filename (expand-file-name file-B))) (if (stringp file-C) - (setq file-C - (ediff-convert-standard-filename (expand-file-name file-C)))) + (setq file-C (convert-standard-filename (expand-file-name file-C)))) (if (stringp merge-buffer-file) (progn (setq merge-buffer-file - (ediff-convert-standard-filename - (expand-file-name merge-buffer-file))) + (convert-standard-filename (expand-file-name merge-buffer-file))) ;; check the directory exists (or (file-exists-p (file-name-directory merge-buffer-file)) (error "Directory %s given as place to save the merge doesn't exist" @@ -3132,7 +3130,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." ;; Also, save buffer from START to END in the file. ;; START defaults to (point-min), END to (point-max) (defun ediff-make-temp-file (buff &optional prefix given-file start end) - (let* ((p (ediff-convert-standard-filename (or prefix "ediff"))) + (let* ((p (convert-standard-filename (or prefix "ediff"))) (short-p p) (coding-system-for-write ediff-coding-system-for-write) f short-f) commit 9384674aa31c27719aa55a9440ff59b721f0dd75 Author: Lars Ingebrigtsen Date: Tue Aug 18 12:08:11 2020 +0200 Remove some compat code from ede/make.el and semantic/dep.el * lisp/cedet/ede/make.el (ede--find-executable): Make obsolete. (ede-make-command): Adjust caller. * lisp/cedet/semantic/dep.el (semantic--dependency-find-file-on-path): Make obsolete. (semantic-dependency-find-file-on-path): Adjust callers. diff --git a/lisp/cedet/ede/make.el b/lisp/cedet/ede/make.el index ecce3e7105..140e7387a6 100644 --- a/lisp/cedet/ede/make.el +++ b/lisp/cedet/ede/make.el @@ -32,29 +32,15 @@ (declare-function inversion-check-version "inversion") -(if (fboundp 'locate-file) - (defsubst ede--find-executable (exec) - "Return an expanded file name for a program EXEC on the exec path." - (locate-file exec exec-path)) - - ;; Else, older version of Emacs. - - (defsubst ede--find-executable (exec) - "Return an expanded file name for a program EXEC on the exec path." - (let ((p exec-path) - (found nil)) - (while (and p (not found)) - (let ((f (expand-file-name exec (car p)))) - (if (file-exists-p f) - (setq found f))) - (setq p (cdr p))) - found)) - ) +(defsubst ede--find-executable (exec) + "Return an expanded file name for a program EXEC on the exec path." + (declare (obsolete locate-file "28.1")) + (locate-file exec exec-path)) (defvar ede-make-min-version "3.0" "Minimum version of GNU make required.") -(defcustom ede-make-command (cond ((ede--find-executable "gmake") +(defcustom ede-make-command (cond ((executable-find "gmake") "gmake") (t "make")) ;; What to do? "The MAKE command to use for EDE when compiling. diff --git a/lisp/cedet/semantic/dep.el b/lisp/cedet/semantic/dep.el index 47afa25dd7..60ab6033ae 100644 --- a/lisp/cedet/semantic/dep.el +++ b/lisp/cedet/semantic/dep.el @@ -183,16 +183,8 @@ macro `defcustom-mode-local-semantic-dependency-system-include-path'." ;; ;; methods for finding files on a provided path. (defmacro semantic--dependency-find-file-on-path (file path) - (if (fboundp 'locate-file) - `(locate-file ,file ,path) - `(let ((p ,path) - (found nil)) - (while (and p (not found)) - (let ((f (expand-file-name ,file (car p)))) - (if (file-exists-p f) - (setq found f))) - (setq p (cdr p))) - found))) + (declare (obsolete locate-file "28.1")) + `(locate-file ,file ,path)) (defvar ede-minor-mode) (defvar ede-object) @@ -216,11 +208,11 @@ provided mode, not from the current major mode." (when (file-exists-p file) (setq found file)) (when (and (not found) (not systemp)) - (setq found (semantic--dependency-find-file-on-path file locp))) + (setq found (locate-file file locp))) (when (and (not found) edesys) - (setq found (semantic--dependency-find-file-on-path file edesys))) + (setq found (locate-file file edesys))) (when (not found) - (setq found (semantic--dependency-find-file-on-path file sysp))) + (setq found (locate-file file sysp))) (if found (expand-file-name found)))) commit 033f98efc30d128748cc2f6672ddfbbb416fcbfb Author: Lars Ingebrigtsen Date: Tue Aug 18 12:02:58 2020 +0200 Remove some compat code from python.el * lisp/progmodes/python.el: Remove some compat function definitions. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3af55be4a1..f8c18021ff 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -283,24 +283,6 @@ :link '(emacs-commentary-link "python")) -;;; 24.x Compat - - -(eval-and-compile - (unless (fboundp 'prog-first-column) - (defun prog-first-column () - 0)) - (unless (fboundp 'file-local-name) - (defun file-local-name (file) - "Return the local name component of FILE. -It returns a file name which can be used directly as argument of -`process-file', `start-file-process', or `shell-command'." - (or (file-remote-p file 'localname) file)))) - -;; In Emacs 24.3 and earlier, `define-derived-mode' does not define -;; the hook variable, it only puts documentation on the symbol. -(defvar inferior-python-mode-hook) - ;;; Bindings commit 60f045b893e040e4723961c422a6af8b0406a1b2 Author: Lars Ingebrigtsen Date: Tue Aug 18 12:01:09 2020 +0200 Remove some compat code from binhex.el and uudecode.el * lisp/mail/binhex.el (binhex-temporary-file-directory): Make obsolete. (binhex-decode-region-external): Adjust usage. * lisp/mail/uudecode.el (uudecode-temporary-file-directory): Make obsolete. (uudecode-decode-region-external): Adjust usage. diff --git a/lisp/mail/binhex.el b/lisp/mail/binhex.el index 896f82d7bc..2c77f88f97 100644 --- a/lisp/mail/binhex.el +++ b/lisp/mail/binhex.el @@ -83,10 +83,8 @@ input and write the converted data to its standard output." "^[^:]...............................................................$") (defconst binhex-end-line ":$") ; unused -(defvar binhex-temporary-file-directory - (cond ((fboundp 'temp-directory) (temp-directory)) - ((boundp 'temporary-file-directory) temporary-file-directory) - ("/tmp/"))) +(make-obsolete-variable 'binhex-temporary-file-directory + 'temporary-file-directory "28.1") (defun binhex-insert-char (char &optional count ignored buffer) "Insert COUNT copies of CHARACTER into BUFFER." @@ -285,7 +283,7 @@ If HEADER-ONLY is non-nil only decode header and return filename." (file-name (expand-file-name (concat (binhex-decode-region-internal start end t) ".data") - binhex-temporary-file-directory))) + temporary-file-directory))) (save-excursion (goto-char start) (when (re-search-forward binhex-begin-line nil t) @@ -296,7 +294,7 @@ If HEADER-ONLY is non-nil only decode header and return filename." (generate-new-buffer " *binhex-work*"))) (buffer-disable-undo work-buffer) (insert-buffer-substring cbuf firstline end) - (cd binhex-temporary-file-directory) + (cd temporary-file-directory) (apply 'call-process-region (point-min) (point-max) diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el index 68e1227550..945bff35f7 100644 --- a/lisp/mail/uudecode.el +++ b/lisp/mail/uudecode.el @@ -61,10 +61,8 @@ input and write the converted data to its standard output." (setq str (concat str "[^a-z]"))) (concat str ".?$"))) -(defvar uudecode-temporary-file-directory - (cond ((fboundp 'temp-directory) (temp-directory)) - ((boundp 'temporary-file-directory) temporary-file-directory) - ("/tmp"))) +(make-obsolete-variable 'uudecode-temporary-file-directory + 'temporary-file-directory "28.1") ;;;###autoload (defun uudecode-decode-region-external (start end &optional file-name) @@ -86,9 +84,7 @@ used is specified by `uudecode-decoder-program'." (match-string 1))))) (setq tempfile (if file-name (expand-file-name file-name) - (let ((temporary-file-directory - uudecode-temporary-file-directory)) - (make-temp-file "uu")))) + (make-temp-file "uu"))) (let ((cdir default-directory) (default-process-coding-system nil)) (unwind-protect commit 848a38adcb39efd1f9e9e4e476a9003f6173e863 Author: Lars Ingebrigtsen Date: Tue Aug 18 11:57:39 2020 +0200 Remove some compat code from ispell.el * lisp/textmodes/ispell.el (ispell-check-version): Remove check for temporary-file-directory, which is always defined. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index ffcdb9bd16..f5af392f94 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -673,9 +673,7 @@ Otherwise returns the library directory name, if that is defined." ;; all versions, since versions earlier than 3.0.09 didn't identify ;; themselves on startup. (interactive "p") - (let ((default-directory (or (and (boundp 'temporary-file-directory) - temporary-file-directory) - default-directory)) + (let ((default-directory (or temporary-file-directory default-directory)) (get-config-var (lambda (var) (when (re-search-forward commit c64fcb8ab52f6469760cc64063eb8010815e1ae5 Author: Lars Ingebrigtsen Date: Tue Aug 18 11:56:39 2020 +0200 Remove some compat code from uudecode.el * lisp/mail/uudecode.el (uudecode-decode-region-external): Remove check for make-temp-file, which is always defined. diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el index 9423275b2e..68e1227550 100644 --- a/lisp/mail/uudecode.el +++ b/lisp/mail/uudecode.el @@ -86,13 +86,9 @@ used is specified by `uudecode-decoder-program'." (match-string 1))))) (setq tempfile (if file-name (expand-file-name file-name) - (if (fboundp 'make-temp-file) - (let ((temporary-file-directory - uudecode-temporary-file-directory)) - (make-temp-file "uu")) - (expand-file-name - (make-temp-name "uu") - uudecode-temporary-file-directory)))) + (let ((temporary-file-directory + uudecode-temporary-file-directory)) + (make-temp-file "uu")))) (let ((cdir default-directory) (default-process-coding-system nil)) (unwind-protect commit 85f0e3df73e1a2c0a355e224b97db017a1fb4adf Author: Lars Ingebrigtsen Date: Tue Aug 18 11:55:29 2020 +0200 Remove some compat code from ediff-util.el * lisp/vc/ediff-util.el (ediff-minibuffer-with-setup-hook): Make into an obsolete macro. (ediff-read-file-name): Adjust caller. diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 4a84c1ecd9..e31f43dded 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -3069,10 +3069,8 @@ Hit \\[ediff-recenter] to reset the windows afterward." ;; for compatibility -(defmacro ediff-minibuffer-with-setup-hook (fun &rest body) - `(if (fboundp 'minibuffer-with-setup-hook) - (minibuffer-with-setup-hook ,fun ,@body) - ,@body)) +(define-obsolete-function-alias 'ediff-minibuffer-with-setup-hook + #'minibuffer-with-setup-hook "28.1") ;; This is adapted from a similar function in `emerge.el'. ;; PROMPT should not have a trailing ': ', so that it can be modified @@ -3101,7 +3099,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." (and default-file (list default-file)) default-dir))) f) - (setq f (ediff-minibuffer-with-setup-hook + (setq f (minibuffer-with-setup-hook (lambda () (when defaults (setq minibuffer-default defaults))) (read-file-name commit 8d7a7c16a8627295267a5021b14ecd631a339d5f Author: Lars Ingebrigtsen Date: Tue Aug 18 11:53:21 2020 +0200 Remove XEmacs compat code from idlwave.el idlwave.el: (idlwave-comment-line-start-skip, idlwave-mode-map) (idlwave-mode, idlwave-get-buffer-visiting) (idlwave-find-file-noselect, idlwave-complete-in-buffer) (idlwave-attach-classes, idlwave-popup-select) (idlwave-split-menu-emacs, idlwave-display-completion-list) (idlwave-default-choose-completion) (idlwave-display-completion-list-emacs) (idlwave-display-completion-list-1) (idlwave-make-modified-completion-map-emacs) (idlwave-class-file-or-buffer, idlwave-rinfo-mouse-map) (idlwave-display-calling-sequence) (idlwave-insert-source-location) (idlwave-list-load-path-shadows, idlwave-edit-in-idlde): Remove XEmacs compat code. diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index ab820d585d..153f2578bf 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -581,12 +581,7 @@ like this: MyMethod The value of this variable may be nil to inhibit display, or an integer to -indicate the maximum number of classes to display. - -On XEmacs, a full list of classes will also be placed into a `help-echo' -property on the completion items, so that the list of classes for the current -item is displayed in the echo area. If the value of this variable is a -negative integer, the `help-echo' property will be suppressed." +indicate the maximum number of classes to display." :group 'idlwave-completion :type '(choice (const :tag "Don't show" nil) (integer :tag "Number of classes shown" 1))) @@ -1054,7 +1049,6 @@ goto Goto Statements common-blocks Common Blocks keyword-parameters Keyword Parameters in routine definitions and calls system-variables System Variables -fixme FIXME: Warning in comments (on XEmacs only v. 21.0 and up) class-arrows Object Arrows with class property" :group 'idlwave-misc :type '(set @@ -1069,7 +1063,6 @@ class-arrows Object Arrows with class property" (const :tag "Common Blocks" common-blocks) (const :tag "Keyword Parameters" keyword-parameters) (const :tag "System Variables" system-variables) - (const :tag "FIXME: Warning" fixme) (const :tag "Object Arrows with class property " class-arrows))) (defcustom idlwave-mode-hook nil @@ -1138,23 +1131,16 @@ As a user, you should not set this to t.") ;; Common blocks (common-blocks '("\\<\\(common\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*,?" - (1 font-lock-keyword-face) ; "common" - (2 font-lock-constant-face nil t) ; block name + (1 font-lock-keyword-face) ; "common" + (2 font-lock-constant-face nil t) ; block name ("[ \t]*\\(\\sw+\\)[ ,]*" ;; Start with point after block name and comma - (goto-char (match-end 0)) ; needed for XEmacs, could be nil - nil - (1 font-lock-variable-name-face) ; variable names - ))) + nil nil (1 font-lock-variable-name-face)))) ; variable names ;; Batch files (batch-files '("^[ \t]*\\(@[^ \t\n]+\\)" (1 font-lock-string-face))) - ;; FIXME warning. - (fixme - '("\\) - ;; (re-search-backward " <" beg t))))) - + (complete (memq spart all-completions))) (setq list (sort list (lambda (a b) (string< (downcase a) (downcase b))))) (if prepare-display-function @@ -6764,7 +6730,6 @@ accumulate information on matching completions." (let* ((do-prop (and (>= show-classes 0) (>= emacs-major-version 21))) (do-buf (not (= show-classes 0))) - ;; (do-dots (featurep 'xemacs)) (do-dots t) (inherit (if (and (not (eq type 'class-tag)) super-classes) (cons class-selector super-classes))) @@ -6830,10 +6795,6 @@ accumulate information on matching completions." ;;---------------------------------------------------------------------- ;;---------------------------------------------------------------------- ;;---------------------------------------------------------------------- -(when (featurep 'xemacs) - (defvar rtn) - (defun idlwave-pset (item) - (set 'rtn item))) (defun idlwave-popup-select (ev list title &optional sort) "Select an item in LIST with a popup menu. @@ -6844,17 +6805,6 @@ sort the list before displaying." (cond ((null list)) ((= 1 (length list)) (setq rtn (car list))) - ((featurep 'xemacs) - (if sort (setq list (sort list (lambda (a b) - (string< (upcase a) (upcase b)))))) - (setq menu - (append (list title) - (mapcar (lambda (x) (vector x (list 'idlwave-pset - x))) - list))) - (setq menu (idlwave-split-menu-xemacs menu maxpopup)) - (let ((resp (get-popup-menu-response menu))) - (funcall (event-function resp) (event-object resp)))) (t (if sort (setq list (sort list (lambda (a b) (string< (upcase a) (upcase b)))))) @@ -6862,36 +6812,14 @@ sort the list before displaying." (list (append (list "") (mapcar (lambda(x) (cons x x)) list))))) - (setq menu (idlwave-split-menu-emacs menu maxpopup)) + (setq menu (idlwave-split-menu menu maxpopup)) (setq rtn (x-popup-menu ev menu)))) rtn)) -(defun idlwave-split-menu-xemacs (menu N) - "Split the MENU into submenus of maximum length N." - (if (<= (length menu) (1+ N)) - ;; No splitting needed - menu - (let* ((title (car menu)) - (entries (cdr menu)) - (menu (list title)) - (cnt 0) - (nextmenu nil)) - (while entries - (while (and entries (< cnt N)) - (setq cnt (1+ cnt) - nextmenu (cons (car entries) nextmenu) - entries (cdr entries))) - (setq nextmenu (nreverse nextmenu)) - (setq nextmenu (cons (format "%s...%s" - (aref (car nextmenu) 0) - (aref (nth (1- cnt) nextmenu) 0)) - nextmenu)) - (setq menu (cons nextmenu menu) - nextmenu nil - cnt 0)) - (nreverse menu)))) +(define-obsolete-function-alias 'idlwave-split-menu-emacs + #'idlwave-split-menu "28.1") -(defun idlwave-split-menu-emacs (menu N) +(defun idlwave-split-menu (menu N) "Split the MENU into submenus of maximum length N." (if (<= (length (nth 1 menu)) (1+ N)) ;; No splitting needed @@ -6946,10 +6874,7 @@ sort the list before displaying." (move-marker idlwave-completion-mark beg) (setq idlwave-before-completion-wconf (current-window-configuration))) - (if (featurep 'xemacs) - (idlwave-display-completion-list-xemacs - list) - (idlwave-display-completion-list-emacs list)) + (idlwave-display-completion-list-1 list) ;; Store a special value in `this-command'. When `idlwave-complete' ;; finds this in `last-command', it will scroll the *Completions* buffer. @@ -7093,42 +7018,17 @@ If these don't exist, a letter in the string is automatically selected." (and (local-variable-p var (current-buffer)) (symbol-value var)))) -;; In XEmacs, we can use :activate-callback directly to advice the -;; choose functions. We use the private keymap only for the online -;; help feature. - (defvar idlwave-completion-map nil "Keymap for `completion-list-mode' with `idlwave-complete'.") -(defun idlwave-display-completion-list-xemacs (list &rest cl-args) - (with-output-to-temp-buffer "*Completions*" - (apply 'display-completion-list list - ':activate-callback 'idlwave-default-choose-completion - cl-args)) - (with-current-buffer "*Completions*" - (use-local-map - (or idlwave-completion-map - (setq idlwave-completion-map - (idlwave-make-modified-completion-map-xemacs - (current-local-map))))))) - (defun idlwave-default-choose-completion (&rest args) "Execute `default-choose-completion' and then restore the win-conf." (apply 'idlwave-choose 'default-choose-completion args)) -(defun idlwave-make-modified-completion-map-xemacs (old-map) - "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP." - (let ((new-map (copy-keymap old-map))) - (define-key new-map [button3up] 'idlwave-mouse-completion-help) - (define-key new-map [button3] (lambda () - (interactive) - (setq this-command last-command))) - new-map)) - -;; In Emacs we also replace keybindings in the completion -;; map in order to install our wrappers. +(define-obsolete-function-alias 'idlwave-display-completion-list-emacs + #'idlwave-display-completion-list-1 "28.1") -(defun idlwave-display-completion-list-emacs (list) +(defun idlwave-display-completion-list-1 (list) "Display completion list and install the choose wrappers." (with-output-to-temp-buffer "*Completions*" (display-completion-list list)) @@ -7136,10 +7036,12 @@ If these don't exist, a letter in the string is automatically selected." (use-local-map (or idlwave-completion-map (setq idlwave-completion-map - (idlwave-make-modified-completion-map-emacs - (current-local-map))))))) + (idlwave-make-modified-completion-map (current-local-map))))))) -(defun idlwave-make-modified-completion-map-emacs (old-map) +(define-obsolete-function-alias 'idlwave-make-modified-completion-map-emacs + #'idlwave-make-modified-completion-map "28.1") + +(defun idlwave-make-modified-completion-map (old-map) "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP." (let ((new-map (copy-keymap old-map))) (substitute-key-definition @@ -7351,7 +7253,7 @@ class/struct definition." (file (idlwave-routine-source-file (nth 3 (idlwave-rinfo-assoc pro 'pro nil (idlwave-routines)))))) - (cons file (if file (idlwave-get-buffer-visiting file))))) + (cons file (if file (find-buffer-visiting file))))) (defun idlwave-scan-class-info (class) @@ -8222,15 +8124,9 @@ If we do not know about MODULE, just return KEYWORD literally." (defvar idlwave-rinfo-mouse-map (let ((map (make-sparse-keymap))) - (define-key map - (if (featurep 'xemacs) [button2] [mouse-2]) - 'idlwave-mouse-active-rinfo) - (define-key map - (if (featurep 'xemacs) [(shift button2)] [(shift mouse-2)]) - 'idlwave-mouse-active-rinfo-shift) - (define-key map - (if (featurep 'xemacs) [button3] [mouse-3]) - 'idlwave-mouse-active-rinfo-right) + (define-key map [mouse-2] 'idlwave-mouse-active-rinfo) + (define-key map [(shift mouse-2)] 'idlwave-mouse-active-rinfo-shift) + (define-key map [mouse-3] 'idlwave-mouse-active-rinfo-right) (define-key map " " 'idlwave-active-rinfo-space) (define-key map "q" 'idlwave-quit-help) map)) @@ -8282,7 +8178,6 @@ If we do not know about MODULE, just return KEYWORD literally." "Button2: Display info about same method in superclass") (col 0) (data (list name type class (current-buffer) nil initial-class)) - (km-prop (if (featurep 'xemacs) 'keymap 'local-map)) (face 'idlwave-help-link) beg props win cnt total) ;; Fix keywords, but don't add chained super-classes, since these @@ -8307,7 +8202,7 @@ If we do not know about MODULE, just return KEYWORD literally." idlwave-current-obj_new-class) (when superclasses (setq props (list 'mouse-face 'highlight - km-prop idlwave-rinfo-mouse-map + 'local-map idlwave-rinfo-mouse-map 'help-echo help-echo-class 'data (cons 'class data))) (let ((classes (cons initial-class superclasses)) c) @@ -8323,7 +8218,7 @@ If we do not know about MODULE, just return KEYWORD literally." (add-text-properties beg (point) props)))) (insert "\n"))) (setq props (list 'mouse-face 'highlight - km-prop idlwave-rinfo-mouse-map + 'local-map idlwave-rinfo-mouse-map 'help-echo help-echo-use 'data (cons 'usage data))) (if html-file (setq props (append (list 'face face 'link html-file) @@ -8351,7 +8246,7 @@ If we do not know about MODULE, just return KEYWORD literally." (setq beg (point) ;; Relevant keywords already have link property attached props (list 'mouse-face 'highlight - km-prop idlwave-rinfo-mouse-map + 'local-map idlwave-rinfo-mouse-map 'data (cons 'keyword data) 'help-echo help-echo-kwd 'keyword (car x))) @@ -8365,7 +8260,7 @@ If we do not know about MODULE, just return KEYWORD literally." ;; Here entry is (key file (list of type-conses)) (while (setq entry (pop all)) (setq props (list 'mouse-face 'highlight - km-prop idlwave-rinfo-mouse-map + 'local-map idlwave-rinfo-mouse-map 'help-echo help-echo-src 'source (list (car (car (nth 2 entry))) ;type (nth 1 entry) @@ -8470,8 +8365,7 @@ to it." (add-text-properties beg (point) (list 'face 'bold))) (when (and file (not (equal file ""))) (setq beg (point)) - (insert (apply 'abbreviate-file-name - (if (featurep 'xemacs) (list file t) (list file)))) + (insert (apply 'abbreviate-file-name (list file))) (if file-props (add-text-properties beg (point) file-props))))) @@ -8631,10 +8525,9 @@ can be used to detect possible name clashes during this process." idlwave-user-catalog-routines idlwave-buffer-routines nil)) - (km-prop (if (featurep 'xemacs) 'keymap 'local-map)) (keymap (make-sparse-keymap)) (props (list 'mouse-face 'highlight - km-prop keymap + 'local-map keymap 'help-echo "Mouse2: Find source")) (nroutines (length (or special-routines routines))) (step (/ nroutines 100)) @@ -8657,7 +8550,7 @@ can be used to detect possible name clashes during this process." (nth 2 b) (car b))))))) (message "Sorting routines...done") - (define-key keymap (if (featurep 'xemacs) [(button2)] [(mouse-2)]) + (define-key keymap [(mouse-2)] (lambda (ev) (interactive "e") (mouse-set-point ev) @@ -9019,23 +8912,6 @@ Assumes that point is at the beginning of the unit as found by 'imenu) (error nil))))) -;; Here we hack func-menu.el in order to support this new mode. -;; The latest versions of func-menu.el already have this stuff in, so -;; we hack only if it is not already there. -(when (featurep 'xemacs) - (eval-after-load "func-menu" - '(progn - (or (assq 'idlwave-mode fume-function-name-regexp-alist) - (not (boundp 'fume-function-name-regexp-idl)) ; avoid problems - (setq fume-function-name-regexp-alist - (cons '(idlwave-mode . fume-function-name-regexp-idl) - fume-function-name-regexp-alist))) - (or (assq 'idlwave-mode fume-find-function-name-method-alist) - (not (fboundp 'fume-find-next-idl-function-name)) ; avoid problems - (setq fume-find-function-name-method-alist - (cons '(idlwave-mode . fume-find-next-idl-function-name) - fume-find-function-name-method-alist)))))) - (defun idlwave-edit-in-idlde () "Edit the current file in IDL Development environment." (interactive) commit b14c1b547345d46a7e87e261b910bcf0ebe2d522 Author: Lars Ingebrigtsen Date: Tue Aug 18 11:32:06 2020 +0200 Remove some compat code from window.el * lisp/window.el (window-fixed-size-p): Remove check for window-size-fixed, which is always defined. diff --git a/lisp/window.el b/lisp/window.el index f20940fa0e..c02c9f37ee 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5729,10 +5729,10 @@ window." WINDOW defaults to the selected window. DIRECTION can be nil (i.e. any), `height' or `width'." (with-current-buffer (window-buffer window) - (when (and (boundp 'window-size-fixed) window-size-fixed) - (not (and direction - (member (cons direction window-size-fixed) - '((height . width) (width . height)))))))) + (and window-size-fixed + (not (and direction + (member (cons direction window-size-fixed) + '((height . width) (width . height)))))))) ;;; A different solution to balance-windows. (defvar window-area-factor 1 commit fdd388d311df2455806698f73d6a697866a4dce2 Author: Lars Ingebrigtsen Date: Tue Aug 18 11:27:17 2020 +0200 Remove some compat code from idlwave.el * lisp/progmodes/idlwave.el (idlwave-one-key-select): Remove check from fit-window-to-buffer, which always exists. diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index f7e53ec02d..ab820d585d 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -7007,8 +7007,7 @@ The key which is associated with each option is generated automatically. First, the strings are checked for preselected keys, like in \"[P]rint\". If these don't exist, a letter in the string is automatically selected." (let* ((alist (symbol-value sym)) - (temp-buffer-show-hook (if (fboundp 'fit-window-to-buffer) - '(fit-window-to-buffer))) + (temp-buffer-show-hook '(fit-window-to-buffer)) keys-alist char) ;; First check the cache (if (and (eq (symbol-value sym) (get sym :one-key-alist-last))) commit e6e59a349b5436a51a3f00caa33dfdfaaf424455 Author: Lars Ingebrigtsen Date: Tue Aug 18 11:25:05 2020 +0200 Remove come compat code from rmailedit.el * lisp/mail/rmailedit.el (rmail-edit-mode): Remove check for mode-line-modified, which is always defined. diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el index ba6ebad082..3026283a08 100644 --- a/lisp/mail/rmailedit.el +++ b/lisp/mail/rmailedit.el @@ -63,9 +63,7 @@ This function runs the hooks `text-mode-hook' and `rmail-edit-mode-hook'. (use-local-map rmail-edit-map) (setq major-mode 'rmail-edit-mode) (setq mode-name "RMAIL Edit") - (if (boundp 'mode-line-modified) - (setq mode-line-modified (default-value 'mode-line-modified)) - (setq mode-line-format (default-value 'mode-line-format))) + (setq mode-line-modified (default-value 'mode-line-modified)) ;; Don't turn off auto-saving based on the size of the buffer ;; because that code does not understand buffer-swapping. (make-local-variable 'auto-save-include-big-deletions) commit 128b04fca08f791a4eba64e8c1fe3429df7e822f Author: Lars Ingebrigtsen Date: Tue Aug 18 11:23:47 2020 +0200 Remove some compat code from erc-track.el * lisp/erc/erc-track.el (erc-track-remove-from-mode-line) (erc-track-add-to-mode-line): Remove check for mode-line-modes, which is always bound. diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 820b6d9359..3398c8b9d0 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -328,9 +328,8 @@ important." (defun erc-track-remove-from-mode-line () "Remove `erc-track-modified-channels' from the mode-line." - (when (boundp 'mode-line-modes) - (setq mode-line-modes - (remove '(t erc-modified-channels-object) mode-line-modes))) + (setq mode-line-modes + (remove '(t erc-modified-channels-object) mode-line-modes)) (when (consp global-mode-string) (setq global-mode-string (delq 'erc-modified-channels-object global-mode-string)))) @@ -340,12 +339,10 @@ important." See `erc-track-position-in-mode-line' for possible values." ;; CVS Emacs has a new format string, and global-mode-string ;; is very far to the right. - (cond ((and (eq position 'before-modes) - (boundp 'mode-line-modes)) + (cond ((eq position 'before-modes) (add-to-list 'mode-line-modes '(t erc-modified-channels-object))) - ((and (eq position 'after-modes) - (boundp 'mode-line-modes)) + ((eq position 'after-modes) (add-to-list 'mode-line-modes '(t erc-modified-channels-object) t)) ((eq position t) commit 362ca83a3b9d74c51ac325a6490551272aa25f9a (refs/remotes/origin/emacs-27) Author: Paul Eggert Date: Mon Aug 17 16:21:36 2020 -0700 Let Emacs start even if curdir is inaccessible * lisp/startup.el (normal-top-level): Also delete PWD if file-attributes fails for either $PWD or default-directory, instead of failing out of the top level. This fixes a regression from Emacs 26 (Bug#42903). diff --git a/lisp/startup.el b/lisp/startup.el index bff10003f8..364689ccdb 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -649,11 +649,12 @@ It is the default value of the variable `top-level'." ;; Use FOO/., so that if FOO is a symlink, file-attributes ;; describes the directory linked to, not FOO itself. (or (and default-directory - (equal (file-attributes - (concat (file-name-as-directory pwd) ".")) - (file-attributes - (concat (file-name-as-directory default-directory) - ".")))) + (ignore-errors + (equal (file-attributes + (concat (file-name-as-directory pwd) ".")) + (file-attributes + (concat (file-name-as-directory default-directory) + "."))))) (setq process-environment (delete (concat "PWD=" pwd) process-environment))))) commit dd989c0ea0c514a130270d5a1aefbdafe7fafc66 Author: Paul Eggert Date: Mon Aug 17 08:28:36 2020 -0700 * etc/NEWS: Mention GnuPG 2.0 through 2.1.5 issue (Bug#42845). diff --git a/etc/NEWS b/etc/NEWS index 1dba5b5651..f1f4151ab2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1947,6 +1947,11 @@ The value of the new 'sender' slot (if a string) is used to set gpg's 'mml-secure-openpgp-sign-with-sender'. See gpg(1) manual page about "--sender" for more information. +*** 'epg-find-configuration' no longer finds GnuPG 2.0 through 2.1.5. +Previously, it found these versions by mistake. The intent was to +find GnuPG 2.1.6 or later, or find GnuPG 1.4.3 or later within the +GnuPG 1 series. + ** Rmail *** New user option 'rmail-output-reset-deleted-flag'. commit 4542b750ccd03aaf8f2af0fe01bc88bf582aa125 Author: Robert Pluim Date: Sun Aug 16 21:40:19 2020 -0700 Fix bug with ~/Emacs file not being read at init * src/xrdb.c (get_user_app): Put "/" between homedir and %L or %N (Bug#42827). diff --git a/src/xrdb.c b/src/xrdb.c index ad7155c106..d3ac117552 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -289,9 +289,9 @@ get_user_app (const char *class) /* Check in the home directory. This is a bit of a hack; let's hope one's home directory doesn't contain ':' or '%'. */ char const *home = get_homedir (); - db = search_magic_path (home, class, "%L/%N"); + db = search_magic_path (home, class, "/%L/%N"); if (! db) - db = search_magic_path (home, class, "%N"); + db = search_magic_path (home, class, "/%N"); } return db; commit 9b403d624ee6e608d1ff3d577e358b6befe743e1 Author: Eli Zaretskii Date: Sat Aug 15 18:19:01 2020 +0300 ; Fix last change diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 5cd244f3e7..ca52369bd0 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -792,7 +792,7 @@ use instead of the default @code{equal}. @example @group (seq-contains-p '(symbol1 symbol2) 'symbol1) -@result{} symbol1 +@result{} t @end group @group (seq-contains-p '(symbol1 symbol2) 'symbol3) commit 6bff65a626238671140bcd1b65b45f55b59cacdc Author: Eli Zaretskii Date: Sat Aug 15 18:16:39 2020 +0300 ; * doc/lispref/sequences.texi (Sequence Functions): Typo Fix. (Bug#42871) diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 91c3049f87..5cd244f3e7 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -791,11 +791,11 @@ use instead of the default @code{equal}. @example @group -(seq-contains '(symbol1 symbol2) 'symbol1) +(seq-contains-p '(symbol1 symbol2) 'symbol1) @result{} symbol1 @end group @group -(seq-contains '(symbol1 symbol2) 'symbol3) +(seq-contains-p '(symbol1 symbol2) 'symbol3) @result{} nil @end group @end example commit 3c4edfd85ee8f49e40715a400a1fc65950e07482 Author: Tino Calancha Date: Sat Aug 15 16:18:03 2020 +0200 Prevent from frozen frame after `C-z' in Lucid builds Some WMs (e.g. mutter in Gnome Shell) don't unmap iconized windows, thus we won't get a MapNotify when deconifying them. Check if we are deconifying a window elsewhere (Bug#42655). - src/xterm.c (handle_one_xevent): Check for window deconify when receiving a FocusIn signal. diff --git a/src/xterm.c b/src/xterm.c index 44396955ed..a567ab163a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8762,6 +8762,20 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto OTHER; case FocusIn: + /* Some WMs (e.g. Mutter in Gnome Shell), don't unmap + minimized/iconified windows; thus, for those WMs we won't get + a MapNotify when unminimizing/deconifying. Check here if we + are deconizing a window (Bug42655). */ + f = any; + if (f && FRAME_ICONIFIED_P (f)) + { + SET_FRAME_VISIBLE (f, 1); + SET_FRAME_ICONIFIED (f, false); + f->output_data.x->has_been_visible = true; + inev.ie.kind = DEICONIFY_EVENT; + XSETFRAME (inev.ie.frame_or_window, f); + } + x_detect_focus_change (dpyinfo, any, event, &inev.ie); goto OTHER; commit 98e824199263d4f47200bb3cf60226c5125d700b Author: Eli Zaretskii Date: Sat Aug 15 12:32:32 2020 +0300 Document the 'flex' completion style * doc/emacs/mini.texi (Completion Styles): Document the 'flex' completion style. (Bug#42763) diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 55e41e38cb..54f046a7e0 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -518,6 +518,13 @@ between @samp{foo} and @samp{bar}, that matches @samp{@var{a}foo@var{b}bar@var{c}}, where @var{a}, @var{b}, and @var{c} can be any string including the empty string. +@item flex +@cindex @code{flex}, completion style +This aggressive completion style, also known as @code{flx} or +@code{fuzzy} or @code{scatter} completion, attempts to complete using +in-order substrings. For example, it can consider @samp{foo} to match +@samp{frodo} or @samp{fbarbazoo}. + @item initials @cindex @code{initials}, completion style This very aggressive completion style attempts to complete acronyms commit 19fa8b7ca3f3077883a6aa10a09a887e93a755ea Author: Lars Ingebrigtsen Date: Fri Aug 14 18:56:36 2020 +0200 Note that Emacs needs systemd support if systemd is used to stop/start * etc/NEWS: Note that Emacs needs to be built with systemd support systemd is used to stop/start Emacs (bug#42242). Change suggested by Bhavin Gandhi diff --git a/etc/NEWS b/etc/NEWS index ffa1ba4a89..1dba5b5651 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -231,10 +231,11 @@ it won't work right without some adjustment: ** Emacs now notifies systemd when startup finishes or shutdown begins. Units that are ordered after 'emacs.service' will only be started -after Emacs has finished initialization and is ready for use. -(If your Emacs is installed in a non-standard location and you copied the -emacs.service file to e.g. "~/.config/systemd/user/", you will need to copy -the new version of the file again.) +after Emacs has finished initialization and is ready for use, and +Emacs needs to be built with systemd support. (If your Emacs is +installed in a non-standard location and you copied the emacs.service +file to e.g. "~/.config/systemd/user/", you will need to copy the new +version of the file again.) * Changes in Emacs 27.1 commit 8ff5e346febf234b4d9152f636cda478c404948a Author: Mattias Engdegård Date: Sun May 3 14:22:50 2020 +0200 Regexps cannot infloop; fix manual * doc/lispref/searching.texi (Regexp Special): Edit erroneous statements about infinite looping in regexps. (cherry picked from commit 63268253d21c57d991cba3f3b083d74f154a26fe) diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 83c154938c..c8a12bdd66 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -338,16 +338,14 @@ first tries to match all three @samp{a}s; but the rest of the pattern is The next alternative is for @samp{a*} to match only two @samp{a}s. With this choice, the rest of the regexp matches successfully. -@strong{Warning:} Nested repetition operators can run for an -indefinitely long time, if they lead to ambiguous matching. For +@strong{Warning:} Nested repetition operators can run for a very +long time, if they lead to ambiguous matching. For example, trying to match the regular expression @samp{\(x+y*\)*a} against the string @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could take hours before it ultimately fails. Emacs must try each way of grouping the @samp{x}s before concluding that none of them can work. -Even worse, @samp{\(x*\)*} can match the null string in infinitely -many ways, so it causes an infinite loop. To avoid these problems, -check nested repetitions carefully, to make sure that they do not -cause combinatorial explosions in backtracking. +In general, avoid expressions that can match the same string in +multiple ways. @item @samp{+} @cindex @samp{+} in regexp commit cf0ee6f49b4b0b03db2c3f9fe93e1a486472e831 Author: Paul Eggert Date: Thu Aug 13 16:46:12 2020 -0700 ; spelling fixes diff --git a/ChangeLog.3 b/ChangeLog.3 index 6418f9c8a2..1a53011899 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -2958,7 +2958,7 @@ * doc/lispref/searching.texi (Rx Constructs): Document. * lisp/emacs-lisp/rx.el (rx--normalise-or-arg) (rx--all-string-or-args): New. - (rx--translate-or): Normalise arguments first, and check for strings + (rx--translate-or): Normalize arguments first, and check for strings in subforms. (rx--expand-eval): Extracted from rx--translate-eval. (rx--translate-eval): Call rx--expand-eval. diff --git a/lisp/desktop.el b/lisp/desktop.el index b15ebc9b03..94de6c885e 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -1037,7 +1037,7 @@ file. To upgrade a version 206 file to version 208, call this command explicitly with a prefix argument: \\[universal-argument] \\[desktop-save]. -If you are upgrading from Emacs 24 or older, we recommed to do +If you are upgrading from Emacs 24 or older, we recommend to do this once you decide you no longer need compatibility with versions of Emacs before 25.1. diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index aa4b2addd4..6564563e7e 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -255,9 +255,9 @@ Left-fold the list L, starting with X, by the binary function F." x) (defun rx--normalise-or-arg (form) - "Normalise the `or' argument FORM. + "Normalize the `or' argument FORM. Characters become strings, user-definitions and `eval' forms are expanded, -and `or' forms are normalised recursively." +and `or' forms are normalized recursively." (cond ((characterp form) (char-to-string form)) ((and (consp form) (memq (car form) '(or |))) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index bccef6890f..34490d1356 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -382,7 +382,7 @@ comment at the start of cc-engine.el for more info." c-macro-cache-syntactic nil c-macro-cache-no-comment nil)) (save-match-data - (let ((safe-pos (point))) ; a point ouside any literal. + (let ((safe-pos (point))) ; a point outside any literal. ;; Move over stuff followed by a multiline block comment lacking ;; escaped newlines each time around this loop. (while diff --git a/lisp/simple.el b/lisp/simple.el index e4958de113..3ea00d44a0 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -247,7 +247,7 @@ from which next-error navigated, and a target buffer TO-BUFFER." extra-test-exclusive) "Try the current buffer when outside navigation. But return nil if we navigated to the current buffer by the means -of `next-error' command. Othewise, return it if it's next-error +of `next-error' command. Otherwise, return it if it's next-error capable." ;; Check that next-error-buffer has no buffer-local value ;; (i.e. we never navigated to the current buffer from another), diff --git a/src/composite.c b/src/composite.c index a5288cb8a2..bbb36dcbfa 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1263,7 +1263,7 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, is backward in the buffer, which can only happen if the display routines were called to perform the bidi reordering. But it doesn't harm to test for that, and - avoid someon raising their brows and thinking it's a + avoid someone raising their brows and thinking it's a subtle bug... */ if (bidi_level < 0) direction = Qnil; diff --git a/src/xdisp.c b/src/xdisp.c index 37fe380078..ad0ab9987d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -180,8 +180,8 @@ along with GNU Emacs. If not, see . */ present (non-empty) only if the corresponding display margin is shown in the window. If the glyph array for a marginal area is not present its beginning and end coincide, i.e. such arrays are - actually empty (they contain no glyphs). Frame glyph matrics, used - on text-mode terminals (see below) never have marginal areas, they + actually empty (they contain no glyphs). Frame glyph matrices, used + on text-mode terminals (see below) never have marginal areas; they treat the entire frame-wide row of glyphs as a single large "text area". diff --git a/src/xfns.c b/src/xfns.c index f9a00a6daf..6f7c590ece 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -8035,7 +8035,7 @@ If this equals the symbol 'resize-mode', Emacs uses GTK's resize mode to always trigger an immediate resize of the child frame. This method is deprecated by GTK and may not work in future versions of that toolkit. It also may freeze Emacs when used with other desktop environments. It -avoids, however, the unpleasent flicker induced by the hiding approach. +avoids, however, the unpleasant flicker induced by the hiding approach. This variable is considered a temporary workaround and will be hopefully eliminated in future versions of Emacs. */); commit 16f4f266324077f5a50090bd1c8147c7cbe37e0e Author: Paul Eggert Date: Thu Aug 13 12:48:57 2020 -0700 Fix startup working dir bug on NeXTSTEP * src/emacs.c (main) [NS_IMPL_COCOA]: Update emacs_wd after a NS GUI chdirs successfully (Bug#42836). diff --git a/src/emacs.c b/src/emacs.c index 1dcf195891..11dcdb33fe 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1638,23 +1638,27 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem { #ifdef NS_IMPL_COCOA /* Started from GUI? */ - /* FIXME: Do the right thing if get_homedir returns "", or if - chdir fails. */ - if (! inhibit_window_system && ! isatty (STDIN_FILENO) && ! ch_to_dir) - chdir (get_homedir ()); + bool go_home = (!ch_to_dir && !inhibit_window_system + && !isatty (STDIN_FILENO)); if (skip_args < argc) { if (!strncmp (argv[skip_args], "-psn", 4)) { skip_args += 1; - if (! ch_to_dir) chdir (get_homedir ()); + go_home |= !ch_to_dir; } else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 4)) { skip_args += 2; - if (! ch_to_dir) chdir (get_homedir ()); + go_home |= !ch_to_dir; } } + if (go_home) + { + char const *home = get_homedir (); + if (*home && chdir (home) == 0) + emacs_wd = emacs_get_current_dir_name (); + } #endif /* COCOA */ } #endif /* HAVE_NS */