[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 0a9407cceea625c587eac

From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 0a9407cceea625c587eac8958d9921751c03ccf9
Date: Thu, 27 Jun 2019 09:16:27 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  0a9407cceea625c587eac8958d9921751c03ccf9 (commit)
      from  aa17420828fe63e81f917af6562a97cbacdce253 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0a9407cceea625c587eac8958d9921751c03ccf9
Author: Ikumi Keita <address@hidden>
Date:   Thu Jun 27 22:04:55 2019 +0900

    Conform to `delete-selection-mode' (bug#36385)
    * latex.el (LaTeX-insert-left-brace): Put `delete-selection' property
    which obeys that of `self-insert-command' when
    `LaTeX-electric-left-right-brace' feature is inactive.

diff --git a/latex.el b/latex.el
index dd6c398..760c42a 100644
--- a/latex.el
+++ b/latex.el
@@ -2792,6 +2792,8 @@ Automatic right brace insertion is done only if no prefix 
ARG is given and
 `LaTeX-electric-left-right-brace' is non-nil.
 Normally bound to keys \(, { and [."
   (interactive "*P")
+  ;; If you change the condition for `auto-p', adjust the condition in
+  ;; the `delete-selection' property, just below this defun, accordingly.
   (let ((auto-p (and LaTeX-electric-left-right-brace (not arg))))
     (if (and auto-p
@@ -2829,6 +2831,27 @@ Normally bound to keys \(, { and [."
                (goto-char (mark)))
             lmacro lbrace)))))))
+;; Cater for `delete-selection-mode' (bug#36385)
+;; See the header comment of delsel.el for detail.
+(put #'LaTeX-insert-left-brace 'delete-selection
+     (lambda ()
+       ;; Consult `delete-selection' property when
+       ;; `LaTeX-insert-left-brace' works just the same as
+       ;; `self-insert-command'.
+       (and (or (not LaTeX-electric-left-right-brace)
+               current-prefix-arg)
+           (let ((f (get #'self-insert-command 'delete-selection)))
+             ;; If `delete-selection' property of
+             ;; `self-insert-command' is one of the predefined
+             ;; special symbols, just return itself.
+             (if (memq f '(yank supersede kill t nil))
+                 ;; FIXME: if this list of special symbols is
+                 ;; extended in future delsel.el, this discrimination
+                 ;; will become wrong.
+                 f
+               ;; Otherwise, call it as a function and return
+               ;; its value.
+               (funcall f))))))
 (defun LaTeX-insert-corresponding-right-macro-and-brace
   (lmacro lbrace &optional optional prompt)


Summary of changes:
 latex.el | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]