all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23632: 25.1.50; Gratuitous undo boundary in latex-insert-block
@ 2016-05-27 15:11 Chong Yidong
  2016-05-28  8:22 ` Chong Yidong
  0 siblings, 1 reply; 24+ messages in thread
From: Chong Yidong @ 2016-05-27 15:11 UTC (permalink / raw)
  To: 23632

In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)

1. emacs -Q foo.tex

2. C-c C-o RET

   The buffer now contains an `enumerate' skeleton:

\begin{enumerate}
\item 
\end{enumerate}

3. C-/

   After this undo command, the buffer now contains

\begin{

   Expected behavior: C-/ should undo the entire effects of C-c C-o, so
   the buffer should contain nothing at all.  You shouldn't need another
   C-/ to get rid of the "\begin{".

This happens because latex-insert-block uses skeleton-insert, in which
the "interactor" specified for reading a string is lazily invoked only
when the string appears in the skeleton.  Hence, the "\begin{" is
inserted into the buffer first, and then completing-read is called to
ask for the LaTeX block name.  The completing-read adds an undo
boundary, in the midst of the changes by latex-insert-block.

The attached patch, which gets rid of the undo boundary, seems to fix
this:


--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1539,7 +1539,8 @@ 'tex-latex-block
 (define-skeleton latex-insert-block
   "Create a matching pair of lines \\begin{NAME} and \\end{NAME} at point.
 Puts point on a blank line between them."
-  (let ((choice (completing-read (format "LaTeX block name [%s]: "
+  (let* ((buffer-undo-list t) ; Don't add an undo boundary
+         (choice (completing-read (format "LaTeX block name [%s]: "
 					 latex-block-default)
                                  (latex-complete-envnames)
 				 nil nil nil nil latex-block-default)))





^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2016-06-07 15:09 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-27 15:11 bug#23632: 25.1.50; Gratuitous undo boundary in latex-insert-block Chong Yidong
2016-05-28  8:22 ` Chong Yidong
2016-05-29 21:51   ` Phillip Lord
2016-05-31 21:42     ` Phillip Lord
2016-06-01 13:15       ` Stefan Monnier
2016-06-02 20:08         ` Phillip Lord
2016-06-03 13:00           ` Stefan Monnier
2016-06-03 16:13             ` Phillip Lord
2016-06-03 17:00               ` Stefan Monnier
2016-06-03 22:18                 ` Phillip Lord
2016-06-04  3:05                   ` Stefan Monnier
2016-06-04  8:51                     ` Phillip Lord
2016-06-04 16:49                       ` Stefan Monnier
2016-06-04 17:17                         ` Phillip Lord
2016-06-04 18:41                           ` Stefan Monnier
2016-06-06 14:33                             ` Phillip Lord
2016-06-06 15:02                               ` Stefan Monnier
2016-06-06 15:36                                 ` Phillip Lord
2016-06-06 15:26                               ` Eli Zaretskii
2016-06-06 15:38                                 ` Phillip Lord
2016-06-06 16:22                                   ` Eli Zaretskii
2016-06-07 11:20                                     ` Phillip Lord
2016-06-07 15:09                                       ` Eli Zaretskii
2016-06-03  2:58     ` Chong Yidong

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.