commit fb89711ebc6fb6ddc72269c50ae0f5cae7ce62c3 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Thu Dec 23 09:55:48 2021 +0200 ; Fix documentation of a recently-installed change * lisp/gnus/message.el (message-server-alist) (message-update-smtp-method-header): Doc string fixes. * doc/misc/message.texi (Sending Variables): Fix wording and markup. * etc/NEWS: Fix the wording of the 'message-server-alist' entry. diff --git a/doc/misc/message.texi b/doc/misc/message.texi index dac5e757fa..b628fd1b0f 100644 --- a/doc/misc/message.texi +++ b/doc/misc/message.texi @@ -2555,12 +2555,19 @@ message. @item message-server-alist @vindex message-server-alist -An alist describing how to insert a @code{X-Message-SMTP-Method} -header before sending out a new message. The key has to be a string, -that will be matched with the @code{From} header, and will insert the -value as the SMTP Method if these are equal. Alternatively, the key -may be a function that will be called in the message buffer without -any arguments, and matches if a non-nil value is returned. +An alist describing the rules for generating the +@code{X-Message-SMTP-Method} header to insert before sending out a new +message, if the message doesn't yet have such a header. Each element +of the alist should be of the form +@w{@code{(@var{cond} . @var{method})}}. If @var{cond} is a string, it +will be compared with the @code{From} header, and if they compare +equal, the corresponding @var{method} will be inserted as a string +into the message headers as the SMTP Method. If @var{cond} is a +function, it will be called in the message buffer without any +arguments, and the corresponding @var{method} will be inserted into +the message headers as the SMTP Method if the function returns a +non-@code{nil} value; if @var{method} is nil, the value returned by +the function @code{cond} is used instead. @end table diff --git a/etc/NEWS b/etc/NEWS index 86f18078f6..948dbba261 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -402,9 +402,9 @@ If non-nil, 'C-c C-a' will put attached files at the end of the message. *** Message Mode now supports image yanking. --- -*** New user option 'message-server-alist' -Enables automatically inserting "X-Message-SMTP-Method" before sending -a message. +*** New user option 'message-server-alist'. +This controls automatic insertion of the "X-Message-SMTP-Method" +header before sending a message. ** HTML Mode diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index c18560b164..f69f51a828 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4336,16 +4336,17 @@ Instead, just auto-save the buffer and then bury it." (autoload 'mml-secure-bcc-is-safe "mml-sec") (defcustom message-server-alist nil - "Alist of rules to generate \"X-Message-SMTP-Method\" headers. -If any entry of the form (COND . METHOD) matches, the header will -be inserted just before the message is sent. If COND is a -string, METHOD will be inserted if the \"From\" header matches -COND. If COND is a function, METHOD will be inserted if COND -returns a non-nil value, when called in the message buffer -without any arguments. If METHOD is nil in the last case, the -return value of the function will be returned instead. None of -this applies if the buffer already has a\"X-Message-SMTP-Method\" -header." + "Alist of rules to generate \"X-Message-SMTP-Method\" header. +The header will be inserted just before the message is sent. +Elements should be of the form (COND . METHOD). +If COND is a string, METHOD will be inserted if the \"From\" +address compares equal with COND. +If COND is a function, METHOD will be inserted if COND returns +a non-nil value when called in the message buffer without any +arguments. If METHOD is nil in this case, the return value of +the function will be inserted instead. +If the buffer already has a\"X-Message-SMTP-Method\" header, +it is left unchanged." :type '(alist :key-type '(choice (string :tag "From Address") (function :tag "Predicate")) @@ -4354,7 +4355,7 @@ header." :group 'message-sending) (defun message-update-smtp-method-header () - "Check `message-server-alist' to insert a SMTP-Method header." + "Insert an X-Message-SMTP-Method header according to `message-server-alist'." (unless (message-fetch-field "X-Message-SMTP-Method") (let ((from (cadr (mail-extract-address-components (message-fetch-field "From")))) method) commit be38405b1f5309c14668510ccc7c1306f399de6e Merge: b1cfdb3573 29fffbdd87 Author: Stefan Kangas Date: Thu Dec 23 06:31:26 2021 +0100 Merge from origin/emacs-28 29fffbdd87 Revert field-related thingatpt changes 9bcb732686 * lisp/window.el (quit-restore-window): Select previously ... b7d31d6192 Revert "Remove Motif support" # Conflicts: # etc/NEWS commit b1cfdb3573facdceae3785478c62c2e2548564ec Author: Philip Kaludercic Date: Thu Dec 23 00:38:28 2021 +0100 Fix wrong-type-argument * message.el (message-update-smtp-method-header): Only Use address part of mail-extract-address-component. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 8c88ac8257..c18560b164 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4356,7 +4356,7 @@ header." (defun message-update-smtp-method-header () "Check `message-server-alist' to insert a SMTP-Method header." (unless (message-fetch-field "X-Message-SMTP-Method") - (let ((from (mail-extract-address-components (message-fetch-field "From"))) + (let ((from (cadr (mail-extract-address-components (message-fetch-field "From")))) method) (catch 'exit (dolist (server message-server-alist) commit 28fff38eeb9e7641937bc3448d43c0a7d0eb6bbc Author: Philip Kaludercic Date: Sun Dec 19 22:53:59 2021 +0100 Allow automatic X-Message-SMTP-Method header insertion * message.el (message-server-alist): Add user option (message-update-smtp-method-header): Add function (message-send): Call message-update-smtp-method-header * doc/misc/message.texi (Sending Variables): Document message-server-alist * etc/NEWS: Add news entry diff --git a/doc/misc/message.texi b/doc/misc/message.texi index 4136ad859f..dac5e757fa 100644 --- a/doc/misc/message.texi +++ b/doc/misc/message.texi @@ -2553,6 +2553,15 @@ if @code{nil} let the mailer mail back a message to report errors. When non-@code{nil}, Gnus will ask for confirmation when sending a message. +@item message-server-alist +@vindex message-server-alist +An alist describing how to insert a @code{X-Message-SMTP-Method} +header before sending out a new message. The key has to be a string, +that will be matched with the @code{From} header, and will insert the +value as the SMTP Method if these are equal. Alternatively, the key +may be a function that will be called in the message buffer without +any arguments, and matches if a non-nil value is returned. + @end table diff --git a/etc/NEWS b/etc/NEWS index ff01ab7ac1..86f18078f6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -401,6 +401,11 @@ If non-nil, 'C-c C-a' will put attached files at the end of the message. --- *** Message Mode now supports image yanking. +--- +*** New user option 'message-server-alist' +Enables automatically inserting "X-Message-SMTP-Method" before sending +a message. + ** HTML Mode --- diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 285369b84c..8c88ac8257 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4335,6 +4335,43 @@ Instead, just auto-save the buffer and then bury it." (autoload 'mml-secure-bcc-is-safe "mml-sec") +(defcustom message-server-alist nil + "Alist of rules to generate \"X-Message-SMTP-Method\" headers. +If any entry of the form (COND . METHOD) matches, the header will +be inserted just before the message is sent. If COND is a +string, METHOD will be inserted if the \"From\" header matches +COND. If COND is a function, METHOD will be inserted if COND +returns a non-nil value, when called in the message buffer +without any arguments. If METHOD is nil in the last case, the +return value of the function will be returned instead. None of +this applies if the buffer already has a\"X-Message-SMTP-Method\" +header." + :type '(alist :key-type '(choice + (string :tag "From Address") + (function :tag "Predicate")) + :value-type 'string) + :version "29.1" + :group 'message-sending) + +(defun message-update-smtp-method-header () + "Check `message-server-alist' to insert a SMTP-Method header." + (unless (message-fetch-field "X-Message-SMTP-Method") + (let ((from (mail-extract-address-components (message-fetch-field "From"))) + method) + (catch 'exit + (dolist (server message-server-alist) + (cond ((functionp (car server)) + (let ((res (funcall (car server)))) + (when res + (setq method (or (cdr server) res)) + (throw 'exit nil)))) + ((and (stringp (car server)) + (string= (car server) from)) + (setq method (cdr server)) + (throw 'exit nil))))) + (when method + (message-add-header (concat "X-Message-SMTP-Method: " method)))))) + (defun message-send (&optional arg) "Send the message in the current buffer. If `message-interactive' is non-nil, wait for success indication or @@ -4348,6 +4385,7 @@ It should typically alter the sending method in some way or other." (undo-boundary) (let ((inhibit-read-only t)) (put-text-property (point-min) (point-max) 'read-only nil)) + (message-update-smtp-method-header) (message-fix-before-sending) (run-hooks 'message-send-hook) (mml-secure-bcc-is-safe) commit 8cc7326d953db2006c41a8eb99ca2530a63cabda Author: Stefan Kangas Date: Wed Dec 22 22:40:51 2021 +0100 Fix compile time error in a pcase test * test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-cl-type): Fix test. diff --git a/test/lisp/emacs-lisp/pcase-tests.el b/test/lisp/emacs-lisp/pcase-tests.el index 7ad01e7aef..40ae9809b5 100644 --- a/test/lisp/emacs-lisp/pcase-tests.el +++ b/test/lisp/emacs-lisp/pcase-tests.el @@ -107,8 +107,11 @@ (should (equal (pcase 1 ((cl-type (integer 0 2)) 'integer-0<=n<=2)) 'integer-0<=n<=2)) - (should-error (pcase 1 - ((cl-type notatype) 'integer)))) + (should-error + ;; Avoid error at compile time due to compiler macro. + (eval '(pcase 1 + ((cl-type notatype) 'integer)) + t))) (ert-deftest pcase-tests-setq () (should (equal (let (a b) commit 8d846b8f8e09a0865a0e08cc2fea3ede48accdc3 Author: Stefan Kangas Date: Wed Dec 22 22:26:46 2021 +0100 Use defvar-keymap in minibuffer.el * lisp/minibuffer.el (completion-in-region-mode-map) (minibuffer-local-completion-map) (minibuffer-local-must-match-map) (minibuffer-local-filename-completion-map) (minibuffer-local-ns-map, minibuffer-inactive-mode-map): Use defvar-keymap. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 112c609a0a..b1e8e15426 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2448,14 +2448,12 @@ Also respects the obsolete wrapper hook `completion-in-region-functions'. (completion-in-region-mode 1)) (completion--in-region-1 start end)))) -(defvar completion-in-region-mode-map - (let ((map (make-sparse-keymap))) - ;; FIXME: Only works if completion-in-region-mode was activated via - ;; completion-at-point called directly. - (define-key map "\M-?" 'completion-help-at-point) - (define-key map "\t" 'completion-at-point) - map) - "Keymap activated during `completion-in-region'.") +(defvar-keymap completion-in-region-mode-map + :doc "Keymap activated during `completion-in-region'." + ;; FIXME: Only works if completion-in-region-mode was activated via + ;; completion-at-point called directly. + "M-?" #'completion-help-at-point + "TAB" #'completion-at-point) ;; It is difficult to know when to exit completion-in-region-mode (i.e. hide ;; the *Completions*). Here's how previous packages did it: @@ -2651,49 +2649,41 @@ The completion method is determined by `completion-at-point-functions'." (define-key map "\n" 'exit-minibuffer) (define-key map "\r" 'exit-minibuffer)) -(defvar minibuffer-local-completion-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-map) - (define-key map "\t" 'minibuffer-complete) - (define-key map [backtab] 'minibuffer-complete) - ;; M-TAB is already abused for many other purposes, so we should find - ;; another binding for it. - ;; (define-key map "\e\t" 'minibuffer-force-complete) - (define-key map " " 'minibuffer-complete-word) - (define-key map "?" 'minibuffer-completion-help) - (define-key map [prior] 'switch-to-completions) - (define-key map "\M-v" 'switch-to-completions) - (define-key map "\M-g\M-c" 'switch-to-completions) - map) - "Local keymap for minibuffer input with completion.") - -(defvar minibuffer-local-must-match-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-completion-map) - (define-key map "\r" 'minibuffer-complete-and-exit) - (define-key map "\n" 'minibuffer-complete-and-exit) - map) - "Local keymap for minibuffer input with completion, for exact match.") - -(defvar minibuffer-local-filename-completion-map - (let ((map (make-sparse-keymap))) - (define-key map " " nil) - map) - "Local keymap for minibuffer input with completion for filenames. +(defvar-keymap minibuffer-local-completion-map + :doc "Local keymap for minibuffer input with completion." + :parent minibuffer-local-map + "TAB" #'minibuffer-complete + "" #'minibuffer-complete + ;; M-TAB is already abused for many other purposes, so we should find + ;; another binding for it. + ;; "M-TAB" #'minibuffer-force-complete + "SPC" #'minibuffer-complete-word + "?" #'minibuffer-completion-help + "" #'switch-to-completions + "M-v" #'switch-to-completions + "M-g M-c" #'switch-to-completions) + +(defvar-keymap minibuffer-local-must-match-map + :doc "Local keymap for minibuffer input with completion, for exact match." + :parent minibuffer-local-completion-map + "RET" #'minibuffer-complete-and-exit + "C-j" #'minibuffer-complete-and-exit) + +(defvar-keymap minibuffer-local-filename-completion-map + :doc "Local keymap for minibuffer input with completion for filenames. Gets combined either with `minibuffer-local-completion-map' or -with `minibuffer-local-must-match-map'.") +with `minibuffer-local-must-match-map'." + "SPC" nil) (defvar minibuffer-local-filename-must-match-map (make-sparse-keymap)) (make-obsolete-variable 'minibuffer-local-filename-must-match-map nil "24.1") -(defvar minibuffer-local-ns-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-map) - (define-key map " " #'exit-minibuffer) - (define-key map "\t" #'exit-minibuffer) - (define-key map "?" #'self-insert-and-exit) - map) - "Local keymap for the minibuffer when spaces are not allowed.") +(defvar-keymap minibuffer-local-ns-map + :doc "Local keymap for the minibuffer when spaces are not allowed." + :parent minibuffer-local-map + "SPC" #'exit-minibuffer + "TAB" #'exit-minibuffer + "?" #'self-insert-and-exit) (defun read-no-blanks-input (prompt &optional initial inherit-input-method) "Read a string from the terminal, not allowing blanks. @@ -2714,24 +2704,23 @@ If `inhibit-interaction' is non-nil, this function will signal an ;;; Major modes for the minibuffer -(defvar minibuffer-inactive-mode-map - (let ((map (make-keymap))) - (suppress-keymap map) - (define-key map "e" 'find-file-other-frame) - (define-key map "f" 'find-file-other-frame) - (define-key map "b" 'switch-to-buffer-other-frame) - (define-key map "i" 'info) - (define-key map "m" 'mail) - (define-key map "n" 'make-frame) - (define-key map [mouse-1] 'view-echo-area-messages) - ;; So the global down-mouse-1 binding doesn't clutter the execution of the - ;; above mouse-1 binding. - (define-key map [down-mouse-1] #'ignore) - map) - "Keymap for use in the minibuffer when it is not active. +(defvar-keymap minibuffer-inactive-mode-map + :doc "Keymap for use in the minibuffer when it is not active. The non-mouse bindings in this keymap can only be used in minibuffer-only frames, since the minibuffer can normally not be selected when it is -not active.") +not active." + :full t + :suppress t + "e" #'find-file-other-frame + "f" #'find-file-other-frame + "b" #'switch-to-buffer-other-frame + "i" #'info + "m" #'mail + "n" #'make-frame + "" #'view-echo-area-messages + ;; So the global down-mouse-1 binding doesn't clutter the execution of the + ;; above mouse-1 binding. + "" #'ignore) (define-derived-mode minibuffer-inactive-mode nil "InactiveMinibuffer" :abbrev-table nil ;abbrev.el is not loaded yet during dump. commit 205030ba5a1f55dab9c748bcb322b8726d6c17e7 Author: Stefan Kangas Date: Wed Dec 22 22:15:57 2021 +0100 Make substitute-command-keys test less brittle * test/lisp/help-tests.el (help-tests--test-keymap): New keymap variable. (help-tests-substitute-command-keys/keymaps): Make test less brittle by using above new keymap. diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 715d9e5b8a..a1ae838239 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el @@ -106,11 +106,34 @@ (should (eq (get-text-property 0 'face (substitute-command-keys "\\`f'")) 'help-key-binding))) +(defvar-keymap help-tests--test-keymap + :doc "Just some keymap for testing." + "C-g" #'abort-minibuffers + "TAB" #'minibuffer-complete + "C-j" #'minibuffer-complete-and-exit + "RET" #'minibuffer-complete-and-exit + "SPC" #'minibuffer-complete-word + "?" #'minibuffer-completion-help + "C-" #'file-cache-minibuffer-complete + "" #'previous-history-element + "" #'next-history-element + "" #'minibuffer-complete + "" #'next-line-or-history-element + "" #'next-history-element + "" #'switch-to-completions + "" #'previous-line-or-history-element + "M-v" #'switch-to-completions + "M-<" #'minibuffer-beginning-of-buffer + "M-n" #'next-history-element + "M-p" #'previous-history-element + "M-r" #'previous-matching-history-element + "M-s" #'next-matching-history-element + "M-g M-c" #'switch-to-completions) (ert-deftest help-tests-substitute-command-keys/keymaps () (with-substitute-command-keys-test - (test-re "\\{minibuffer-local-must-match-map}" - " + (test-re "\\{help-tests--test-keymap}" + " Key Binding -+ C-g abort-minibuffers @@ -128,13 +151,12 @@ C- file-cache-minibuffer-complete switch-to-completions previous-line-or-history-element -M-v switch-to-completions - M-< minibuffer-beginning-of-buffer M-n next-history-element M-p previous-history-element M-r previous-matching-history-element M-s next-matching-history-element +M-v switch-to-completions M-g M-c switch-to-completions "))) commit ec1312d76a6bb9b4011ab66adad1614a31747af8 Author: Alan Third Date: Fri Nov 26 12:54:07 2021 +0000 Add native HEIC support on macOS (bug#51381) * lisp/image.el (image-type-header-regexps): (image-type-file-name-regexps): (image-type-auto-detectable): Add auto-detect code for heic. * src/image.c (syms_of_image): Add heic as an image type under NS. * src/nsimage.m (ns_can_use_native_image_api): Add heic to list of possible image types in the native image support lookup. diff --git a/lisp/image.el b/lisp/image.el index cedefc038f..702985f41f 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -58,7 +58,7 @@ static \\(unsigned \\)?char \\1_bits" . xbm) "\\(?:!DOCTYPE[ \t\r\n]+[^>]*>[ \t\r\n]*<[ \t\r\n]*" comment-re "*\\)?" "[Ss][Vv][Gg]")) . svg) - ) + ("\\`....ftyp\\(heic\\|heix\\|hevc\\|heim\\|heis\\|hevm\\|hevs\\|mif1\\|msf1\\)" . heic)) "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types. When the first bytes of an image file match REGEXP, it is assumed to be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol. If not a symbol, @@ -78,7 +78,7 @@ a non-nil value, TYPE is the image's type.") ("\\.ps\\'" . postscript) ("\\.tiff?\\'" . tiff) ("\\.svgz?\\'" . svg) - ) + ("\\.hei[cf]s?\\'" . heic)) "Alist of (REGEXP . IMAGE-TYPE) pairs used to identify image files. When the name of an image file match REGEXP, it is assumed to be of image type IMAGE-TYPE.") @@ -97,7 +97,8 @@ be of image type IMAGE-TYPE.") (tiff . maybe) (svg . maybe) (webp . maybe) - (postscript . nil)) + (postscript . nil) + (heic . maybe)) "Alist of (IMAGE-TYPE . AUTODETECT) pairs used to auto-detect image files. \(See `image-type-auto-detected-p'). diff --git a/src/image.c b/src/image.c index 3904ab75a6..1d83065cf7 100644 --- a/src/image.c +++ b/src/image.c @@ -11481,6 +11481,11 @@ non-numeric, there is no explicit limit on the size of images. */); #endif /* HAVE_NTGUI */ #endif /* HAVE_RSVG */ +#ifdef HAVE_NS + DEFSYM (Qheic, "heic"); + add_image_type (Qheic); +#endif + #if HAVE_NATIVE_IMAGE_API DEFSYM (Qnative_image, "native-image"); # ifdef HAVE_NTGUI diff --git a/src/nsimage.m b/src/nsimage.m index dd2bb3b0d7..98efc9c6c0 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -76,6 +76,8 @@ Updated by Christian Limpach (chris@nice.ch) imageType = @"public.tiff"; else if (EQ (type, Qsvg)) imageType = @"public.svg-image"; + else if (EQ (type, Qheic)) + imageType = @"public.heic"; /* NSImage also supports a host of other types such as PDF and BMP, but we don't yet support these in image.c. */ commit ab0d7a2b83fbb97788efb3ad1cd5e3b0ed10f7f4 Author: Alan Third Date: Thu Aug 26 19:25:48 2021 +0100 Allow resizing undecorated frames on macOS (bug#28512, bug#31795) * src/nsterm.m (FRAME_DECORATED_FLAGS, FRAME_UNDECORATED_FLAGS): Remove unused defines. * src/nsterm.m ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]): Since this is now the only place these defines are used just put them inline and add NSWindowStyleMaskResizable for undecorated frames on Cocoa. diff --git a/src/nsterm.m b/src/nsterm.m index 8fdbacf12f..8428c689fd 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -453,14 +453,6 @@ - (unsigned long)unsignedLong } -/* These flags will be OR'd or XOR'd with the NSWindow's styleMask - property depending on what we're doing. */ -#define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \ - | NSWindowStyleMaskResizable \ - | NSWindowStyleMaskMiniaturizable \ - | NSWindowStyleMaskClosable) -#define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless - /* TODO: Get rid of need for these forward declarations. */ static void ns_condemn_scroll_bars (struct frame *f); static void ns_judge_scroll_bars (struct frame *f); @@ -8238,10 +8230,17 @@ - (instancetype) initWithEmacsFrame:(struct frame *)f if (fullscreen) styleMask = NSWindowStyleMaskBorderless; else if (FRAME_UNDECORATED (f)) - styleMask = FRAME_UNDECORATED_FLAGS; + { + styleMask = NSWindowStyleMaskBorderless; +#ifdef NS_IMPL_COCOA + styleMask |= NSWindowStyleMaskResizable; +#endif + } else - styleMask = FRAME_DECORATED_FLAGS; - + styleMask = NSWindowStyleMaskTitled + | NSWindowStyleMaskResizable + | NSWindowStyleMaskMiniaturizable + | NSWindowStyleMaskClosable; self = [super initWithContentRect: NSMakeRect (0, 0, commit 89749a62b51e19a39f145a1985ae5992c58c6776 Author: Alan Third Date: Wed Aug 25 19:50:27 2021 +0100 Make NS toolbar item ID more unique (bug#50160) * src/nsmenu.m ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): Add the label to the identifier to avoid collisions between toolbar items that use the same image. diff --git a/src/nsmenu.m b/src/nsmenu.m index f42cd38702..d15386641f 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1255,8 +1255,8 @@ - (void) addDisplayItemWithImage: (EmacsImage *)img NSTRACE ("[EmacsToolbar addDisplayItemWithImage: ...]"); /* 1) come up w/identifier */ - NSString *identifier - = [NSString stringWithFormat: @"%lu", (unsigned long)[img hash]]; + NSString *identifier = [NSString stringWithFormat: @"%lu%@", + (unsigned long)[img hash], label]; [activeIdentifiers addObject: identifier]; /* 2) create / reuse item */ commit 42601d3a938ee5a12a557840aef11c4d3bb180f6 Author: Alan Third Date: Sun Aug 22 21:50:09 2021 +0100 Make NS toolbar use NSString instead of C strings * src/nsfns.m ([NSString stringWithLispString:]): Ensure that the lisp object is actually a string. * src/nsmenu.m (update_frame_tool_bar): Convert to NSString instead of C strings. ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): No need to convert to NSString here anymore. diff --git a/src/nsfns.m b/src/nsfns.m index 7cb2cf7258..643da01989 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -3140,6 +3140,9 @@ @implementation NSString (EmacsString) encoded form (e.g. UTF-8). */ + (NSString *)stringWithLispString:(Lisp_Object)string { + if (!STRINGP (string)) + return nil; + /* Shortcut for the common case. */ if (all_nonzero_ascii (SDATA (string), SBYTES (string))) return [NSString stringWithCString: SSDATA (string) diff --git a/src/nsmenu.m b/src/nsmenu.m index 29201e6907..f42cd38702 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1081,9 +1081,7 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item struct image *img; Lisp_Object image; Lisp_Object labelObj; - const char *labelText; Lisp_Object helpObj; - const char *helpText; /* Check if this is a separator. */ if (EQ (TOOLPROP (TOOL_BAR_ITEM_TYPE), Qt)) @@ -1109,11 +1107,9 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item idx = -1; } labelObj = TOOLPROP (TOOL_BAR_ITEM_LABEL); - labelText = NILP (labelObj) ? "" : SSDATA (labelObj); helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP); if (NILP (helpObj)) helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION); - helpText = NILP (helpObj) ? "" : SSDATA (helpObj); /* Ignore invalid image specifications. */ if (!valid_image_p (image)) @@ -1135,8 +1131,8 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item [toolbar addDisplayItemWithImage: img->pixmap idx: k++ tag: i - labelText: labelText - helpText: helpText + labelText: [NSString stringWithLispString:labelObj] + helpText: [NSString stringWithLispString:helpObj] enabled: enabled_p]; #undef TOOLPROP } @@ -1252,8 +1248,8 @@ - (BOOL) changed - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx tag: (int)tag - labelText: (const char *)label - helpText: (const char *)help + labelText: (NSString *)label + helpText: (NSString *)help enabled: (BOOL)enabled { NSTRACE ("[EmacsToolbar addDisplayItemWithImage: ...]"); @@ -1270,8 +1266,8 @@ - (void) addDisplayItemWithImage: (EmacsImage *)img item = [[[NSToolbarItem alloc] initWithItemIdentifier: identifier] autorelease]; [item setImage: img]; - [item setLabel: [NSString stringWithUTF8String: label]]; - [item setToolTip: [NSString stringWithUTF8String: help]]; + [item setLabel: label]; + [item setToolTip: help]; [item setTarget: emacsView]; [item setAction: @selector (toolbarClicked:)]; [identifierToItem setObject: item forKey: identifier]; diff --git a/src/nsterm.h b/src/nsterm.h index 3413bb1f78..75b31c68f1 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -551,8 +551,8 @@ typedef id instancetype; - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx tag: (int)tag - labelText: (const char *)label - helpText: (const char *)help + labelText: (NSString *)label + helpText: (NSString *)help enabled: (BOOL)enabled; /* delegate methods */ commit 308ad05d37a2d230c65a8799e193e25f4f8ba540 Author: Alan Third Date: Sat Aug 21 19:39:39 2021 +0100 Fix macfont backend color handling * src/macfont.m (get_cgcolor): Replace use of ns_lookup_indexed_color. (CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND): (CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND): (CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND): Fix call to get_cgcolor and fix all callers. diff --git a/src/macfont.m b/src/macfont.m index ce7a5ec8cd..3f87c1be76 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -598,9 +598,9 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char, } static CGColorRef -get_cgcolor(unsigned long idx, struct frame *f) +get_cgcolor(unsigned long color) { - NSColor *nsColor = ns_lookup_indexed_color (idx, f); + NSColor *nsColor = [NSColor colorWithUnsignedLong:color]; [nsColor set]; CGColorSpaceRef colorSpace = [[nsColor colorSpace] CGColorSpace]; NSInteger noc = [nsColor numberOfComponents]; @@ -628,21 +628,21 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char, return cgColor; } -#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face, f) \ +#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face) \ do { \ - CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \ + CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ CGContextSetFillColorWithColor (context, refcol_) ; \ CGColorRelease (refcol_); \ } while (0) -#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face, f) \ +#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face) \ do { \ - CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face), f); \ + CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face)); \ CGContextSetFillColorWithColor (context, refcol_); \ CGColorRelease (refcol_); \ } while (0) -#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face, f) \ +#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face) \ do { \ - CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \ + CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ CGContextSetStrokeColorWithColor (context, refcol_); \ CGColorRelease (refcol_); \ } while (0) @@ -2933,7 +2933,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no CGColorRelease (colorref); } else - CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face, f); + CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face); CGContextFillRects (context, &background_rect, 1); } @@ -2949,7 +2949,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no CGColorRelease (colorref); } else - CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face, s->f); + CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face); if (macfont_info->synthetic_italic_p) atfm = synthetic_italic_atfm; else @@ -2978,7 +2978,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 CGContextSetLineWidth (context, synthetic_bold_factor * font_size); #endif - CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f); + CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face); } if (no_antialias_p) CGContextSetShouldAntialias (context, false); commit 11c0b2550331df6b7f812c61cb4113c42ea99ad7 Author: Alan Third Date: Sun Aug 15 10:46:43 2021 +0100 Further cleanup of NS color code * src/dispextern.h (FACE_COLOR_TO_PIXEL): Remove define and fix all callers. * src/nsterm.h (struct nsfont_info): Remove color_table. * src/nsterm.m ([NSColor colorWithUnsignedLong:]): Always assume the input contains the correct alpha value. (ns_lookup_indexed_color): (ns_index_color): (ns_color_index_to_rgba): Remove functions and fix all callers. (ns_query_color): No longer set pixel to the lookup table index, always just set it to the ARGB integer value. (ns_defined_color): Ignore makeindex as we no longer set pixel to the lookup table index. (ns_initialize_display_info): (ns_redisplay_interface): Remove lookup table. (ns_term_init): Fix the alpha setting. thing diff --git a/src/dispextern.h b/src/dispextern.h index 0f316a2eaf..f1d99abad3 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -123,15 +123,10 @@ typedef HDC Emacs_Pix_Context; #ifdef HAVE_NS #include "nsgui.h" -#define FACE_COLOR_TO_PIXEL(face_color, frame) (FRAME_NS_P (frame) \ - ? ns_color_index_to_rgba (face_color, frame) \ - : face_color) /* Following typedef needed to accommodate the MSDOS port, believe it or not. */ typedef struct ns_display_info Display_Info; typedef Emacs_Pixmap Emacs_Pix_Container; typedef Emacs_Pixmap Emacs_Pix_Context; -#else -#define FACE_COLOR_TO_PIXEL(face_color, frame) face_color #endif #ifdef HAVE_PGTK diff --git a/src/image.c b/src/image.c index dc9aae27c9..3904ab75a6 100644 --- a/src/image.c +++ b/src/image.c @@ -2626,8 +2626,8 @@ lookup_image (struct frame *f, Lisp_Object spec, int face_id) face_id = DEFAULT_FACE_ID; struct face *face = FACE_FROM_ID (f, face_id); - unsigned long foreground = FACE_COLOR_TO_PIXEL (face->foreground, f); - unsigned long background = FACE_COLOR_TO_PIXEL (face->background, f); + unsigned long foreground = face->foreground; + unsigned long background = face->background; int font_size = face->font->pixel_size; char *font_family = SSDATA (face->lface[LFACE_FAMILY_INDEX]); diff --git a/src/nsfns.m b/src/nsfns.m index 365df7fc1e..7cb2cf7258 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -300,9 +300,9 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. face = FRAME_DEFAULT_FACE (f); if (face) { - col = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f); - face->background = ns_index_color - ([col colorWithAlphaComponent: alpha], f); + col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]; + face->background = [[col colorWithAlphaComponent: alpha] + unsignedLong]; update_face_from_frame_parameter (f, Qbackground_color, arg); } diff --git a/src/nsfont.m b/src/nsfont.m index b3224629f0..7ff852b843 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -1196,7 +1196,7 @@ is false when (FROM > 0 || TO < S->nchars). */ { if (s->hl != DRAW_CURSOR) [(NS_FACE_BACKGROUND (face) != 0 - ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) + ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] : FRAME_BACKGROUND_COLOR (s->f)) set]; else [FRAME_CURSOR_COLOR (s->f) set]; @@ -1216,7 +1216,7 @@ is false when (FROM > 0 || TO < S->nchars). */ col = FRAME_BACKGROUND_COLOR (s->f); else col = (NS_FACE_FOREGROUND (face) != 0 - ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f) + ? [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)] : FRAME_FOREGROUND_COLOR (s->f)); /* render under GNUstep using DPS */ diff --git a/src/nsgui.h b/src/nsgui.h index e4038d3226..e79fcab336 100644 --- a/src/nsgui.h +++ b/src/nsgui.h @@ -58,9 +58,6 @@ typedef struct _XCharStruct int descent; } XCharStruct; -/* Used in xdisp.c when comparing faces and frame colors. */ -extern unsigned long ns_color_index_to_rgba(int idx, struct frame *f); - #ifdef __OBJC__ typedef id Emacs_Pixmap; #else diff --git a/src/nsterm.h b/src/nsterm.h index 8bd7611441..3413bb1f78 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -357,6 +357,7 @@ typedef id instancetype; @interface NSColor (EmacsColor) + (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; ++ (NSColor *)colorWithUnsignedLong:(unsigned long)c; - (NSColor *)colorUsingDefaultColorSpace; - (unsigned long)unsignedLong; @end @@ -821,12 +822,6 @@ struct ns_display_info ptrdiff_t bitmaps_size; ptrdiff_t bitmaps_last; -#ifdef __OBJC__ - NSMutableArray *color_table; -#else - void *color_table; -#endif - /* DPI resolution of this screen */ double resx, resy; @@ -1102,13 +1097,9 @@ ns_defined_color (struct frame *f, const char *name, Emacs_Color *color_def, bool alloc, bool makeIndex); -extern void -ns_query_color (void *col, Emacs_Color *color_def, bool setPixel); #ifdef __OBJC__ extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); -extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); -extern unsigned long ns_index_color (NSColor *color, struct frame *f); extern const char *ns_get_pending_menu_title (void); #endif diff --git a/src/nsterm.m b/src/nsterm.m index 12f24fbfd5..8fdbacf12f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -167,15 +167,13 @@ - (NSColor *)colorUsingDefaultColorSpace } + (NSColor *)colorWithUnsignedLong:(unsigned long)c - hasAlpha:(BOOL)alpha { EmacsCGFloat a = (double)((c >> 24) & 0xff) / 255.0; EmacsCGFloat r = (double)((c >> 16) & 0xff) / 255.0; EmacsCGFloat g = (double)((c >> 8) & 0xff) / 255.0; EmacsCGFloat b = (double)(c & 0xff) / 255.0; - return [NSColor colorForEmacsRed:r green:g blue:b - alpha:(alpha ? a : (EmacsCGFloat)1.0)]; + return [NSColor colorForEmacsRed:r green:g blue:b alpha:a]; } - (unsigned long)unsignedLong @@ -1972,35 +1970,6 @@ Hide the window (X11 semantics) ========================================================================== */ -NSColor * -ns_lookup_indexed_color (unsigned long idx, struct frame *f) -{ - NSMutableArray *color_table = FRAME_DISPLAY_INFO (f)->color_table; - if (idx < 1 || idx >= [color_table count]) - return nil; - return [color_table objectAtIndex:idx]; -} - - -unsigned long -ns_index_color (NSColor *color, struct frame *f) -{ - NSMutableArray *color_table = FRAME_DISPLAY_INFO (f)->color_table; - - /* An index of 0 appears to be special in some way, so insert a - dummy object. */ - if ([color_table count] == 0) - [color_table addObject:[NSNull null]]; - - /* Do we already have this color? */ - if ([color_table containsObject:color]) - return [color_table indexOfObject:color]; - - [color_table addObject:color]; - return [color_table count] - 1; -} - - static int ns_get_color (const char *name, NSColor **col) /* -------------------------------------------------------------------------- @@ -2125,25 +2094,11 @@ Hide the window (X11 semantics) return 1; } -/* Convert an index into the color table into an RGBA value. Used in - xdisp.c:extend_face_to_end_of_line when comparing faces and frame - color values. */ - -unsigned long -ns_color_index_to_rgba(int idx, struct frame *f) -{ - NSColor *col; - col = ns_lookup_indexed_color (idx, f); - - return [col unsignedLong]; -} - void -ns_query_color(void *col, Emacs_Color *color_def, bool setPixel) +ns_query_color(void *col, Emacs_Color *color_def) /* -------------------------------------------------------------------------- - Get ARGB values out of NSColor col and put them into color_def. - If setPixel, set the pixel to a concatenated version. - and set color_def pixel to the resulting index. + Get ARGB values out of NSColor col and put them into color_def + and set color_def pixel to the ARGB color. -------------------------------------------------------------------------- */ { EmacsCGFloat r, g, b, a; @@ -2153,8 +2108,7 @@ Hide the window (X11 semantics) color_def->green = g * 65535; color_def->blue = b * 65535; - if (setPixel == YES) - color_def->pixel = [(NSColor *)col unsignedLong]; + color_def->pixel = [(NSColor *)col unsignedLong]; } bool @@ -2162,12 +2116,9 @@ Hide the window (X11 semantics) const char *name, Emacs_Color *color_def, bool alloc, - bool makeIndex) + bool _makeIndex) /* -------------------------------------------------------------------------- Return true if named color found, and set color_def rgb accordingly. - If makeIndex and alloc are nonzero put the color in the color_table, - and set color_def pixel to the resulting index. - If makeIndex is zero, set color_def pixel to ARGB. Return false if not found. -------------------------------------------------------------------------- */ { @@ -2180,9 +2131,7 @@ Hide the window (X11 semantics) unblock_input (); return 0; } - if (makeIndex && alloc) - color_def->pixel = ns_index_color (col, f); - ns_query_color (col, color_def, !makeIndex); + ns_query_color (col, color_def); unblock_input (); return 1; } @@ -2193,7 +2142,7 @@ Hide the window (X11 semantics) External (hook): Store F's background color into *BGCOLOR -------------------------------------------------------------------------- */ { - ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, true); + ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor); } static void @@ -2612,8 +2561,8 @@ Hide the window (X11 semantics) block_input (); ns_focus (f, &r, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID)), f) set]; + [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID))] set]; NSRectFill (r); ns_unfocus (f); @@ -2641,7 +2590,7 @@ Hide the window (X11 semantics) r = NSIntersectionRect (r, [view frame]); ns_focus (f, &r, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; + [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; NSRectFill (r); @@ -2744,8 +2693,7 @@ Hide the window (X11 semantics) return; ns_focus (f, NULL, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; - + [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; NSRectFill (NSMakeRect (0, margin, width, border)); NSRectFill (NSMakeRect (0, 0, border, height)); NSRectFill (NSMakeRect (0, margin, width, border)); @@ -2796,7 +2744,7 @@ Hide the window (X11 semantics) NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height); ns_focus (f, &r, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; + [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; NSRectFill (NSMakeRect (0, y, width, height)); NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width, y, width, height)); @@ -2964,7 +2912,7 @@ Hide the window (X11 semantics) { NSTRACE_RECT ("clearRect", clearRect); - [ns_lookup_indexed_color(face->background, f) set]; + [[NSColor colorWithUnsignedLong:face->background] set]; NSRectFill (clearRect); } @@ -2981,9 +2929,9 @@ Hide the window (X11 semantics) [bmp transformUsingAffineTransform:transform]; if (!p->cursor_p) - bm_color = ns_lookup_indexed_color(face->foreground, f); + bm_color = [NSColor colorWithUnsignedLong:face->foreground]; else if (p->overlay_p) - bm_color = ns_lookup_indexed_color(face->background, f); + bm_color = [NSColor colorWithUnsignedLong:face->background]; else bm_color = f->output_data.ns->cursor_color; @@ -3134,7 +3082,7 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. ns_focus (f, &r, 1); if (face) - [ns_lookup_indexed_color(face->foreground, f) set]; + [[NSColor colorWithUnsignedLong:face->foreground] set]; NSRectFill(r); ns_unfocus (f); @@ -3170,29 +3118,29 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. /* A vertical divider, at least three pixels wide: Draw first and last pixels differently. */ { - [ns_lookup_indexed_color(color_first, f) set]; + [[NSColor colorWithUnsignedLong:color_first] set]; NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0)); - [ns_lookup_indexed_color(color, f) set]; + [[NSColor colorWithUnsignedLong:color] set]; NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0)); - [ns_lookup_indexed_color(color_last, f) set]; + [[NSColor colorWithUnsignedLong:color_last] set]; NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0)); } else if ((x1 - x0 > y1 - y0) && (y1 - y0 >= 3)) /* A horizontal divider, at least three pixels high: Draw first and last pixels differently. */ { - [ns_lookup_indexed_color(color_first, f) set]; + [[NSColor colorWithUnsignedLong:color_first] set]; NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1)); - [ns_lookup_indexed_color(color, f) set]; + [[NSColor colorWithUnsignedLong:color] set]; NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2)); - [ns_lookup_indexed_color(color_last, f) set]; + [[NSColor colorWithUnsignedLong:color_last] set]; NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1)); } else { /* In any other case do not draw the first and last pixels differently. */ - [ns_lookup_indexed_color(color, f) set]; + [[NSColor colorWithUnsignedLong:color] set]; NSRectFill(divider); } @@ -3305,7 +3253,7 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. if (s->face->underline == FACE_UNDER_WAVE) { if (!face->underline_defaulted_p) - [ns_lookup_indexed_color (face->underline_color, s->f) set]; + [[NSColor colorWithUnsignedLong:face->underline_color] set]; ns_draw_underwave (s, width, x); } @@ -3379,7 +3327,8 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. r = NSMakeRect (x, s->ybase + position, width, thickness); if (!face->underline_defaulted_p) - [ns_lookup_indexed_color (face->underline_color, s->f) set]; + [[NSColor colorWithUnsignedLong:face->underline_color] set]; + NSRectFill (r); } } @@ -3391,7 +3340,7 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. r = NSMakeRect (x, s->y, width, 1); if (!face->overline_color_defaulted_p) - [ns_lookup_indexed_color (face->overline_color, s->f) set]; + [[NSColor colorWithUnsignedLong:face->overline_color] set]; NSRectFill (r); } @@ -3416,7 +3365,7 @@ larger if there are taller display elements (e.g., characters r = NSMakeRect (x, glyph_y + dy, width, 1); if (!face->strike_through_color_defaulted_p) - [ns_lookup_indexed_color (face->strike_through_color, s->f) set]; + [[NSColor colorWithUnsignedLong:face->strike_through_color] set]; NSRectFill (r); } @@ -3475,7 +3424,7 @@ larger if there are taller display elements (e.g., characters if (s->face->use_box_color_for_shadows_p) { - newBaseCol = ns_lookup_indexed_color (s->face->box_color, s->f); + newBaseCol = [NSColor colorWithUnsignedLong:s->face->box_color]; } /* else if (s->first_glyph->type == IMAGE_GLYPH && s->img->pixmap @@ -3485,7 +3434,7 @@ larger if there are taller display elements (e.g., characters } */ else { - newBaseCol = ns_lookup_indexed_color (s->face->background, s->f); + newBaseCol = [NSColor colorWithUnsignedLong:s->face->background]; } if (newBaseCol == nil) @@ -3607,7 +3556,7 @@ Function modeled after x_draw_glyph_string_box (). if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) { ns_draw_box (r, abs (hthickness), abs (vthickness), - ns_lookup_indexed_color (face->box_color, s->f), + [NSColor colorWithUnsignedLong:face->box_color], left_p, right_p); } else @@ -3644,7 +3593,7 @@ Function modeled after x_draw_glyph_string_box (). { if (s->hl != DRAW_CURSOR) [(NS_FACE_BACKGROUND (face) != 0 - ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) + ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] : FRAME_BACKGROUND_COLOR (s->f)) set]; else [FRAME_CURSOR_COLOR (s->f) set]; @@ -3701,7 +3650,7 @@ Function modeled after x_draw_glyph_string_box (). otherwise, since we composite the image under NS (instead of mucking with its background color), we must clear just the image area. */ - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set]; + [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin || s->img->mask || s->img->pixmap == 0 || s->width != s->background_width) @@ -3771,11 +3720,11 @@ Function modeled after x_draw_glyph_string_box (). if (s->hl == DRAW_CURSOR) { [FRAME_CURSOR_COLOR (s->f) set]; - tdCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); + tdCol = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]; } else { - tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); + tdCol = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)]; } /* Draw underline, overline, strike-through. */ @@ -3832,8 +3781,8 @@ Function modeled after x_draw_glyph_string_box (). face = s->face; - bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); - fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); + bgCol = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]; + fgCol = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)]; if (s->hl == DRAW_CURSOR) { @@ -4067,8 +4016,7 @@ Function modeled after x_draw_glyph_string_box (). { NSColor *col = (NS_FACE_FOREGROUND (s->face) != 0 - ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (s->face), - s->f) + ? [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (s->face)] : FRAME_FOREGROUND_COLOR (s->f)); /* Draw underline, overline, strike-through. */ @@ -4103,7 +4051,7 @@ Function modeled after x_draw_glyph_string_box (). { NSColor *fg_color; - fg_color = ns_lookup_indexed_color (NS_FACE_FOREGROUND (s->face), s->f); + fg_color = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (s->face)]; ns_draw_text_decoration (s, s->face, fg_color, s->background_width, s->x); } @@ -4922,7 +4870,6 @@ static Lisp_Object ns_string_to_lispmod (const char *s) && ![NSCalibratedWhiteColorSpace isEqualToString: NSColorSpaceFromDepth (depth)]; dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); - dpyinfo->color_table = [[NSMutableArray array] retain]; dpyinfo->root_window = 42; /* A placeholder. */ dpyinfo->highlight_frame = dpyinfo->ns_focus_frame = NULL; dpyinfo->n_fonts = 0; @@ -4998,7 +4945,6 @@ static Lisp_Object ns_string_to_lispmod (const char *s) ns_delete_display (struct ns_display_info *dpyinfo) { /* TODO... */ - [dpyinfo->color_table release]; } @@ -5211,8 +5157,9 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. color = XCAR (color_map); name = XCAR (color); c = XFIXNUM (XCDR (color)); + c |= 0xFF000000; [cl setColor: - [NSColor colorWithUnsignedLong:c hasAlpha:NO] + [NSColor colorWithUnsignedLong:c] forKey: [NSString stringWithLispString: name]]; } @@ -7610,9 +7557,8 @@ - (void)toggleFullScreen: (id)sender onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]]; f = emacsframe; wr = [w frame]; - col = ns_lookup_indexed_color (NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID)), - f); + col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID))]; if (fs_state != FULLSCREEN_BOTH) { @@ -8360,9 +8306,8 @@ - (instancetype) initWithEmacsFrame:(struct frame *)f f->border_width = [self borderWidth]; - col = ns_lookup_indexed_color (NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID)), - f); + col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID))]; [self setBackgroundColor:col]; if ([col alphaComponent] != (EmacsCGFloat) 1.0) [self setOpaque:NO]; diff --git a/src/xdisp.c b/src/xdisp.c index f4dcb1838d..1f896c256e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22478,7 +22478,7 @@ extend_face_to_end_of_line (struct it *it) && face->underline == FACE_NO_UNDERLINE && !face->overline_p && !face->strike_through_p - && FACE_COLOR_TO_PIXEL (face->background, f) == FRAME_BACKGROUND_PIXEL (f) + && face->background == FRAME_BACKGROUND_PIXEL (f) #ifdef HAVE_WINDOW_SYSTEM && !face->stipple #endif @@ -22712,7 +22712,7 @@ extend_face_to_end_of_line (struct it *it) && (it->glyph_row->used[LEFT_MARGIN_AREA] < WINDOW_LEFT_MARGIN_WIDTH (it->w)) && !it->glyph_row->mode_line_p - && FACE_COLOR_TO_PIXEL (face->background, f) != FRAME_BACKGROUND_PIXEL (f)) + && face->background != FRAME_BACKGROUND_PIXEL (f)) { struct glyph *g = it->glyph_row->glyphs[LEFT_MARGIN_AREA]; struct glyph *e = g + it->glyph_row->used[LEFT_MARGIN_AREA]; @@ -22783,7 +22783,7 @@ extend_face_to_end_of_line (struct it *it) && (it->glyph_row->used[RIGHT_MARGIN_AREA] < WINDOW_RIGHT_MARGIN_WIDTH (it->w)) && !it->glyph_row->mode_line_p - && FACE_COLOR_TO_PIXEL (face->background, f) != FRAME_BACKGROUND_PIXEL (f)) + && face->background != FRAME_BACKGROUND_PIXEL (f)) { struct glyph *g = it->glyph_row->glyphs[RIGHT_MARGIN_AREA]; struct glyph *e = g + it->glyph_row->used[RIGHT_MARGIN_AREA]; commit 0f427befe82f88237bdccbd528baf76f6d6485b0 Author: Alan Third Date: Sat Aug 14 16:11:30 2021 +0100 Simplify NS color handling * src/image.c (RGB_TO_ULONG): (ARGB_TO_ULONG): (RED_FROM_ULONG): (RED16_FROM_ULONG): (GREEN16_FROM_ULONG): (BLUE16_FROM_ULONG): Define these here for NS too. * src/nsfns.m (ns_set_foreground_color): (ns_set_background_color): Use new EmacsColor methods. * src/nsterm.h (struct ns_color_table): Replace this struct with a built-in Objective C type. (RGB_TO_ULONG): (ARGB_TO_ULONG): (ALPHA_FROM_ULONG): (RED_FROM_ULONG): (GREEN_FROM_ULONG): (BLUE_FROM_ULONG): (RED16_FROM_ULONG): (GREEN16_FROM_ULONG): (BLUE16_FROM_ULONG): These are no longer needed in the NS specific code. (struct ns_display_info): Use an NSMutableArray instead of a custom struct. * src/nsterm.m ([NSColor colorWithUnsignedLong:hasAlpha:]): ([NSColor unsignedLong]): New methods. (ns_lookup_indexed_color): (ns_index_color): Use the NSMutableArray lookup table. (ns_term_init): (ns_color_index_to_rgba): (ns_query_color): Use the new EmacsColor methods. (ns_initialize_display_info): (ns_delete_display): Initialize and release the NSMutableArray lookup table. diff --git a/src/image.c b/src/image.c index dd5ea19fc1..dc9aae27c9 100644 --- a/src/image.c +++ b/src/image.c @@ -80,14 +80,7 @@ typedef struct x_bitmap_record Bitmap_Record; #endif /* !USE_CAIRO */ #endif /* HAVE_X_WINDOWS */ -#ifdef USE_CAIRO -#define GET_PIXEL image_pix_context_get_pixel -#define PUT_PIXEL image_pix_container_put_pixel -#define NO_PIXMAP 0 - -#define PIX_MASK_RETAIN 0 -#define PIX_MASK_DRAW 255 - +#if defined(USE_CAIRO) || defined(HAVE_NS) #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b)) #define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define RED_FROM_ULONG(color) (((color) >> 16) & 0xff) @@ -96,6 +89,15 @@ typedef struct x_bitmap_record Bitmap_Record; #define RED16_FROM_ULONG(color) (RED_FROM_ULONG (color) * 0x101) #define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG (color) * 0x101) #define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG (color) * 0x101) +#endif + +#ifdef USE_CAIRO +#define GET_PIXEL image_pix_context_get_pixel +#define PUT_PIXEL image_pix_container_put_pixel +#define NO_PIXMAP 0 + +#define PIX_MASK_RETAIN 0 +#define PIX_MASK_DRAW 255 static unsigned long image_alloc_image_color (struct frame *, struct image *, Lisp_Object, unsigned long); diff --git a/src/nsfns.m b/src/nsfns.m index 81019fce09..365df7fc1e 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -236,7 +236,6 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. ns_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { NSColor *col; - EmacsCGFloat r, g, b, alpha; /* Must block_input, because ns_lisp_to_color does block/unblock_input which means that col may be deallocated in its unblock_input if there @@ -253,12 +252,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. [f->output_data.ns->foreground_color release]; f->output_data.ns->foreground_color = col; - [col getRed: &r green: &g blue: &b alpha: &alpha]; - FRAME_FOREGROUND_PIXEL (f) = - ARGB_TO_ULONG ((unsigned long) (alpha * 0xff), - (unsigned long) (r * 0xff), - (unsigned long) (g * 0xff), - (unsigned long) (b * 0xff)); + FRAME_FOREGROUND_PIXEL (f) = [col unsignedLong]; if (FRAME_NS_VIEW (f)) { @@ -277,7 +271,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. struct face *face; NSColor *col; NSView *view = FRAME_NS_VIEW (f); - EmacsCGFloat r, g, b, alpha; + EmacsCGFloat alpha; block_input (); if (ns_lisp_to_color (arg, &col)) @@ -291,12 +285,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. [f->output_data.ns->background_color release]; f->output_data.ns->background_color = col; - [col getRed: &r green: &g blue: &b alpha: &alpha]; - FRAME_BACKGROUND_PIXEL (f) = - ARGB_TO_ULONG ((unsigned long) (alpha * 0xff), - (unsigned long) (r * 0xff), - (unsigned long) (g * 0xff), - (unsigned long) (b * 0xff)); + FRAME_BACKGROUND_PIXEL (f) = [col unsignedLong]; + alpha = [col alphaComponent]; if (view != nil) { diff --git a/src/nsterm.h b/src/nsterm.h index ce8f594902..8bd7611441 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -358,7 +358,7 @@ typedef id instancetype; + (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; - (NSColor *)colorUsingDefaultColorSpace; - +- (unsigned long)unsignedLong; @end @@ -766,35 +766,6 @@ struct ns_bitmap_record int height, width, depth; }; -/* This maps between emacs color indices and NSColor objects. */ -struct ns_color_table -{ - ptrdiff_t size; - ptrdiff_t avail; -#ifdef __OBJC__ - NSColor **colors; - NSMutableSet *empty_indices; -#else - void **items; - void *availIndices; -#endif -}; -#define NS_COLOR_CAPACITY 256 - -#define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b)) -#define ARGB_TO_ULONG(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) - -#define ALPHA_FROM_ULONG(color) ((color) >> 24) -#define RED_FROM_ULONG(color) (((color) >> 16) & 0xff) -#define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff) -#define BLUE_FROM_ULONG(color) ((color) & 0xff) - -/* Do not change `* 0x101' in the following lines to `<< 8'. If - changed, image masks in 1-bit depth will not work. */ -#define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101) -#define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101) -#define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101) - #ifdef NS_IMPL_GNUSTEP /* this extends font backend font */ struct nsfont_info @@ -850,7 +821,11 @@ struct ns_display_info ptrdiff_t bitmaps_size; ptrdiff_t bitmaps_last; - struct ns_color_table *color_table; +#ifdef __OBJC__ + NSMutableArray *color_table; +#else + void *color_table; +#endif /* DPI resolution of this screen */ double resx, resy; diff --git a/src/nsterm.m b/src/nsterm.m index 4e5ce5ef70..12f24fbfd5 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -166,6 +166,29 @@ - (NSColor *)colorUsingDefaultColorSpace return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]]; } ++ (NSColor *)colorWithUnsignedLong:(unsigned long)c + hasAlpha:(BOOL)alpha +{ + EmacsCGFloat a = (double)((c >> 24) & 0xff) / 255.0; + EmacsCGFloat r = (double)((c >> 16) & 0xff) / 255.0; + EmacsCGFloat g = (double)((c >> 8) & 0xff) / 255.0; + EmacsCGFloat b = (double)(c & 0xff) / 255.0; + + return [NSColor colorForEmacsRed:r green:g blue:b + alpha:(alpha ? a : (EmacsCGFloat)1.0)]; +} + +- (unsigned long)unsignedLong +{ + EmacsCGFloat r, g, b, a; + [self getRed:&r green:&g blue:&b alpha:&a]; + + return (((unsigned long) (a * 255)) << 24) + | (((unsigned long) (r * 255)) << 16) + | (((unsigned long) (g * 255)) << 8) + | ((unsigned long) (b * 255)); +} + @end /* ========================================================================== @@ -1952,53 +1975,29 @@ Hide the window (X11 semantics) NSColor * ns_lookup_indexed_color (unsigned long idx, struct frame *f) { - struct ns_color_table *color_table = FRAME_DISPLAY_INFO (f)->color_table; - if (idx < 1 || idx >= color_table->avail) + NSMutableArray *color_table = FRAME_DISPLAY_INFO (f)->color_table; + if (idx < 1 || idx >= [color_table count]) return nil; - return color_table->colors[idx]; + return [color_table objectAtIndex:idx]; } unsigned long ns_index_color (NSColor *color, struct frame *f) { - struct ns_color_table *color_table = FRAME_DISPLAY_INFO (f)->color_table; - ptrdiff_t idx; - ptrdiff_t i; + NSMutableArray *color_table = FRAME_DISPLAY_INFO (f)->color_table; - if (!color_table->colors) - { - color_table->size = NS_COLOR_CAPACITY; - color_table->avail = 1; /* skip idx=0 as marker */ - color_table->colors = xmalloc (color_table->size * sizeof (NSColor *)); - color_table->colors[0] = nil; - color_table->empty_indices = [[NSMutableSet alloc] init]; - } + /* An index of 0 appears to be special in some way, so insert a + dummy object. */ + if ([color_table count] == 0) + [color_table addObject:[NSNull null]]; /* Do we already have this color? */ - for (i = 1; i < color_table->avail; i++) - if (color_table->colors[i] && [color_table->colors[i] isEqual: color]) - return i; - - if ([color_table->empty_indices count] > 0) - { - NSNumber *index = [color_table->empty_indices anyObject]; - [color_table->empty_indices removeObject: index]; - idx = [index unsignedLongValue]; - } - else - { - if (color_table->avail == color_table->size) - color_table->colors = - xpalloc (color_table->colors, &color_table->size, 1, - min (ULONG_MAX, PTRDIFF_MAX), sizeof *color_table->colors); - idx = color_table->avail++; - } + if ([color_table containsObject:color]) + return [color_table indexOfObject:color]; - color_table->colors[idx] = color; - [color retain]; - /* fprintf(stderr, "color_table: allocated %d\n",idx); */ - return idx; + [color_table addObject:color]; + return [color_table count] - 1; } @@ -2136,13 +2135,7 @@ Hide the window (X11 semantics) NSColor *col; col = ns_lookup_indexed_color (idx, f); - EmacsCGFloat r, g, b, a; - [col getRed: &r green: &g blue: &b alpha: &a]; - - return ARGB_TO_ULONG((unsigned long) (a * 255), - (unsigned long) (r * 255), - (unsigned long) (g * 255), - (unsigned long) (b * 255)); + return [col unsignedLong]; } void @@ -2161,11 +2154,7 @@ Hide the window (X11 semantics) color_def->blue = b * 65535; if (setPixel == YES) - color_def->pixel - = ARGB_TO_ULONG((unsigned long) (a * 255), - (unsigned long) (r * 255), - (unsigned long) (g * 255), - (unsigned long) (b * 255)); + color_def->pixel = [(NSColor *)col unsignedLong]; } bool @@ -4933,8 +4922,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) && ![NSCalibratedWhiteColorSpace isEqualToString: NSColorSpaceFromDepth (depth)]; dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth); - dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table); - dpyinfo->color_table->colors = NULL; + dpyinfo->color_table = [[NSMutableArray array] retain]; dpyinfo->root_window = 42; /* A placeholder. */ dpyinfo->highlight_frame = dpyinfo->ns_focus_frame = NULL; dpyinfo->n_fonts = 0; @@ -5010,6 +4998,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) ns_delete_display (struct ns_display_info *dpyinfo) { /* TODO... */ + [dpyinfo->color_table release]; } @@ -5223,10 +5212,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. name = XCAR (color); c = XFIXNUM (XCDR (color)); [cl setColor: - [NSColor colorForEmacsRed: RED_FROM_ULONG (c) / 255.0 - green: GREEN_FROM_ULONG (c) / 255.0 - blue: BLUE_FROM_ULONG (c) / 255.0 - alpha: 1.0] + [NSColor colorWithUnsignedLong:c hasAlpha:NO] forKey: [NSString stringWithLispString: name]]; } commit 5b0121b708986c836fa970b800387363806a035a Author: Jonas Bernoulli Date: Wed Dec 22 20:03:00 2021 +0100 Help outline-minor-mode avoid some false matches * lisp/international/emoji.el (emoji--generate-file): Help 'outline-minor-mode' avoid false matches by quoting certain characters when they appear at bol in a multi-line string. diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index cab524e24b..b78e122aa1 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -426,9 +426,9 @@ the name is not known." ;; no-update-autoloads: t ;; End: -(provide 'emoji-labels) +\(provide 'emoji-labels) -;;; emoji-labels.el ends here\n") +\;;; emoji-labels.el ends here\n") (write-region (point-min) (point-max) file))) (defun emoji--base-name (name derivations) commit 7be73593b4b7d65342263d3bac2558aa27dfb175 Author: Jonas Bernoulli Date: Wed Dec 22 20:02:00 2021 +0100 Hide transient prefix/suffix commands from execute-extended-command * lisp/international/emoji.el (emoji--define-transient): Hide transient prefix/suffix commands from 'execute-extended-command' by declaring that they should only be listed in the non-existent 'not-a-mode' mode. diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index cd6684c3f6..cab524e24b 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -535,7 +535,7 @@ the name is not known." t end-function)) ;; Insert the emoji. (lambda () - (interactive) + (interactive nil not-a-mode) ;; Allow switching to the correct ;; buffer. (when end-function @@ -548,7 +548,7 @@ the name is not known." ;; There's probably a better way to do this... (setf (symbol-function name) (lambda () - (interactive) + (interactive nil not-a-mode) (transient-setup name))) (pcase-let ((`(,class ,slots ,suffixes ,docstr ,_body) (transient--expand-define-args (list args)))) commit 8d0efd87e19d1f7abc8bd322f94ad32fdedde3b9 Author: Michael Albinus Date: Wed Dec 22 18:13:18 2021 +0100 Fix some Tramp tests * test/lisp/net/tramp-tests.el (tramp-test07-file-exists-p) (tramp-test14-delete-directory, tramp-test29-start-file-process) (tramp-test30-make-process): Adapt tests. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 9c65f9a635..eeb29314cc 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2338,8 +2338,10 @@ This checks also `file-name-as-directory', `file-name-directory', (delete-file tmp-name) (should-not (file-exists-p tmp-name)) - ;; Trashing files doesn't work on MS Windows, and for crypted remote files. - (unless (or (tramp--test-windows-nt-p) (tramp--test-crypt-p)) + ;; Trashing files doesn't work when `system-move-file-to-trash' + ;; is defined (on MS Windows and macOS), and for crypted remote + ;; files. + (unless (or (fboundp 'system-move-file-to-trash) (tramp--test-crypt-p)) (let ((trash-directory (tramp--test-make-temp-name 'local quoted)) (delete-by-moving-to-trash t)) (make-directory trash-directory) @@ -2858,9 +2860,12 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (should-not (file-directory-p tmp-name1)) ;; Trashing directories works only since Emacs 27.1. It doesn't - ;; work on MS Windows, for crypted remote directories and for ange-ftp. - (when (and (not (tramp--test-windows-nt-p)) (not (tramp--test-crypt-p)) - (not (tramp--test-ftp-p)) (tramp--test-emacs27-p)) + ;; work when `system-move-file-to-trash' is defined (on MS + ;; Windows and macOS), for crypted remote directories and for + ;; ange-ftp. + (when (and (not (fboundp 'system-move-file-to-trash)) + (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p)) + (tramp--test-emacs27-p)) (let ((trash-directory (tramp--test-make-temp-name 'local quoted)) (delete-by-moving-to-trash t)) (make-directory trash-directory) @@ -4586,8 +4591,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-process proc))) - ;; "telnet" and "sshfs" do not cooperate with disabled filter. - (unless (or (tramp--test-telnet-p) (tramp--test-sshfs-p)) + ;; Disabled process filter. "sshfs" does not cooperate. + (unless (tramp--test-sshfs-p) (unwind-protect (with-temp-buffer (setq proc (start-file-process "test3" (current-buffer) "cat")) @@ -4596,8 +4601,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (set-process-filter proc t) (process-send-string proc "foo\n") (process-send-eof proc) - ;; Read output. - (with-timeout (10 (tramp--test-timeout-handler)) + ;; Read output. There shouldn't be any. + (with-timeout (10) (while (process-live-p proc) (while (accept-process-output proc 0 nil t)))) ;; No output due to process filter. @@ -4778,8 +4783,8 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." ;; Cleanup. (ignore-errors (delete-process proc))) - ;; "telnet" and "sshfs" do not cooperate with disabled filter. - (unless (or (tramp--test-telnet-p) (tramp--test-sshfs-p)) + ;; Disabled process filter. "sshfs" does not cooperate. + (unless (tramp--test-sshfs-p) (unwind-protect (with-temp-buffer (setq proc @@ -4792,8 +4797,8 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." (should (equal (process-status proc) 'run)) (process-send-string proc "foo\n") (process-send-eof proc) - ;; Read output. - (with-timeout (10 (tramp--test-timeout-handler)) + ;; Read output. There shouldn't be any. + (with-timeout (10) (while (process-live-p proc) (while (accept-process-output proc 0 nil t)))) ;; No output due to process filter. commit ccba86be78586d4b16da288bcc6b3c473b9fd422 Author: Mattias EngdegÄrd Date: Wed Dec 22 16:32:04 2021 +0100 Use unibyte strings in ntlm auth requests and responses * lisp/net/ntlm.el (ntlm-build-auth-request) (ntlm-build-auth-response): Make sure to use unibyte strings for bytes greater than 127, or base64 encoding will fail. This should fix failures in ntlm-tests. diff --git a/lisp/net/ntlm.el b/lisp/net/ntlm.el index 0e0146df96..fed93ddf70 100644 --- a/lisp/net/ntlm.el +++ b/lisp/net/ntlm.el @@ -102,9 +102,7 @@ is not given." (let ((request-ident (concat "NTLMSSP" (make-string 1 0))) (request-msgType (concat (make-string 1 1) (make-string 3 0))) ;0x01 0x00 0x00 0x00 - (request-flags (concat (make-string 1 7) (make-string 1 130) - (make-string 1 8) (make-string 1 0))) - ;0x07 0x82 0x08 0x00 + (request-flags (unibyte-string #x07 #x82 #x08 #x00)) ) (when (and user (string-match "@" user)) (unless domain @@ -245,9 +243,7 @@ by PASSWORD-HASHES. PASSWORD-HASHES should be a return value of ;;(msgType (substring rchallenge 8 12)) ;msgType, 4 bytes (uDomain (substring rchallenge 12 20)) ;uDomain, 8 bytes ;; match default setting in `ntlm-build-auth-request' - (request-flags (concat (make-string 1 7) (make-string 1 130) - (make-string 1 8) (make-string 1 0))) - ;0x07 0x82 0x08 0x00 + (request-flags (unibyte-string #x07 #x82 #x08 #x00)) (flags (substring rchallenge 20 24)) ;flags, 4 bytes (challengeData (substring rchallenge 24 32)) ;challengeData, 8 bytes ;; Extract domain string from challenge string. commit ca5c527ade1446522ef4854467539ec3f8885c30 Author: Eli Zaretskii Date: Wed Dec 22 16:24:56 2021 +0200 ; * etc/NEWS: Fix a recently-added entry. diff --git a/etc/NEWS b/etc/NEWS index f41d49e224..ff01ab7ac1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -301,9 +301,10 @@ case keys. This command increases (or decreases) the number of empty lines before point. -** The *Completions* buffer can now be automatically selected +** The *Completions* buffer can now be automatically selected. To enable this behavior, customize the option 'completion-auto-select' -to t. +to t. Then pressing TAB will switch to the *Completions* buffer when +it pops up that buffer. --- *** Improved mouse behavior with auto-scrolling modes. commit b7faac0fef50b9fb48cc30dcfa0f2585d28a6e2a Author: Lars Ingebrigtsen Date: Wed Dec 22 15:19:41 2021 +0100 Adjust test after recent help.el change diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 281d97ee92..715d9e5b8a 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el @@ -122,6 +122,7 @@ SPC minibuffer-complete-word C- file-cache-minibuffer-complete previous-history-element next-history-element + minibuffer-complete next-line-or-history-element next-history-element switch-to-completions commit 3dbe7caed744fe95b855d56bc2f8ebe97788133c Author: Po Lu Date: Wed Dec 22 21:36:00 2021 +0800 * src/pgtkterm.c (scroll_event): Fix scroll delta scale. diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 74ecde0979..74a71b984c 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -6141,8 +6141,8 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) inev.ie.modifiers |= (inev.ie.kind == HORIZ_WHEEL_EVENT ? (delta_x >= 0 ? down_modifier : up_modifier) : (delta_y >= 0 ? down_modifier : up_modifier)); - inev.ie.arg = list3 (Qnil, make_float (delta_x), - make_float (-delta_y)); + inev.ie.arg = list3 (Qnil, make_float (delta_x * 100), + make_float (-delta_y * 100)); } else { commit 551fe22557e81223cb048437cf0e7fe854a563f2 Author: Po Lu Date: Wed Dec 22 21:32:14 2021 +0800 * src/pgtkterm.c (scroll_event): Fix sign of delta_y. diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 24203ea982..74ecde0979 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -6142,7 +6142,7 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) ? (delta_x >= 0 ? down_modifier : up_modifier) : (delta_y >= 0 ? down_modifier : up_modifier)); inev.ie.arg = list3 (Qnil, make_float (delta_x), - make_float (delta_y)); + make_float (-delta_y)); } else { commit 4154a85d813d94726fbcc5adb824d42d234786c6 Author: Po Lu Date: Wed Dec 22 18:37:31 2021 +0800 Disable by default and add NEWS entry to the new completion behavior * etc/NEWS: Announce 'completion-auto-select'. * lisp/simple.el (completion-auto-select): Default to nil. diff --git a/etc/NEWS b/etc/NEWS index 57fe40c488..f41d49e224 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -301,6 +301,10 @@ case keys. This command increases (or decreases) the number of empty lines before point. +** The *Completions* buffer can now be automatically selected +To enable this behavior, customize the option 'completion-auto-select' +to t. + --- *** Improved mouse behavior with auto-scrolling modes. When clicking inside the 'scroll-margin' or 'hscroll-margin' region diff --git a/lisp/simple.el b/lisp/simple.el index eb21814a3d..13fbc6ac39 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9259,7 +9259,7 @@ Called from `temp-buffer-show-hook'." :version "22.1" :group 'completion) -(defcustom completion-auto-select t +(defcustom completion-auto-select nil "Non-nil means to automatically select the completions buffer." :type 'boolean :version "29.1" commit 29fffbdd87391272e9131be63cf93f5067d6ae0d (refs/remotes/origin/emacs-28) Author: Lars Ingebrigtsen Date: Wed Dec 22 13:56:47 2021 +0100 Revert field-related thingatpt changes This reverts 7db376e560448e61485ba054def8c82b21f33d6a, which led to severe performance regressions when being run in large buffers with no fields (bug#52593) diff --git a/etc/NEWS b/etc/NEWS index 02b6f665b0..1664ccfd04 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3038,7 +3038,6 @@ checkdoc will now check the format of 'yes-or-no-p'. *** New command 'checkdoc-dired'. This can be used to run checkdoc on files from a Dired buffer. ---- *** No longer checks for 'A-' modifiers. Checkdoc recommends usage of command substitutions ("\\[foo-command]") in favor of writing keybindings like 'C-c f'. It now no longer warns diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 32e66184d7..4d3e68ec9c 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -162,30 +162,24 @@ Possibilities include `symbol', `list', `sexp', `defun', When the optional argument NO-PROPERTIES is non-nil, strip text properties from the return value. -If the current buffer uses fields (see Info node `(elisp)Fields'), -this function will narrow to the field before identifying the -thing at point. - See the file `thingatpt.el' for documentation on how to define a symbol as a valid THING." - (save-restriction - (narrow-to-region (field-beginning) (field-end)) - (let ((text - (cond - ((cl-loop for (pthing . function) in thing-at-point-provider-alist - when (eq pthing thing) - for result = (funcall function) - when result - return result)) - ((get thing 'thing-at-point) - (funcall (get thing 'thing-at-point))) - (t - (let ((bounds (bounds-of-thing-at-point thing))) - (when bounds - (buffer-substring (car bounds) (cdr bounds)))))))) - (when (and text no-properties (sequencep text)) - (set-text-properties 0 (length text) nil text)) - text))) + (let ((text + (cond + ((cl-loop for (pthing . function) in thing-at-point-provider-alist + when (eq pthing thing) + for result = (funcall function) + when result + return result)) + ((get thing 'thing-at-point) + (funcall (get thing 'thing-at-point))) + (t + (let ((bounds (bounds-of-thing-at-point thing))) + (when bounds + (buffer-substring (car bounds) (cdr bounds)))))))) + (when (and text no-properties (sequencep text)) + (set-text-properties 0 (length text) nil text)) + text)) ;;;###autoload (defun bounds-of-thing-at-mouse (event thing) diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index 2a32dc57b1..dc108c77c5 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -223,12 +223,4 @@ position to retrieve THING.") (should (equal (test--number "0xf00" 2) 3840)) (should (equal (test--number "0xf00" 3) 3840))) -(ert-deftest test-fields () - (with-temp-buffer - (insert (propertize "foo" 'field 1) "bar" (propertize "zot" 'field 2)) - (goto-char 1) - (should (eq (symbol-at-point) 'foo)) - (goto-char 5) - (should (eq (symbol-at-point) 'bar)))) - ;;; thingatpt-tests.el ends here commit 70266929c3eb173fae0c64d56f8d402a805ca786 Author: Lars Ingebrigtsen Date: Wed Dec 22 13:34:15 2021 +0100 Simplify disabled-command-function prompting * lisp/novice.el (disabled-command-function): Use a prompt for `read-event' instead of messaging it, so that people using Emacspeak get the prompt read to them. diff --git a/lisp/novice.el b/lisp/novice.el index 16766c253c..a4d043574a 100644 --- a/lisp/novice.el +++ b/lisp/novice.el @@ -88,14 +88,13 @@ SPC to try the command just this once, but leave it disabled. ;; (help-mode)) ) (fit-window-to-buffer (get-buffer-window "*Disabled Command*")) - (message "Type y, n, ! or SPC (the space bar): ") (let ((cursor-in-echo-area t)) - (while (progn (setq char (read-event)) + (while (progn (setq char (read-event + "Type y, n, ! or SPC (the space bar): ")) (or (not (numberp char)) (not (memq (downcase char) '(?! ?y ?n ?\s ?\C-g))))) - (ding) - (message "Please type y, n, ! or SPC (the space bar): ")))) + (ding)))) (setq char (downcase char)) (pcase char (?\C-g (setq quit-flag t)) commit dbd0eef0c7c412583e5c5ca1d0d256a5f5490c10 Author: Lars Ingebrigtsen Date: Wed Dec 22 13:00:55 2021 +0100 Use pop-to-buffer-same-window in `M-x term' * lisp/term.el (term): Allow `display-buffer*' customization to take effect (bug#52688). diff --git a/lisp/term.el b/lisp/term.el index 698bef08b2..e0a2f0a9a4 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1532,7 +1532,7 @@ commands to use in that buffer. shell-file-name)))) (set-buffer (make-term "terminal" program)) (term-char-mode) - (switch-to-buffer "*terminal*")) + (pop-to-buffer-same-window "*terminal*")) (defun term-exec (buffer name command startfile switches) "Start up a process in buffer for term modes. commit 141bf182da0043c9273b7885e687cfea7f6268b0 Author: Po Lu Date: Wed Dec 22 17:29:27 2021 +0800 Fix horizontal scrolling on PGTK * src/pgtkterm.c (scroll_event): Fix for when `mwheel-coalesce-scroll-events' is nil. diff --git a/src/pgtkterm.c b/src/pgtkterm.c index bd61c65edd..24203ea982 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -6133,78 +6133,64 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) } else if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y)) { - dpyinfo->scroll.acc_x += delta_x; - dpyinfo->scroll.acc_y += delta_y; - if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line - || !mwheel_coalesce_scroll_events) + if (!mwheel_coalesce_scroll_events) { - int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line; - inev.ie.kind = WHEEL_EVENT; - inev.ie.modifiers |= down_modifier; - inev.ie.arg = list3 (make_fixnum (nlines), - make_float (-dpyinfo->scroll.acc_x * 100), - make_float (-dpyinfo->scroll.acc_y * 100)); - if (!mwheel_coalesce_scroll_events) - { - dpyinfo->scroll.acc_y = 0; - dpyinfo->scroll.acc_x = 0; - } - else + inev.ie.kind = ((fabs (delta_x) > fabs (delta_y)) + ? HORIZ_WHEEL_EVENT + : WHEEL_EVENT); + inev.ie.modifiers |= (inev.ie.kind == HORIZ_WHEEL_EVENT + ? (delta_x >= 0 ? down_modifier : up_modifier) + : (delta_y >= 0 ? down_modifier : up_modifier)); + inev.ie.arg = list3 (Qnil, make_float (delta_x), + make_float (delta_y)); + } + else + { + dpyinfo->scroll.acc_x += delta_x; + dpyinfo->scroll.acc_y += delta_y; + if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line) { + int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line; + inev.ie.kind = WHEEL_EVENT; + inev.ie.modifiers |= down_modifier; + inev.ie.arg = list3 (make_fixnum (nlines), + make_float (-dpyinfo->scroll.acc_x * 100), + make_float (-dpyinfo->scroll.acc_y * 100)); dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines; } - } - else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line - || !mwheel_coalesce_scroll_events) - { - int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line; - inev.ie.kind = WHEEL_EVENT; - inev.ie.modifiers |= up_modifier; - inev.ie.arg = list3 (make_fixnum (nlines), - make_float (-dpyinfo->scroll.acc_x * 100), - make_float (-dpyinfo->scroll.acc_y * 100)); - - if (!mwheel_coalesce_scroll_events) + else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line) { - dpyinfo->scroll.acc_y = 0; - dpyinfo->scroll.acc_x = 0; + int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line; + inev.ie.kind = WHEEL_EVENT; + inev.ie.modifiers |= up_modifier; + inev.ie.arg = list3 (make_fixnum (nlines), + make_float (-dpyinfo->scroll.acc_x * 100), + make_float (-dpyinfo->scroll.acc_y * 100)); + + dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines; } - else - dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines; - } - else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char - || !mwheel_coalesce_scroll_events) - { - int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char; - inev.ie.kind = HORIZ_WHEEL_EVENT; - inev.ie.modifiers |= up_modifier; - inev.ie.arg = list3 (make_fixnum (nchars), - make_float (-dpyinfo->scroll.acc_x * 100), - make_float (-dpyinfo->scroll.acc_y * 100)); - - if (mwheel_coalesce_scroll_events) - dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars; - else + else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char + || !mwheel_coalesce_scroll_events) { - dpyinfo->scroll.acc_x = 0; - dpyinfo->scroll.acc_y = 0; + int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char; + inev.ie.kind = HORIZ_WHEEL_EVENT; + inev.ie.modifiers |= up_modifier; + inev.ie.arg = list3 (make_fixnum (nchars), + make_float (-dpyinfo->scroll.acc_x * 100), + make_float (-dpyinfo->scroll.acc_y * 100)); + + dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars; } - } - else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char) - { - int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char; - inev.ie.kind = HORIZ_WHEEL_EVENT; - inev.ie.modifiers |= down_modifier; - inev.ie.arg = list3 (make_fixnum (nchars), - make_float (-dpyinfo->scroll.acc_x * 100), - make_float (-dpyinfo->scroll.acc_y * 100)); - - if (mwheel_coalesce_scroll_events) - dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars; - else + else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char) { - dpyinfo->scroll.acc_x = 0; - dpyinfo->scroll.acc_y = 0; + int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char; + inev.ie.kind = HORIZ_WHEEL_EVENT; + inev.ie.modifiers |= down_modifier; + inev.ie.arg = list3 (make_fixnum (nchars), + make_float (-dpyinfo->scroll.acc_x * 100), + make_float (-dpyinfo->scroll.acc_y * 100)); + + dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars; } } } commit 9bcb7326860ed8b234f8ffd8bceae866b968ff39 Author: Juri Linkov Date: Tue Dec 21 21:11:30 2021 +0200 * lisp/window.el (quit-restore-window): Select previously selected window. After deleting the dedicated window, such as a window with *Completions* buffer, select the previously selected window, like most of other 'cond' branches do in this function (bug#52491). diff --git a/lisp/window.el b/lisp/window.el index d12232641e..ce1e609874 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5167,7 +5167,10 @@ nil means to not handle the buffer in a particular way. This (cond ;; First try to delete dedicated windows that are not side windows. ((and dedicated (not (eq dedicated 'side)) - (window--delete window 'dedicated (eq bury-or-kill 'kill)))) + (window--delete window 'dedicated (eq bury-or-kill 'kill))) + ;; If the previously selected window is still alive, select it. + (when (window-live-p (nth 2 quit-restore)) + (select-window (nth 2 quit-restore)))) ((and (not prev-buffer) (eq (nth 1 quit-restore) 'tab) (eq (nth 3 quit-restore) buffer)) commit b7d31d619247d1299d8a361945dddac8659811ee Author: Robert Pluim Date: Tue Dec 21 18:39:39 2021 +0100 Revert "Remove Motif support" This reverts commit db237850abc240e2c3e765e9cc7e15ee5681dcaf. diff --git a/configure.ac b/configure.ac index 766811b8a8..357d2538e6 100644 --- a/configure.ac +++ b/configure.ac @@ -410,18 +410,19 @@ dnl This should be the last --with option, because --with-x is dnl added later on when we find the file name of X, and it's best to dnl keep them together visually. AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT], - [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, no)])], + [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, motif, no)])], [ case "${withval}" in y | ye | yes ) val=gtk ;; n | no ) val=no ;; l | lu | luc | luci | lucid ) val=lucid ;; a | at | ath | athe | athen | athena ) val=athena ;; + m | mo | mot | moti | motif ) val=motif ;; g | gt | gtk ) val=gtk ;; gtk2 ) val=gtk2 ;; gtk3 ) val=gtk3 ;; * ) AC_MSG_ERROR(['--with-x-toolkit=$withval' is invalid; -this option's value should be 'yes', 'no', 'lucid', 'athena', 'gtk', +this option's value should be 'yes', 'no', 'lucid', 'athena', 'motif', 'gtk', 'gtk2' or 'gtk3'. 'yes' and 'gtk' are synonyms. 'athena' and 'lucid' are synonyms.]) ;; @@ -460,7 +461,7 @@ OPTION_DEFAULT_ON([harfbuzz],[don't use HarfBuzz for text shaping]) OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support]) OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping]) -OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Xaw3d/GTK toolkit scroll bars]) +OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif/Xaw3d/GTK toolkit scroll bars]) OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d]) OPTION_DEFAULT_ON([xim],[at runtime, default X11 XIM to off]) OPTION_DEFAULT_ON([xdbe],[don't use X11 double buffering support]) @@ -2251,7 +2252,7 @@ if test "$window_system" = none && test "X$with_x" != "Xno"; then then AC_MSG_ERROR([You seem to be running X, but no X development libraries were found. You should install the relevant development files for X -and for the toolkit you want, such as Gtk+. Also make +and for the toolkit you want, such as Gtk+ or Motif. Also make sure you have development files for image handling, i.e. tiff, gif, jpeg, png and xpm. If you are sure you want Emacs compiled without X window support, pass diff --git a/etc/NEWS b/etc/NEWS index e7d7215902..02b6f665b0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -77,9 +77,6 @@ shaping, so 'configure' now recommends that combination. 'configure --with-xdbe=no' can now be used to disable double buffering at build time. ---- -** Support for building with Motif has been removed. - --- ** The configure option '--without-makeinfo' has been removed. This was only ever relevant when building from a repository checkout.