Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution in this case was to create the temporary output buffer using <code>with-temp-buffer</code>, rather than explicitly creating one with <code>generate-new-buffer</code>. The following alternative version of the first function does not create an undo boundary:</p> <pre><code>(defun test-shell-command (str) "Apply tr to STR to convert lowercase letters to uppercase." (with-temp-buffer (insert str) (call-process-region (point-min) (point-max) "tr" t t nil "'a-z'" "'A-Z'") (buffer-string))) </code></pre> <p>I was not able to determine whether <code>generate-new-buffer</code> is indeed creating the undo boundary, but this fixed the problem. <code>generate-new-buffer</code> calls <code>get-buffer-create</code>, which is defined in the C source code, but I could not quickly determine what was happening in terms of the undo history.</p> <p>I suspect that the issue may be related to the following passage in the <a href="http://www.gnu.org/software/emacs/manual/html_node/elisp/Undo.html" rel="nofollow">Emacs Lisp Manual entry for <code>undo-boundary</code></a>:</p> <blockquote> <p>All buffer modifications add a boundary whenever the previous undoable change was made in some other buffer. This is to ensure that each command makes a boundary in each buffer where it makes changes.</p> </blockquote> <p>Even though the <code>with-temp-buffer</code> macro calls <code>generate-new-buffer</code> much as in the original function, the documentation for <code>with-temp-buffer</code> states that no undo information is saved (even though there is nothing in the Emacs Lisp source that suggests this would be the case):</p> <blockquote> <p>By default, undo (see Undo) is not recorded in the buffer created by this macro (but body can enable that, if needed).</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload