commit f1faf85f003f6e526f3d7e27dbdd8bf7f151582b (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Fri Dec 21 09:41:04 2018 +0100 * test/lisp/filenotify-tests.el, test/lisp/shadowfile-tests.el: Don't require tramp-sh, bug#33781 is fixed. diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 4c8e7fbe93..51b323f9b4 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -180,7 +180,6 @@ Return nil when any other file notification watch is still active." ;; This should happen on hydra only. (when (getenv "EMACS_HYDRA_CI") - (require 'tramp-sh) (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) ;; We do not want to try and fail `file-notify-add-watch'. diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index 1527d2b2ab..3bab22f8d6 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -69,7 +69,6 @@ ;; This should happen on hydra only. (when (getenv "EMACS_HYDRA_CI") - (require 'tramp-sh) (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) (defconst shadow-test-info-file commit 47f4be68fb3d513154bd66315d9602352e775e2a Author: Juri Linkov Date: Fri Dec 21 01:57:34 2018 +0200 * lisp/emacs-lisp/debug.el (debug): Add display-buffer-below-selected to display actions of pop-to-buffer, and `(window-min-height . 10)' to display alist. (Bug#32825) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 34a2a1336d..b6b1f20675 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -239,11 +239,13 @@ first will be printed into the backtrace buffer." (pop-to-buffer debugger-buffer `((display-buffer-reuse-window - display-buffer-in-previous-window) - . (,(when (and (window-live-p debugger-previous-window) + display-buffer-in-previous-window + display-buffer-below-selected) + . ((window-min-height . 10) + ,@(when (and (window-live-p debugger-previous-window) (frame-visible-p (window-frame debugger-previous-window))) - `(previous-window . ,debugger-previous-window))))) + `((previous-window . ,debugger-previous-window)))))) (setq debugger-window (selected-window)) (if (eq debugger-previous-window debugger-window) (when debugger-jumping-flag commit 157ada833f36b9919be44ad4ecbae6d94c808dec Author: Juri Linkov Date: Fri Dec 21 01:41:25 2018 +0200 * lisp/windmove.el (windmove-delete-in-direction): Change prefix arg C-u to kill the buffer. Add prefix arg M-0 to delete the selected window. (Bug#32790) diff --git a/etc/NEWS b/etc/NEWS index 7a2123a212..31067c3ff3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -346,8 +346,9 @@ The new command 'windmove-delete-default-keybindings' binds default keys with provided prefix (by default, C-x) and modifiers (by default, Shift) to the commands that delete the window in the specified direction. For example, 'C-x S-down' deletes the window below. -With a prefix arg 'C-u', deletes the selected window and selects -the window that was in the specified direction. +With a prefix arg 'C-u', also kills the buffer in that window. +With `M-0', deletes the selected window and selects the window +that was in the specified direction. ** Octave mode The mode is automatically enabled in files that start with the diff --git a/lisp/windmove.el b/lisp/windmove.el index c16c12444a..75b9e0cf59 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -684,7 +684,8 @@ Default value of MODIFIERS is `shift-meta'." (defun windmove-delete-in-direction (dir &optional arg) "Delete the window at direction DIR. -If prefix ARG is `C-u', delete the selected window and +If prefix ARG is `\\[universal-argument]', also kill the buffer in that window. +With `M-0' prefix, delete the selected window and select the window at direction DIR. When `windmove-wrap-around' is non-nil, takes the window from the opposite side of the frame." @@ -693,7 +694,9 @@ from the opposite side of the frame." (cond ((null other-window) (user-error "No window %s from selected window" dir)) (t - (if (not (consp arg)) + (when (equal arg '(4)) + (kill-buffer (window-buffer other-window))) + (if (not (equal arg 0)) (delete-window other-window) (delete-window (selected-window)) (select-window other-window)))))) commit 3f36651c6470bab951f12f486eb4928235f1ba50 Author: Juri Linkov Date: Fri Dec 21 01:28:31 2018 +0200 * lisp/window.el (switch-to-buffer-obey-display-actions): New defcustom. (switch-to-buffer): Use it. (Bug#32790) (switch-to-buffer-preserve-window-point): Mention it in docstring. * lisp/windmove.el (windmove-display-in-direction): Mention it in docstring. * doc/lispref/windows.texi (Switching Buffers): Document switch-to-buffer-obey-display-actions. diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index eb05766211..f2f6cd3a42 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -2263,6 +2263,12 @@ selected window or never appeared in it before, or if buffer. @end defopt +@defopt switch-to-buffer-obey-display-actions +If this variable is non-@code{nil}, @code{switch-to-buffer} respects +display actions specified by @code{display-buffer-overriding-action}, +@code{display-buffer-alist} and other display related variables. +@end defopt + The next two commands are similar to @code{switch-to-buffer}, except for the described features. diff --git a/etc/NEWS b/etc/NEWS index 7ff4aee64b..7a2123a212 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -243,6 +243,12 @@ when the last screen line in a window is not fully visible. ** New variable 'emacs-repository-branch'. It reports the git branch from which Emacs was built. ++++ +** New user option 'switch-to-buffer-obey-display-actions'. +When non-nil, `switch-to-buffer' uses `pop-to-buffer-same-window' that +respects display actions specified by `display-buffer-alist' and +`display-buffer-overriding-action'. + * Editing Changes in Emacs 27.1 diff --git a/lisp/windmove.el b/lisp/windmove.el index 6d61806a83..c16c12444a 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -588,7 +588,9 @@ By default, select the window with a displayed buffer. If prefix ARG is `C-u', reselect a previously selected window. If `windmove-display-no-select' is non-nil, this command doesn't select the window with a displayed buffer, and the meaning of -the prefix argument is reversed." +the prefix argument is reversed. +When `switch-to-buffer-obey-display-actions' is non-nil, +`switch-to-buffer' commands are also supported." (let* ((no-select (not (eq (consp arg) windmove-display-no-select))) ; xor (old-window (or (minibuffer-selected-window) (selected-window))) (new-window) diff --git a/lisp/window.el b/lisp/window.el index a52b8951b1..50aec86a42 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7768,7 +7768,9 @@ position in the selected window. This variable is ignored if the buffer is already displayed in the selected window or never appeared in it before, or if -`switch-to-buffer' calls `pop-to-buffer' to display the buffer." +`switch-to-buffer' calls `pop-to-buffer' to display the buffer, +or non-nil `switch-to-buffer-obey-display-actions' displays it +in another window." :type '(choice (const :tag "Never" nil) (const :tag "If already displayed elsewhere" already-displayed) @@ -7803,6 +7805,16 @@ FORCE-SAME-WINDOW is non-nil." :group 'windows :version "25.1") +(defcustom switch-to-buffer-obey-display-actions nil + "If non-nil, `switch-to-buffer' runs `pop-to-buffer-same-window' instead. +This means that when switching the buffer it respects display actions +specified by `display-buffer-overriding-action', `display-buffer-alist' +and other display related variables. So `switch-to-buffer' will display +the buffer in the window specified by the rules from these variables." + :type 'boolean + :group 'windows + :version "27.1") + (defun switch-to-buffer (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window. @@ -7835,59 +7847,83 @@ displaying it the most recently selected one. If optional argument FORCE-SAME-WINDOW is non-nil, the buffer must be displayed in the selected window when called non-interactively; if that is impossible, signal an error rather -than calling `pop-to-buffer'. +than calling `pop-to-buffer'. It has no effect when the option +`switch-to-buffer-obey-display-actions' is non-nil. The option `switch-to-buffer-preserve-window-point' can be used to make the buffer appear at its last position in the selected window. +If the option `switch-to-buffer-obey-display-actions' is non-nil, +run the function `pop-to-buffer-same-window' instead. +This may display the buffer in another window as specified by +`display-buffer-overriding-action', `display-buffer-alist' and +other display related variables. If this results in displaying +the buffer in the selected window, window start and point are adjusted +as prescribed by the option `switch-to-buffer-preserve-window-point'. +Otherwise, these are left alone. + Return the buffer switched to." (interactive (let ((force-same-window - (cond - ((window-minibuffer-p) nil) - ((not (eq (window-dedicated-p) t)) 'force-same-window) - ((pcase switch-to-buffer-in-dedicated-window - ('nil (user-error - "Cannot switch buffers in a dedicated window")) - ('prompt - (if (y-or-n-p - (format "Window is dedicated to %s; undedicate it" - (window-buffer))) - (progn - (set-window-dedicated-p nil nil) - 'force-same-window) - (user-error - "Cannot switch buffers in a dedicated window"))) - ('pop nil) - (_ (set-window-dedicated-p nil nil) 'force-same-window)))))) + (unless switch-to-buffer-obey-display-actions + (cond + ((window-minibuffer-p) nil) + ((not (eq (window-dedicated-p) t)) 'force-same-window) + ((pcase switch-to-buffer-in-dedicated-window + ('nil (user-error + "Cannot switch buffers in a dedicated window")) + ('prompt + (if (y-or-n-p + (format "Window is dedicated to %s; undedicate it" + (window-buffer))) + (progn + (set-window-dedicated-p nil nil) + 'force-same-window) + (user-error + "Cannot switch buffers in a dedicated window"))) + ('pop nil) + (_ (set-window-dedicated-p nil nil) 'force-same-window))))))) (list (read-buffer-to-switch "Switch to buffer: ") nil force-same-window))) - (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))) + (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name)) + (set-window-start-and-point (not switch-to-buffer-obey-display-actions))) (cond ;; Don't call set-window-buffer if it's not needed since it ;; might signal an error (e.g. if the window is dedicated). - ((eq buffer (window-buffer))) - ((window-minibuffer-p) + ((and (eq buffer (window-buffer)) + ;; pop-to-buffer-same-window might decide to display + ;; the same buffer in another window + (not switch-to-buffer-obey-display-actions))) + ((and (window-minibuffer-p) + (not switch-to-buffer-obey-display-actions)) (if force-same-window (user-error "Cannot switch buffers in minibuffer window") (pop-to-buffer buffer norecord))) - ((eq (window-dedicated-p) t) + ((and (eq (window-dedicated-p) t) + (not switch-to-buffer-obey-display-actions)) (if force-same-window (user-error "Cannot switch buffers in a dedicated window") (pop-to-buffer buffer norecord))) (t - (let* ((entry (assq buffer (window-prev-buffers))) - (displayed (and (eq switch-to-buffer-preserve-window-point - 'already-displayed) - (get-buffer-window buffer 0)))) - (set-window-buffer nil buffer) - (when (and entry - (or (eq switch-to-buffer-preserve-window-point t) - displayed)) - ;; Try to restore start and point of buffer in the selected - ;; window (Bug#4041). - (set-window-start (selected-window) (nth 1 entry) t) - (set-window-point nil (nth 2 entry)))))) + (when switch-to-buffer-obey-display-actions + (let ((selected-window (selected-window))) + (pop-to-buffer-same-window buffer norecord) + (when (eq (selected-window) selected-window) + (setq set-window-start-and-point t)))) + + (when set-window-start-and-point + (let* ((entry (assq buffer (window-prev-buffers))) + (displayed (and (eq switch-to-buffer-preserve-window-point + 'already-displayed) + (get-buffer-window buffer 0)))) + (set-window-buffer nil buffer) + (when (and entry + (or (eq switch-to-buffer-preserve-window-point t) + displayed)) + ;; Try to restore start and point of buffer in the selected + ;; window (Bug#4041). + (set-window-start (selected-window) (nth 1 entry) t) + (set-window-point nil (nth 2 entry))))))) (unless norecord (select-window (selected-window))) commit a4e6dbdcbc18a12deb8b63e43e0a7cf63b8516fc Author: Juri Linkov Date: Fri Dec 21 01:00:44 2018 +0200 * lisp/hi-lock.el (hi-salmon, hi-aquamarine): New faces. (Bug#33398) (hi-lock-face-defaults): Add them. (hi-green-b, hi-red-b): Tone down foreground colors. diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index f503c2764b..6eadd59b99 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -177,6 +177,26 @@ Instead, each hi-lock command will cycle through the faces in "Face for hi-lock mode." :group 'hi-lock-faces) +(defface hi-salmon + '((((min-colors 88) (background dark)) + (:background "light salmon" :foreground "black")) + (((background dark)) (:background "red" :foreground "black")) + (((min-colors 88)) (:background "light salmon")) + (t (:background "red"))) + "Face for hi-lock mode." + :group 'hi-lock-faces + :version "27.1") + +(defface hi-aquamarine + '((((min-colors 88) (background dark)) + (:background "aquamarine" :foreground "black")) + (((background dark)) (:background "blue" :foreground "black")) + (((min-colors 88)) (:background "aquamarine")) + (t (:background "blue"))) + "Face for hi-lock mode." + :group 'hi-lock-faces + :version "27.1") + (defface hi-black-b '((t (:weight bold))) "Face for hi-lock mode." @@ -189,13 +209,13 @@ Instead, each hi-lock command will cycle through the faces in :group 'hi-lock-faces) (defface hi-green-b - '((((min-colors 88)) (:weight bold :foreground "green1")) + '((((min-colors 88)) (:weight bold :foreground "green3")) (t (:weight bold :foreground "green"))) "Face for hi-lock mode." :group 'hi-lock-faces) (defface hi-red-b - '((((min-colors 88)) (:weight bold :foreground "red1")) + '((((min-colors 88)) (:weight bold :foreground "firebrick2")) (t (:weight bold :foreground "red"))) "Face for hi-lock mode." :group 'hi-lock-faces) @@ -216,8 +236,8 @@ Instead, each hi-lock command will cycle through the faces in (define-obsolete-variable-alias 'hi-lock-face-history 'hi-lock-face-defaults "23.1") (defvar hi-lock-face-defaults - '("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-black-b" - "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb") + '("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-salmon" "hi-aquamarine" + "hi-black-b" "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb") "Default faces for hi-lock interactive functions.") (define-obsolete-variable-alias 'hi-lock-regexp-history commit 62112a77f191c0b00aa420ce2d0fee8aa03592bf Merge: 1e5f848058 081fb694c3 Author: Glenn Morris Date: Thu Dec 20 07:51:17 2018 -0800 Merge from origin/emacs-26 081fb69 (origin/emacs-26) Check result from c-backward-token-2 to avo... f4ea746 cl-make-random-state was not copying its arg commit 1e5f84805884e37563db9f16076d458ceaa03917 Merge: 81cac3e9dd fda43a7bef Author: Glenn Morris Date: Thu Dec 20 07:51:17 2018 -0800 ; Merge from origin/emacs-26 The following commits were skipped: fda43a7 Skip a vc-bzr test if run as root 4370b8e ; Copyright year fix No need to merge to master 305aca0 Backport: Handle unread-command-events consistently (bug#23980) commit 81cac3e9ddb99addcbf5dbc8b8a58b2042db6fa6 Merge: 46e22ae926 4c6c327d0c Author: Glenn Morris Date: Thu Dec 20 07:51:16 2018 -0800 Merge from origin/emacs-26 4c6c327 Restrict downcasing in elisp xref tests (bug#25534) ab8ed41 Avoid test failures if directory name looks like a regexp commit 46e22ae92660a83f6523f6e157b087f0c8b4ace3 Merge: 9cce03738c 80e98568aa Author: Glenn Morris Date: Thu Dec 20 07:51:16 2018 -0800 ; Merge from origin/emacs-26 The following commit was skipped: 80e9856 Fix Bug#33524 commit 9cce03738c670c76b203d109d8dff7d8893eb589 Merge: eece51e2d3 582527976b Author: Glenn Morris Date: Thu Dec 20 07:51:15 2018 -0800 Merge from origin/emacs-26 5825279 * doc/lispintro/emacs-lisp-intro.texi (Finding More): Fix xref. commit eece51e2d322b6334e611ab70594c82e92942edf Merge: f68f2eb472 e8bb0420a0 Author: Glenn Morris Date: Thu Dec 20 07:51:15 2018 -0800 ; Merge from origin/emacs-26 The following commit was skipped: e8bb042 More porting to GCC 8 of --enable-gcc-warnings commit f68f2eb47280cf92fdb41548e40b37e7a4a81e53 Author: Stefan Monnier Date: Thu Dec 20 08:40:43 2018 -0500 * lisp/emacs-lisp/map.el: Add support for plists (map--plist-p, map--plist-delete): New functions. (map-elt, map-delete, map-length, map-into, map-put!, map-insert) (map-apply, map-do): Handle the plist case. * test/lisp/emacs-lisp/map-tests.el (with-maps-do): Add sample plist. (test-map-put!): The behavior of map-put! is not the same for plists as for alists. diff --git a/etc/NEWS b/etc/NEWS index bc76bec2d7..7ff4aee64b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -305,6 +305,7 @@ the node "(emacs) Directory Variables" of the user manual. * Changes in Specialized Modes and Packages in Emacs 27.1 ** map.el +*** Now also understands plists *** Now defined via generic functions that can be extended via cl-defmethod. *** Deprecate the 'map-put' macro in favor of a new 'map-put!' function. *** 'map-contains-key' now returns a boolean rather than the key. diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index d5051fcd98..53a1b3b171 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -97,6 +97,9 @@ Returns the result of evaluating the form associated with MAP-VAR's type." (define-error 'map-not-inplace "Cannot modify map in-place: %S") +(defsubst map--plist-p (list) + (and (consp list) (not (listp (car list))))) + (cl-defgeneric map-elt (map key &optional default testfn) "Lookup KEY in MAP and return its associated value. If KEY is not found, return DEFAULT which defaults to nil. @@ -122,7 +125,12 @@ In the base definition, MAP can be an alist, hash-table, or array." ;; `testfn' is deprecated. (advertised-calling-convention (map key &optional default) "27.1")) (map--dispatch map - :list (alist-get key map default nil testfn) + :list (if (map--plist-p map) + (let ((res (plist-get map key))) + (if (and default (null res) (not (plist-member map key))) + default + res)) + (alist-get key map default nil testfn)) :hash-table (gethash key map default) :array (if (and (>= key 0) (< key (seq-length map))) (seq-elt map key) @@ -138,14 +146,31 @@ MAP can be a list, hash-table or array." (declare (obsolete "use map-put! or (setf (map-elt ...) ...) instead" "27.1")) `(setf (map-elt ,map ,key nil ,testfn) ,value)) -(cl-defgeneric map-delete (map key) - "Delete KEY from MAP and return MAP. -No error is signaled if KEY is not a key of MAP. If MAP is an -array, store nil at the index KEY. +(defun map--plist-delete (map key) + (let ((tail map) last) + (while (consp tail) + (cond + ((not (equal key (car tail))) + (setq last tail) + (setq tail (cddr last))) + (last + (setq tail (cddr tail)) + (setf (cddr last) tail)) + (t + (cl-assert (eq tail map)) + (setq map (cddr map)) + (setq tail map)))) + map)) -MAP can be a list, hash-table or array." +(cl-defgeneric map-delete (map key) + "Delete KEY in-place from MAP and return MAP. +No error is signaled if KEY is not a key of MAP. +If MAP is an array, store nil at the index KEY." (map--dispatch map - :list (setf (alist-get key map nil t) nil) + ;; FIXME: Signal map-not-inplace i.s.o returning a different list? + :list (if (map--plist-p map) + (setq map (map--plist-delete map key)) + (setf (alist-get key map nil t) nil)) :hash-table (remhash key map) :array (and (>= key 0) (<= key (seq-length map)) @@ -164,29 +189,37 @@ Map can be a nested map composed of alists, hash-tables and arrays." default)) (cl-defgeneric map-keys (map) - "Return the list of keys in MAP." + "Return the list of keys in MAP. +The default implementation delegates to `map-apply'." (map-apply (lambda (key _) key) map)) (cl-defgeneric map-values (map) - "Return the list of values in MAP." + "Return the list of values in MAP. +The default implementation delegates to `map-apply'." (map-apply (lambda (_ value) value) map)) (cl-defgeneric map-pairs (map) - "Return the elements of MAP as key/value association lists." + "Return the elements of MAP as key/value association lists. +The default implementation delegates to `map-apply'." (map-apply #'cons map)) (cl-defgeneric map-length (map) ;; FIXME: Should we rename this to `map-size'? - "Return the number of elements in the map." + "Return the number of elements in the map. +The default implementation counts `map-keys'." (cond ((hash-table-p map) (hash-table-count map)) - ((or (listp map) (arrayp map)) (length map)) + ((listp map) + ;; FIXME: What about repeated/shadowed keys? + (if (map--plist-p map) (/ (length map) 2) (length map))) + ((arrayp map) (length map)) (t (length (map-keys map))))) (cl-defgeneric map-copy (map) "Return a copy of MAP." + ;; FIXME: Clarify how deep is the copy! (map--dispatch map - :list (seq-copy map) + :list (seq-copy map) ;FIXME: Probably not deep enough for alists! :hash-table (copy-hash-table map) :array (seq-copy map))) @@ -337,9 +370,14 @@ MAP can be a list, hash-table or array." "Convert the map MAP into a map of type TYPE.") ;; FIXME: I wish there was a way to avoid this η-redex! (cl-defmethod map-into (map (_type (eql list))) (map-pairs map)) +(cl-defmethod map-into (map (_type (eql alist))) (map-pairs map)) +(cl-defmethod map-into (map (_type (eql plist))) + (let ((plist '())) + (map-do (lambda (k v) (setq plist `(,k ,v ,@plist))) map) + plist)) (cl-defgeneric map-put! (map key value &optional testfn) - "Associate KEY with VALUE in MAP and return VALUE. + "Associate KEY with VALUE in MAP. If KEY is already present in MAP, replace the associated value with VALUE. This operates by modifying MAP in place. @@ -348,10 +386,13 @@ If you want to insert an element without modifying MAP, use `map-insert'." ;; `testfn' only exists for backward compatibility with `map-put'! (declare (advertised-calling-convention (map key value) "27.1")) (map--dispatch map - :list (let ((oldmap map)) - (setf (alist-get key map key nil (or testfn #'equal)) value) - (unless (eq oldmap map) - (signal 'map-not-inplace (list map)))) + :list + (if (map--plist-p map) + (plist-put map key value) + (let ((oldmap map)) + (setf (alist-get key map key nil (or testfn #'equal)) value) + (unless (eq oldmap map) + (signal 'map-not-inplace (list map))))) :hash-table (puthash key value map) ;; FIXME: If `key' is too large, should we signal `map-not-inplace' ;; and let `map-insert' grow the array? @@ -364,7 +405,9 @@ If you want to insert an element without modifying MAP, use `map-insert'." This does not modify MAP. If you want to insert an element in place, use `map-put!'." (if (listp map) - (cons (cons key value) map) + (if (map--plist-p map) + `(,key ,value ,@map) + (cons (cons key value) map)) ;; FIXME: Should we signal an error or use copy+put! ? (signal 'map-inplace (list map)))) @@ -374,11 +417,13 @@ If you want to insert an element in place, use `map-put!'." (define-obsolete-function-alias 'map--put #'map-put! "27.1") (cl-defmethod map-apply (function (map list)) - (seq-map (lambda (pair) - (funcall function - (car pair) - (cdr pair))) - map)) + (if (map--plist-p map) + (cl-call-next-method) + (seq-map (lambda (pair) + (funcall function + (car pair) + (cdr pair))) + map))) (cl-defmethod map-apply (function (map hash-table)) (let (result) @@ -395,13 +440,16 @@ If you want to insert an element in place, use `map-put!'." (setq index (1+ index)))) map))) -(cl-defmethod map-do (function (alist list)) +(cl-defmethod map-do (function (map list)) "Private function used to iterate over ALIST using FUNCTION." - (seq-do (lambda (pair) - (funcall function - (car pair) - (cdr pair))) - alist)) + (if (map--plist-p map) + (while map + (funcall function (pop map) (pop map))) + (seq-do (lambda (pair) + (funcall function + (car pair) + (cdr pair))) + map))) (cl-defmethod map-do (function (array array)) "Private function used to iterate over ARRAY using FUNCTION." diff --git a/test/lisp/emacs-lisp/map-tests.el b/test/lisp/emacs-lisp/map-tests.el index 4dd67d48d4..9b8f17b7ca 100644 --- a/test/lisp/emacs-lisp/map-tests.el +++ b/test/lisp/emacs-lisp/map-tests.el @@ -38,17 +38,19 @@ Evaluate BODY for each created map. \(fn (var map) body)" (declare (indent 1) (debug (symbolp body))) (let ((alist (make-symbol "alist")) + (plist (make-symbol "plist")) (vec (make-symbol "vec")) (ht (make-symbol "ht"))) `(let ((,alist (list (cons 0 3) (cons 1 4) (cons 2 5))) + (,plist (list 0 3 1 4 2 5)) (,vec (vector 3 4 5)) (,ht (make-hash-table))) (puthash 0 3 ,ht) (puthash 1 4 ,ht) (puthash 2 5 ,ht) - (dolist (,var (list ,alist ,vec ,ht)) + (dolist (,var (list ,alist ,plist ,vec ,ht)) ,@body)))) (ert-deftest test-map-elt () @@ -86,7 +88,8 @@ Evaluate BODY for each created map. (with-maps-do map (map-put! map 2 'hello) (should (eq (map-elt map 2) 'hello)) - (if (not (hash-table-p map)) + (if (not (or (hash-table-p map) + (and (listp map) (not (listp (car map)))))) ;plist! (should-error (map-put! map 5 'value) ;; For vectors, it could arguably signal ;; map-not-inplace as well, but it currently doesn't. commit 6a3c5f415b15531751dbbe4686950dbc15927866 Author: Michael Albinus Date: Thu Dec 20 14:20:36 2018 +0100 * test/lisp/net/tramp-tests.el (tramp-test32-environment-variables): Remove expected failure. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index a485b8d8a7..4a74e8b78d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3989,7 +3989,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ert-deftest tramp-test32-environment-variables () "Check that remote processes set / unset environment variables properly." :tags '(:expensive-test) - :expected-result (if (getenv "EMACS_HYDRA_CI") :failed :passed) ; bug#33781 (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-sh-p)) commit 081fb694c3f88e77d4a0e09fba8ce457037b9132 (refs/remotes/origin/emacs-26) Author: Alan Mackenzie Date: Thu Dec 20 12:21:16 2018 +0000 Check result from c-backward-token-2 to avoid infinite loop This fixes bug #33784. * lisp/progmodes/cc-fonts.el (c-get-fontification-context): While moving back over enclosing parentheses, check that c-backward-token-2 actually moves. diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 39d167f019..2e47bdab56 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1284,8 +1284,8 @@ casts and declarations are fontified. Used on level 2 and higher." (save-excursion (goto-char match-pos) (while - (progn (c-backward-token-2) - (eq (char-after) ?\())) + (and (zerop (c-backward-token-2)) + (eq (char-after) ?\())) (looking-at c-arithmetic-op-regexp))) (cons nil nil)) ;; In a C++ member initialization list. commit 88d3713beb8310eb1ab45dde8aa767f14489affe Author: Michael Albinus Date: Thu Dec 20 11:07:15 2018 +0100 Fix Bug#33781 * lisp/net/tramp-sh.el (tramp-set-remote-path): Use a temporary file for setting $PATH, if it exceeds PATH_MAX on the remote system. (tramp-send-command-and-read): Ignore errors if NOERROR. (Bug#33781) * test/lisp/net/tramp-tests.el (tramp-test34-remote-path): New test. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 14ae2cb51b..2959422a5d 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3885,22 +3885,21 @@ This function expects to be in the right *tramp* buffer." I.e., for each directory in `tramp-remote-path', it is tested whether it exists and if so, it is added to the environment variable PATH." - (let ((path (mapconcat 'identity (tramp-get-remote-path vec) ":")) + (let ((command + (format "PATH=%s; export PATH" + (mapconcat 'identity (tramp-get-remote-path vec) ":"))) (path-max (with-tramp-connection-property vec "path-max" (tramp-send-command-and-read vec "getconf PATH_MAX /"))) - index) + tmpfile) (tramp-message vec 5 "Setting $PATH environment variable") - (unless (< (length path) path-max) - (setq index path-max) - (while (not (string-equal (substring path (1- index) index) ":")) - (setq index (1- index))) - ;; FIXME: Is this sufficient? Or shall we raise an error? - (tramp-message - vec 2 "$PATH environment variable is too long. Ignoring \"%s\"" - (substring path index)) - (setq path (substring path 0 (1- index)))) - (tramp-send-command vec (format "PATH=%s; export PATH" path)))) + (if (< (length command) path-max) + (tramp-send-command vec command) + ;; Use a temporary file. + (setq tmpfile (tramp-make-tramp-temp-file vec)) + (write-region command nil tmpfile) + (tramp-send-command vec (format ". %s" tmpfile)) + (delete-file tmpfile)))) ;; ------------------------------------------------------------ ;; -- Communication with external shell -- @@ -5066,7 +5065,7 @@ If MARKER is a regexp, read the output after that string. In case there is no valid Lisp expression and NOERROR is nil, it raises an error." (when (if noerror - (tramp-send-command-and-check vec command) + (ignore-errors (tramp-send-command-and-check vec command)) (tramp-barf-unless-okay vec command "`%s' returns with error" command)) (with-current-buffer (tramp-get-connection-buffer vec) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index f3ad8edf83..a485b8d8a7 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4187,6 +4187,72 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-file tmp-name))))) +;; This test is inspired by Bug#33781. +;; `exec-path' was introduced in Emacs 27.1. `executable-find' has +;; changed the number of parameters, so we use `apply' for older +;; Emacsen. +(ert-deftest tramp-test34-remote-path () + "Check loooong `tramp-remote-path'." + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + ;; Since Emacs 27.1. + (skip-unless (fboundp 'exec-path)) + + (let* ((tmp-name (tramp--test-make-temp-name)) + (default-directory tramp-test-temporary-file-directory) + (orig-exec-path (exec-path)) + (tramp-remote-path tramp-remote-path) + (orig-tramp-remote-path tramp-remote-path)) + (unwind-protect + (progn + ;; Non existing directories are removed. + (setq tramp-remote-path + (cons (file-remote-p tmp-name 'localname) tramp-remote-path)) + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + 'keep-debug 'keep-password) + (should (equal (with-no-warnings (exec-path)) orig-exec-path)) + (setq tramp-remote-path orig-tramp-remote-path) + + ;; Double entries are removed. + (setq tramp-remote-path (append '("/" "/") tramp-remote-path)) + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + 'keep-debug 'keep-password) + (should + (equal (with-no-warnings (exec-path)) (cons "/" orig-exec-path))) + (setq tramp-remote-path orig-tramp-remote-path) + + ;; We make a super long `tramp-remote-path'. + (make-directory tmp-name) + (should (file-directory-p tmp-name)) + (while (< (length (mapconcat 'identity orig-exec-path ":")) 5000) + (let ((dir (make-temp-file (file-name-as-directory tmp-name) 'dir))) + (should (file-directory-p dir)) + (setq tramp-remote-path + (cons (file-remote-p dir 'localname) tramp-remote-path) + orig-exec-path + (cons (file-remote-p dir 'localname) orig-exec-path)))) + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + 'keep-debug 'keep-password) + (should (equal (with-no-warnings (exec-path)) orig-exec-path)) + (should + (string-equal + ;; Ignore trailing newline. + (substring (shell-command-to-string "echo $PATH") nil -1) + ;; The last element of `exec-path' is `exec-directory'. + (mapconcat 'identity (butlast orig-exec-path) ":"))) + ;; The shell "sh" shall always exist. + (should (apply 'executable-find '("sh" remote)))) + + ;; Cleanup. + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + 'keep-debug 'keep-password) + (setq tramp-remote-path orig-tramp-remote-path) + (ignore-errors (delete-directory tmp-name 'recursive))))) + (ert-deftest tramp-test35-vc-registered () "Check `vc-registered'." :tags '(:expensive-test) commit f4ea7464516b22409f429e98595b97cbf8220f4c Author: Paul Eggert Date: Wed Dec 19 13:42:21 2018 -0800 cl-make-random-state was not copying its arg Problem reported by Xu Chunyang (Bug#33731). * lisp/emacs-lisp/cl-extra.el (cl-make-random-state): Use copy-sequence, not copy-tree, so that the record is copied. * test/lisp/emacs-lisp/cl-extra-tests.el: (cl-extra-test-cl-make-random-state): New test. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 36b65f97b0..c38b4957fc 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -484,7 +484,7 @@ Optional second arg STATE is a random-state object." If STATE is t, return a new state object seeded from the time of day." (unless state (setq state cl--random-state)) (if (cl-random-state-p state) - (copy-tree state t) + (copy-sequence state) (cl--make-random-state (if (integerp state) state (cl--random-time))))) ;; Implementation limits. diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el index baad8eb8e6..fe59703530 100644 --- a/test/lisp/emacs-lisp/cl-extra-tests.el +++ b/test/lisp/emacs-lisp/cl-extra-tests.el @@ -94,4 +94,9 @@ (should (equal (list lst3 (cdr lst3) (cddr lst3)) (cl-maplist fn3 lst lst2 lst3))))) +(ert-deftest cl-extra-test-cl-make-random-state () + (let ((s (cl-make-random-state))) + ;; Test for Bug#33731. + (should-not (eq s (cl-make-random-state s))))) + ;;; cl-extra-tests.el ends here commit fda43a7bef499024fa5fcb32432e76c5839ee154 Author: Glenn Morris Date: Wed Dec 19 15:06:18 2018 -0500 Skip a vc-bzr test if run as root * test/lisp/vc/vc-bzr-tests.el (vc-bzr-test-faulty-bzr-autoloads): Skip this test when run as root. This works around a race condition in root-specific code in vc-mode-line when deleting a file. ; Do not merge to master, instead fix vc-mode-line there. diff --git a/test/lisp/vc/vc-bzr-tests.el b/test/lisp/vc/vc-bzr-tests.el index 6b96f3b928..db64f61c43 100644 --- a/test/lisp/vc/vc-bzr-tests.el +++ b/test/lisp/vc/vc-bzr-tests.el @@ -112,6 +112,9 @@ (ert-deftest vc-bzr-test-faulty-bzr-autoloads () "Test we can generate autoloads in a bzr directory when bzr is faulty." (skip-unless (executable-find vc-bzr-program)) + ;; Avoid vc-mode-line bug; + ;; http://lists.gnu.org/r/emacs-devel/2018-12/msg00368.html + (skip-unless (not (eq 0 (user-real-uid)))) (let* ((homedir (make-temp-file "vc-bzr-test" t)) (bzrdir (expand-file-name "bzr" homedir)) (file (progn commit 4370b8ebd9ecf934ae08c76d9e7161fcb5cf7c40 Author: Glenn Morris Date: Wed Dec 19 08:29:21 2018 -0800 ; Copyright year fix No need to merge to master diff --git a/test/src/keyboard-tests.el b/test/src/keyboard-tests.el index d2063a38c1..125dbd0939 100644 --- a/test/src/keyboard-tests.el +++ b/test/src/keyboard-tests.el @@ -1,19 +1,21 @@ ;;; keyboard-tests.el --- Tests for keyboard.c -*- lexical-binding: t -*- -;; Copyright 2017 Free Software Foundation, Inc. +;; Copyright (C) 2017-2018 Free Software Foundation, Inc. -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Code: commit 305aca0a0abbac1011980e6ac9b166bd0dfd6ff0 Author: Chris Feng Date: Wed Nov 8 00:39:43 2017 +0800 Backport: Handle unread-command-events consistently (bug#23980) * src/keyboard.c (read_char): Events put into `unread-command-events' with the form (t . EVENT) should always have the t stripped when read out. * test/src/keyboard-tests.el: New tests for `unread-command-events'. (cherry picked from commit 1f3f4b1296613b8cdc0632a68fde86e86ddad866) diff --git a/src/keyboard.c b/src/keyboard.c index dccc6b7f12..d20557b45d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2809,6 +2809,9 @@ read_char (int commandflag, Lisp_Object map, if (EQ (c, make_number (-2))) return c; + + if (CONSP (c) && EQ (XCAR (c), Qt)) + c = XCDR (c); } non_reread: diff --git a/test/src/keyboard-tests.el b/test/src/keyboard-tests.el new file mode 100644 index 0000000000..d2063a38c1 --- /dev/null +++ b/test/src/keyboard-tests.el @@ -0,0 +1,34 @@ +;;; keyboard-tests.el --- Tests for keyboard.c -*- lexical-binding: t -*- + +;; Copyright 2017 Free Software Foundation, Inc. + +;; This program 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. + +;; This program 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 this program. If not, see . + +;;; Code: + +(require 'ert) + +(ert-deftest keyboard-unread-command-events () + "Test `unread-command-events'." + (should (equal (progn (push ?\C-a unread-command-events) + (read-event nil nil 1)) + ?\C-a)) + (should (equal (progn (run-with-timer + 1 nil + (lambda () (push '(t . ?\C-b) unread-command-events))) + (read-event nil nil 2)) + ?\C-b))) + +(provide 'keyboard-tests) +;;; keyboard-tests.el ends here commit 4c6c327d0c66a21416ed1b5e9738b7dd13e739f2 Author: Glenn Morris Date: Tue Dec 18 21:18:31 2018 -0500 Restrict downcasing in elisp xref tests (bug#25534) The tests happen to not fail at the moment because find-library-name now has an extra feature, find-library--from-load-history, which happens to do a case-insensitive regexp match; but still it seems better not to rely on this. * test/lisp/progmodes/elisp-mode-tests.el (xref--case-insensitive): New variable. (xref-elisp-test-run, emacs-test-dir): Only downcase if the filesystem seems to be case-insensitive. diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 941e85bc89..97148efde4 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -298,6 +298,16 @@ ))) +;; tmp may be on a different filesystem to the tests, but, ehh. +(defvar xref--case-insensitive + (let ((dir (make-temp-file "xref-test" t))) + (unwind-protect + (progn + (with-temp-file (expand-file-name "hElLo" dir) "hello") + (file-exists-p (expand-file-name "HELLO" dir))) + (delete-directory dir t))) + "Non-nil if file system seems to be case-insensitive.") + (defun xref-elisp-test-run (xrefs expected-xrefs) (should (= (length xrefs) (length expected-xrefs))) (while xrefs @@ -307,11 +317,13 @@ (expected-source (when (consp expected) (cdr expected)))) ;; Downcase the filenames for case-insensitive file systems. - (setf (xref-elisp-location-file (oref xref location)) - (downcase (xref-elisp-location-file (oref xref location)))) + (when xref--case-insensitive + (setf (xref-elisp-location-file (oref xref location)) + (downcase (xref-elisp-location-file (oref xref location)))) - (setf (xref-elisp-location-file (oref expected-xref location)) - (downcase (xref-elisp-location-file (oref expected-xref location)))) + (setf (xref-elisp-location-file (oref expected-xref location)) + (downcase (xref-elisp-location-file + (oref expected-xref location))))) (should (equal xref expected-xref)) @@ -346,10 +358,10 @@ to (xref-elisp-test-descr-to-target xref)." ;; `load-path' has the correct case, so this causes the expected test ;; values to have the wrong case). This is handled in ;; `xref-elisp-test-run'. -(defconst emacs-test-dir - (downcase - (file-truename (file-name-directory - (or load-file-name (buffer-file-name)))))) +(defvar emacs-test-dir + (funcall (if xref--case-insensitive 'downcase 'identity) + (file-truename (file-name-directory + (or load-file-name (buffer-file-name)))))) ;; alphabetical by test name commit ab8ed418596da550c79913ccc42e8c3842bca315 Author: Rob Browning Date: Tue Dec 18 15:34:01 2018 -0500 Avoid test failures if directory name looks like a regexp Taken from * test/lisp/ibuffer-tests.el (ibuffer-filter-inclusion-3): * test/lisp/net/tramp-tests.el (tramp-test42-remote-load-path): Regexp-quote file names to avoid failures with directory names of the form "build/emacs-i87jK3/emacs-26.1+1/...". diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el index ff5162fefa..c1d9ed9fc3 100644 --- a/test/lisp/ibuffer-tests.el +++ b/test/lisp/ibuffer-tests.el @@ -312,8 +312,8 @@ (funcall create-non-file-buffer "ibuf-test-3.b" :size 50 :mode #'text-mode :include-content "...but a multitude of drops?\n")) - (dirA (with-current-buffer bufA default-directory)) - (dirB (with-current-buffer bufB default-directory))) + (dirA (regexp-quote (with-current-buffer bufA default-directory))) + (dirB (regexp-quote (with-current-buffer bufB default-directory)))) (should (ibuffer-included-in-filters-p bufA '((basename . "ibuf-test-3")))) (should (ibuffer-included-in-filters-p diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 8f810818af..19edec214f 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4773,8 +4773,9 @@ process sentinels. They shall not disturb each other." (string-match (format "Loading %s" - (expand-file-name - "tramp-cmds" (file-name-directory (locate-library "tramp")))) + (regexp-quote + (expand-file-name + "tramp-cmds" (file-name-directory (locate-library "tramp"))))) (shell-command-to-string (format "%s -batch -Q -L %s -l tramp-sh --eval %s" commit 80e98568aa41b106ebc9bbec9a44fe442a93803d Author: Michael Albinus Date: Mon Dec 17 11:56:05 2018 +0100 Fix Bug#33524 * lisp/progmodes/flymake-proc.el (flymake-proc-create-temp-with-folder-structure): Unquote file-name. (Bug#33524) diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index 4792a94530..7916108a83 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el @@ -854,7 +854,7 @@ can also be executed interactively independently of (unless (stringp file-name) (error "Invalid file-name")) - (let* ((dir (file-name-directory file-name)) + (let* ((dir (file-name-directory (file-name-unquote file-name))) ;; Not sure what this slash-pos is all about, but I guess it's just ;; trying to remove the leading / of absolute file names. (slash-pos (string-match "/" dir)) commit 582527976b3274585644a04223244aa10834933d Author: Glenn Morris Date: Mon Dec 17 17:46:48 2018 -0500 * doc/lispintro/emacs-lisp-intro.texi (Finding More): Fix xref. diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index be3e938b24..01842896ce 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -4636,7 +4636,7 @@ languages, not just Lisp, and C, and it works with non-programming text as well. For example, @code{xref-find-definitions} will jump to the various nodes in the Texinfo source file of this document (provided that you've run the @command{etags} utility to record all -the nodes in the manuals that come with Emacs; @pxref{Create tags +the nodes in the manuals that come with Emacs; @pxref{Create Tags Table,,, emacs, The GNU Emacs Manual}). To use the @code{xref-find-definitions} command, type @kbd{M-.} commit e8bb0420a0a0aefc35932c9b5ee3167f6b237def Author: Paul Eggert Date: Mon Dec 17 08:11:55 2018 -0800 More porting to GCC 8 of --enable-gcc-warnings Backport from master. I ran into this when building Emacs 26 with GCC 8 on Fedora 29 x86. * lwlib/lwlib-Xaw.h (xaw_update_one_value, xaw_popup_menu): * lwlib/lwlib-Xlw.h (xlw_update_one_value, xlw_pop_instance): * lwlib/lwlib.h (lw_allow_resizing, lw_set_main_areas) [!USE_MOTIF]: No longer const. * src/emacs-module.c: Ignore -Wcast-function-type. diff --git a/lwlib/lwlib-Xaw.h b/lwlib/lwlib-Xaw.h index 363334b575..644676f320 100644 --- a/lwlib/lwlib-Xaw.h +++ b/lwlib/lwlib-Xaw.h @@ -15,15 +15,13 @@ void xaw_update_one_widget (widget_instance *, Widget, widget_value *, Boolean); void -xaw_update_one_value (widget_instance *, Widget, widget_value *) - ATTRIBUTE_CONST; +xaw_update_one_value (widget_instance *, Widget, widget_value *); void xaw_destroy_instance (widget_instance *); void -xaw_popup_menu (Widget, XEvent *) - ATTRIBUTE_CONST; +xaw_popup_menu (Widget, XEvent *); void xaw_pop_instance (widget_instance *, Boolean); diff --git a/lwlib/lwlib-Xlw.h b/lwlib/lwlib-Xlw.h index 2d38eb7be6..b0790dc3a5 100644 --- a/lwlib/lwlib-Xlw.h +++ b/lwlib/lwlib-Xlw.h @@ -15,15 +15,13 @@ xlw_update_one_widget (widget_instance* instance, Widget widget, void xlw_update_one_value (widget_instance* instance, Widget widget, - widget_value* val) - ATTRIBUTE_CONST; + widget_value* val); void xlw_destroy_instance (widget_instance* instance); void -xlw_pop_instance (widget_instance* instance, Boolean up) - ATTRIBUTE_CONST; +xlw_pop_instance (widget_instance* instance, Boolean up); void xlw_popup_menu (Widget widget, XEvent * event); diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h index 66730fd8d7..41d3e0139d 100644 --- a/lwlib/lwlib.h +++ b/lwlib/lwlib.h @@ -111,15 +111,9 @@ void lw_refigure_widget (Widget w, Boolean doit); Boolean lw_window_is_in_menubar (Window win, Widget menubar_widget); /* Manage resizing: TRUE permits resizing widget w; FALSE disallows it. */ -#ifndef USE_MOTIF -ATTRIBUTE_CONST -#endif void lw_allow_resizing (Widget w, Boolean flag); /* Set up the main window. */ -#ifndef USE_MOTIF -ATTRIBUTE_CONST -#endif void lw_set_main_areas (Widget parent, Widget menubar, Widget work_area); diff --git a/src/emacs-module.c b/src/emacs-module.c index c20902d072..88049d29cf 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -36,6 +36,11 @@ along with GNU Emacs. If not, see . */ #include #include +/* This module is lackadaisical about function casts. */ +#if GNUC_PREREQ (8, 0, 0) +# pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + /* We use different strategies for allocating the user-visible objects (struct emacs_runtime, emacs_env, emacs_value), depending on whether the user supplied the -module-assertions flag. If