From fb2c44092077cfffb80ba534b70d3b462093267d Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sat, 1 Apr 2023 23:14:15 -0700 Subject: ; * lisp/progmodes/c-ts-mode.el (c++-ts-mode): Add some notice. --- lisp/progmodes/c-ts-mode.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index e2705462025..981c7766375 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -996,7 +996,11 @@ To use tree-sitter C/C++ modes by default, evaluate (add-to-list \\='major-mode-remap-alist \\='(c-or-c++-mode . c-or-c++-ts-mode)) -in your configuration." +in your configuration. + +Since this mode uses a parser, unbalanced brackets might cause +some breakage in indentation/fontification. Therefore, it's +recommended to enable `electric-pair-mode' with this mode." :group 'c++ :after-hook (c-ts-mode-set-modeline) -- cgit v1.2.1 From cb8d6ab648fa74f03b0ba1c5f33eb53e1e017f3a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 2 Apr 2023 10:34:43 +0300 Subject: * lisp/subr.el (use-dialog-box-p): Fix conditions for GUI dialogs. --- lisp/subr.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/subr.el b/lisp/subr.el index f82826e819c..cf6500d32c7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3540,7 +3540,8 @@ confusing to some users.") (defun use-dialog-box-p () "Say whether the current command should prompt the user via a dialog box." (and last-input-event ; not during startup - (or (listp last-nonmenu-event) ; invoked by a mouse event + (or (and last-nonmenu-event ; nil is listp... + (listp last-nonmenu-event)) ; invoked by a mouse event from--tty-menu-p) ; invoked via TTY menu use-dialog-box)) -- cgit v1.2.1 From 3619663f9822f7732854a13e6a890cb0925fbfaa Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 31 Mar 2023 17:54:12 +0300 Subject: Preserve peer information for web page in eww-readable The :peer property in eww-data affects the face of the page title in 'header-line-format' as set by 'eww-update-header-line-format'. Preserving this property in eww-readable avoids having the header line's appearance change when this command is called. * lisp/net/eww.el (eww-readable): Preserve eww-data's :peer property. (Bug#62574) --- lisp/net/eww.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 22b078217bd..eac47e592b2 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1012,7 +1012,7 @@ the like." (list 'base (list (cons 'href base)) (eww-highest-readability dom)) nil (current-buffer)) - (dolist (elem '(:source :url :title :next :previous :up)) + (dolist (elem '(:source :url :title :next :previous :up :peer)) (plist-put eww-data elem (plist-get old-data elem))) (eww--after-page-change))) -- cgit v1.2.1 From 82d0b6c64eaaa5d7de2bb0653cec60fabada5643 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 2 Apr 2023 11:42:43 +0300 Subject: ; * lisp/subr.el (use-dialog-box-p): Fix last change. --- lisp/subr.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lisp') diff --git a/lisp/subr.el b/lisp/subr.el index cf6500d32c7..131ed110149 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3538,10 +3538,9 @@ confusing to some users.") (defvar from--tty-menu-p nil "Non-nil means the current command was invoked from a TTY menu.") (defun use-dialog-box-p () - "Say whether the current command should prompt the user via a dialog box." + "Return non-nil if the current command should prompt the user via a dialog box." (and last-input-event ; not during startup - (or (and last-nonmenu-event ; nil is listp... - (listp last-nonmenu-event)) ; invoked by a mouse event + (or (consp last-nonmenu-event) ; invoked by a mouse event from--tty-menu-p) ; invoked via TTY menu use-dialog-box)) -- cgit v1.2.1 From 86cf9fd932c654cc502bedf634458a918ee5e9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 2 Apr 2023 23:01:29 +0100 Subject: Eglot: don't watch directories that don't exist project-files isn't guaranteed to return existing files, so better check if they exist because placing a watcher on them. Originally reported at: https://github.com/joaotavora/eglot/issues/1198 * lisp/progmodes/eglot.el (eglot-register-capability workspace/didChangeWatchedFiles): Check if directories exist. --- lisp/progmodes/eglot.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 8f64f849d72..4a9209ab9b4 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3433,8 +3433,9 @@ at point. With prefix argument, prompt for ACTION-KIND." (unwind-protect (progn (dolist (dir dirs-to-watch) - (push (file-notify-add-watch dir '(change) #'handle-event) - (gethash id (eglot--file-watches server)))) + (when (file-readable-p dir) + (push (file-notify-add-watch dir '(change) #'handle-event) + (gethash id (eglot--file-watches server))))) (setq success `(:message ,(format "OK, watching %s directories in %s watchers" -- cgit v1.2.1 From 5a1c9aace70b1f26b6cce38dbd79270c854bc080 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 2 Apr 2023 15:09:41 -0700 Subject: ; Add a bit more docstring to tsx-ts-mode (bug#62429) * lisp/progmodes/typescript-ts-mode.el: (tsx-ts-mode): Explain a bit more. --- lisp/progmodes/typescript-ts-mode.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 23815c79906..11f20add3ee 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -396,7 +396,10 @@ Argument LANGUAGE is either `typescript' or `tsx'." This major mode defines two additional JSX-specific faces: `typescript-ts-jsx-attribute-face' and `typescript-ts-jsx-attribute-face' that are used for HTML tags -and attributes, respectively." +and attributes, respectively. + +The JSX-specific faces are used when `treesit-font-lock-level' is +at least 3 (which is the default value)." :group 'typescript :syntax-table typescript-ts-mode--syntax-table -- cgit v1.2.1 From 479626dbac97d4415ae861c3f66fc33c5fd6fa14 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 2 Apr 2023 23:03:32 -0400 Subject: Update to Org 9.6.3-2-gf2949d --- lisp/org/ob-comint.el | 37 ++++++++++++++++--------------------- lisp/org/org-version.el | 4 ++-- lisp/org/org.el | 35 +++++++++++++++++------------------ 3 files changed, 35 insertions(+), 41 deletions(-) (limited to 'lisp') diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el index 54bf5127e16..adfe31c4008 100644 --- a/lisp/org/ob-comint.el +++ b/lisp/org/ob-comint.el @@ -81,19 +81,7 @@ or user `keyboard-quit' during execution of body." (let* ((string-buffer "") (comint-output-filter-functions (cons (lambda (text) - (setq string-buffer - (concat - string-buffer - ;; Upon concatenation, the prompt may no - ;; longer match `comint-prompt-regexp'. - ;; In particular, when the regexp has ^ - ;; and the output does not contain - ;; trailing newline. Use more reliable - ;; match to split the output later. - (replace-regexp-in-string - comint-prompt-regexp - ,org-babel-comint-prompt-separator - text)))) + (setq string-buffer (concat string-buffer text))) comint-output-filter-functions)) dangling-text) ;; got located, and save dangling text @@ -108,21 +96,28 @@ or user `keyboard-quit' during execution of body." (while (progn (goto-char comint-last-input-end) (not (save-excursion - (and (re-search-forward - (regexp-quote ,eoe-indicator) nil t) - (re-search-forward - comint-prompt-regexp nil t))))) + (and (re-search-forward + (regexp-quote ,eoe-indicator) nil t) + (re-search-forward + comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) ;; replace cut dangling text (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text) - ;; Replace partially supplied input lines. - ;; This is needed when output filter spits partial lines that - ;; do not include a full prompt at a time. + ;; Filter out prompts. (setq string-buffer (replace-regexp-in-string - comint-prompt-regexp + ;; Sometimes, we get multiple agglomerated + ;; prompts together in a single output: + ;; "prompt prompt prompt output" + ;; Remove them progressively, so that + ;; possible "^" in the prompt regexp gets to + ;; work as we remove the heading prompt + ;; instance. + (if (string-prefix-p "^" comint-prompt-regexp) + (format "^\\(%s\\)+" (substring comint-prompt-regexp 1)) + comint-prompt-regexp) ,org-babel-comint-prompt-separator string-buffer)) ;; remove echo'd FULL-BODY from input diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index fd75f4785d6..43fdcb82832 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of Org. Inserted by installing Org mode or when a release is made." - (let ((org-release "9.6.2")) + (let ((org-release "9.6.3")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.6.2")) + (let ((org-git-version "release_9.6.3-2-gf2949d")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 1649722ab0c..be9d0e32dd0 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -9,7 +9,7 @@ ;; URL: https://orgmode.org ;; Package-Requires: ((emacs "26.1")) -;; Version: 9.6.2 +;; Version: 9.6.3 ;; This file is part of GNU Emacs. ;; @@ -3600,13 +3600,13 @@ following symbols: (const :tag "Entities" entities)))) (defcustom org-hide-emphasis-markers nil - "Non-nil mean font-lock should hide the emphasis marker characters." + "Non-nil means font-lock should hide the emphasis marker characters." :group 'org-appearance :type 'boolean :safe #'booleanp) (defcustom org-hide-macro-markers nil - "Non-nil mean font-lock should hide the brackets marking macro calls." + "Non-nil means font-lock should hide the brackets marking macro calls." :group 'org-appearance :type 'boolean) @@ -3618,7 +3618,7 @@ When nil, the \\name form remains in the buffer." :type 'boolean) (defcustom org-pretty-entities-include-sub-superscripts t - "Non-nil means, pretty entity display includes formatting sub/superscripts." + "Non-nil means pretty entity display includes formatting sub/superscripts." :group 'org-appearance :version "24.1" :type 'boolean) @@ -10215,7 +10215,7 @@ nil." (replace-match "") (if (and (string-match "\\S-" (buffer-substring (line-beginning-position) (point))) (equal (char-before) ?\ )) - (backward-delete-char 1) + (delete-char -1) (when (string-match "^[ \t]*$" (buffer-substring (line-beginning-position) (line-end-position))) (delete-region (line-beginning-position) @@ -12006,18 +12006,17 @@ Returns the new tags string, or nil to not change the current settings." (setq current nil) (when exit-after-next (setq exit-after-next 'now))) ((= c ?\t) - (condition-case nil - (unless tab-tags - (setq tab-tags - (delq nil - (mapcar (lambda (x) - (let ((item (car-safe x))) - (and (stringp item) - (list item)))) - (org--tag-add-to-alist - (with-current-buffer buf - (org-get-buffer-tags)) - table)))))) + (unless tab-tags + (setq tab-tags + (delq nil + (mapcar (lambda (x) + (let ((item (car-safe x))) + (and (stringp item) + (list item)))) + (org--tag-add-to-alist + (with-current-buffer buf + (org-get-buffer-tags)) + table))))) (setq tg (completing-read "Tag: " tab-tags)) (when (string-match "\\S-" tg) (cl-pushnew (list tg) tab-tags :test #'equal) @@ -16532,7 +16531,7 @@ because, in this case the deletion might narrow the column." (looking-at-p ".*?|") (org-at-table-p)) (progn (forward-char -1) (org-delete-char 1)) - (backward-delete-char N) + (funcall-interactively #'backward-delete-char N) (org-fix-tags-on-the-fly)))) (defun org-delete-char (N) -- cgit v1.2.1 From 728bc09cf3c44ea43437903c2b4ca399af5de389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Mon, 3 Apr 2023 12:57:54 +0200 Subject: Fix regexp string escaping mistake in vhdl-mode.el (bug#62508) * lisp/progmodes/vhdl-mode.el (vhdl-compiler-alist): Quote brackets correctly. --- lisp/progmodes/vhdl-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index b0699d8308b..45fd17f65c4 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -286,7 +286,7 @@ Overrides local variable `indent-tabs-mode'." ;; counter_rtl.vhd(29):Conditional signal assignment line__29 ("ModelSim" "vcom" "-93 -work \\1" "make" "-f \\1" nil "vlib \\1; vmap \\2 \\1" "./" "work/" "Makefile" "modelsim" - ("^\\(ERROR\\|WARNING\\|\\*\\* Error\\|\\*\\* Warning\\)[^:]*:\\( *\[[0-9]+\]\\| ([^)]+)\\)? \\([^ \t\n]+\\)(\\([0-9]+\\)):" 3 4 nil) + ("^\\(ERROR\\|WARNING\\|\\*\\* Error\\|\\*\\* Warning\\)[^:]*:\\( *\\[[0-9]+]\\| ([^)]+)\\)? \\([^ \t\n]+\\)(\\([0-9]+\\)):" 3 4 nil) ("" 0) ("\\1/_primary.dat" "\\2/\\1.dat" "\\1/_primary.dat" "\\1/_primary.dat" "\\1/body.dat" downcase)) -- cgit v1.2.1 From 8c1b10224390e6613e9a742c438c700b20bb8742 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 3 Apr 2023 19:32:46 +0300 Subject: ; * lisp/image.el (put-image): Doc fix. --- lisp/image.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/image.el b/lisp/image.el index 29c39c5dd55..41bbed5006e 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -595,8 +595,8 @@ If nil, use the `image-scaling-factor' variable." IMAGE must be an image created with `create-image' or `defimage'. IMAGE is displayed by putting an overlay into the current buffer with a `before-string' STRING that has a `display' property whose value is the -image. STRING is defaulted if you omit it. -The overlay created will have the `put-image' property set to t. +image. STRING defaults to \"x\" if it's nil or omitted. +The overlay created by this function has the `put-image' property set to t. POS may be an integer or marker. AREA is where to display the image. AREA nil or omitted means display it in the text area, a value of `left-margin' means -- cgit v1.2.1 From 81d1f46d0fe0e4d8656e4994fd77b60b197f2bcf Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 5 Apr 2023 12:23:54 +0300 Subject: ; Avoid compiler warning in eglot.el. --- lisp/progmodes/eglot.el | 1 + 1 file changed, 1 insertion(+) (limited to 'lisp') diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 4a9209ab9b4..cb9190a7523 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1605,6 +1605,7 @@ If optional MARKER, return a marker instead" (directory-file-name (file-local-name truepath)) eglot--uri-path-allowed-chars))))) +(declare-function w32-long-file-name "w32proc.c" (fn)) (defun eglot--uri-to-path (uri) "Convert URI to file path, helped by `eglot--current-server'." (when (keywordp uri) (setq uri (substring (symbol-name uri) 1))) -- cgit v1.2.1 From 6b9f9df9454a59b74790c402916df8628bb9d477 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 5 Apr 2023 12:31:01 +0300 Subject: ; Improve documentation of 'declare-function' * doc/lispref/functions.texi (Declaring Functions): * lisp/subr.el (declare-function): Document explicitly that ARGLIST argument, if provided, should include the parentheses. --- lisp/subr.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/subr.el b/lisp/subr.el index 131ed110149..2e31929e548 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -45,7 +45,8 @@ declaration. A FILE with an \"ext:\" prefix is an external file. `check-declare' will check such files if they are found, and skip them without error if they are not. -Optional ARGLIST specifies FN's arguments, or is t to not specify +Optional ARGLIST specifies FN's arguments, in the same form as +in `defun' (including the parentheses); or it is t to not specify FN's arguments. An omitted ARGLIST defaults to t, not nil: a nil ARGLIST specifies an empty argument list, and an explicit t ARGLIST is a placeholder that allows supplying a later arg. -- cgit v1.2.1 From 63d4a86f8d1547593c49e8bf493757137eb147e0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 6 Apr 2023 12:35:17 +0300 Subject: Fix transforming sliced images * lisp/image.el (image--get-image): Support sliced images (bug#62679). Doc fix. (image-mouse-decrease-size, image-mouse-increase-size) (image-decrease-size, image-increase-size): Doc fixes. --- lisp/image.el | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) (limited to 'lisp') diff --git a/lisp/image.el b/lisp/image.el index 41bbed5006e..3f878bd4de0 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -1158,9 +1158,11 @@ has no effect." "r" #'image-rotate) (defun image-increase-size (&optional n position) - "Increase the image size by a factor of N. -If N is 3, then the image size will be increased by 30%. The -default is 20%." + "Increase the image size at POSITION by a factor specified by N. +If N is 3, then the image size will be increased by 30%. More +generally, the image size is multiplied by 1 plus N divided by 10. +N defaults to 2, which increases the image size by 20%. +POSITION can be a buffer position or a marker, and defaults to point." (interactive "P") (image--delayed-change-size (if n (1+ (/ (prefix-numeric-value n) 10.0)) @@ -1179,9 +1181,11 @@ default is 20%." (run-with-idle-timer 0.3 nil #'image--change-size size position)) (defun image-decrease-size (&optional n position) - "Decrease the image size by a factor of N. -If N is 3, then the image size will be decreased by 30%. The -default is 20%." + "Decrease the image size at POSITION by a factor specified by N. +If N is 3, then the image size will be decreased by 30%. More +generally, the image size is multiplied by 1 minus N divided by 10. +N defaults to 2, which decreases the image size by 20%. +POSITION can be a buffer position or a marker, and defaults to point." (interactive "P") (image--delayed-change-size (if n (- 1 (/ (prefix-numeric-value n) 10.0)) @@ -1191,7 +1195,9 @@ default is 20%." "Use %k for further adjustments")) (defun image-mouse-increase-size (&optional event) - "Increase the image size using the mouse." + "Increase the image size using the mouse-gesture EVENT. +This increases the size of the image at the position specified by +EVENT, if any, by the default factor used by `image-increase-size'." (interactive "e") (when (listp event) (save-window-excursion @@ -1199,7 +1205,9 @@ default is 20%." (image-increase-size nil (point-marker))))) (defun image-mouse-decrease-size (&optional event) - "Decrease the image size using the mouse." + "Decrease the image size using the mouse-gesture EVENT. +This decreases the size of the image at the position specified by +EVENT, if any, by the default factor used by `image-decrease-size'." (interactive "e") (when (listp event) (save-window-excursion @@ -1207,12 +1215,24 @@ default is 20%." (image-decrease-size nil (point-marker))))) (defun image--get-image (&optional position) - "Return the image at point." - (let ((image (get-char-property (or position (point)) 'display - (when (markerp position) - (marker-buffer position))))) + "Return the image at POSITION. +POSITION can be a buffer position or a marker, and defaults to point." + (let* ((image (get-char-property (or position (point)) 'display + (when (markerp position) + (marker-buffer position)))) + (image-car (car-safe image)) + (image + (cond ((eq image-car 'image) + image) + ;; The value of the display property could be a sliced + ;; image of the form ((slice ...) (image ...)). + ;; FIXME: can we have more than 2 members in the list, + ;; so that the (image ...) part is NOT the cadr? + ((and (listp image) (consp image-car)) + (cadr image)) + (t nil)))) (unless (eq (car-safe image) 'image) - (error "No image under point")) + (error "No recognizable image under point")) image)) ;;;###autoload -- cgit v1.2.1 From 470d269ec1fe58935ff1b13e04d030ec40dcaa5e Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Wed, 5 Apr 2023 15:19:13 +0200 Subject: Make emoji-zoom-{increase,decrease} set text properties correctly * lisp/international/emoji.el (emoji-zoom-increase): Ensure that we're increasing the :height of the anonymous face at point, rather than having two :height properties, which appeared to work by accident, and don't error at eob. (Bug#62675) --- lisp/international/emoji.el | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'lisp') diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index bcd4aac4f29..ffff2aa1236 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -707,23 +707,33 @@ We prefer the earliest unique letter." "Increase the size of the character under point. FACTOR is the multiplication factor for the size." (interactive) - (set-transient-map emoji-zoom-map t nil "Zoom with %k") - (let* ((factor (or factor 1.1)) - (old (get-text-property (point) 'face)) - (height (or (and (consp old) - (plist-get old :height)) - 1.0)) - (inhibit-read-only t)) - (with-silent-modifications - (if (consp old) - (add-text-properties - (point) (1+ (point)) - (list 'face (plist-put (copy-sequence old) :height (* height factor)) - 'rear-nonsticky t)) - (add-face-text-property (point) (1+ (point)) - (list :height (* height factor))) - (put-text-property (point) (1+ (point)) - 'rear-nonsticky t))))) + (set-transient-map emoji-zoom-map t #'redisplay "Zoom with %k") + (unless (eobp) + (let* ((factor (or factor 1.1)) + (old (get-text-property (point) 'face)) + ;; The text property is either a named face, or a plist + ;; with :height, or a list starting with such a plist, + ;; followed by one or more faces. + (newheight (* (or (and (consp old) + (or (plist-get (car old) :height) + (plist-get old :height))) + 1.0) + factor)) + (inhibit-read-only t)) + (with-silent-modifications + (if (consp old) + (add-text-properties + (point) (1+ (point)) + (list 'face + (if (eq (car old) :height) + (plist-put (copy-sequence old) :height newheight) + (cons (plist-put (car old) :height newheight) + (cdr old))) + 'rear-nonsticky t)) + (add-face-text-property (point) (1+ (point)) + (list :height newheight)) + (put-text-property (point) (1+ (point)) + 'rear-nonsticky t)))))) ;;;###autoload (defun emoji-zoom-decrease () -- cgit v1.2.1 From 305246d9726bbe05a65ad3836880138db5c01dfa Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Wed, 5 Apr 2023 17:24:38 +0200 Subject: Add emoji-zoom-reset * lisp/international/emoji.el (emoji-zoom-map): Add emoji-zoom-reset. (emoji-zoom-reset): New function, it resets the zoom level. * lisp/international/mule-cmds.el (ctl-x-map): Add emoji-zoom-reset. * etc/NEWS: Announce new command. --- lisp/international/emoji.el | 16 +++++++++++++++- lisp/international/mule-cmds.el | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index ffff2aa1236..04854ede6be 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -700,7 +700,8 @@ We prefer the earliest unique letter." (defvar-keymap emoji-zoom-map "+" #'emoji-zoom-increase - "-" #'emoji-zoom-decrease) + "-" #'emoji-zoom-decrease + "0" #'emoji-zoom-reset) ;;;###autoload (defun emoji-zoom-increase (&optional factor) @@ -741,6 +742,19 @@ FACTOR is the multiplication factor for the size." (interactive) (emoji-zoom-increase 0.9)) +;;;###autoload +(defun emoji-zoom-reset () + "Reset the size of the character under point." + (interactive) + (with-silent-modifications + (let ((old (get-text-property (point) 'face))) + (when (and (consp old) + (remove-text-properties (point) (1+ (point)) '(rear-nonsticky nil))) + (if (eq (car old) :height) + (remove-text-properties (point) (1+ (point)) '(face nil)) + (add-text-properties (point) (1+ (point)) (list 'face + (cdr old)))))))) + (provide 'emoji) ;;; emoji.el ends here diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 4e38b13b1a5..3d6d66970d3 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -3269,7 +3269,8 @@ single characters to be treated as standing for themselves." "r" #'emoji-recent "l" #'emoji-list "+" #'emoji-zoom-increase - "-" #'emoji-zoom-decrease)) + "-" #'emoji-zoom-decrease + "0" #'emoji-zoom-reset)) (defface confusingly-reordered '((((supports :underline (:style wave))) -- cgit v1.2.1