* undo grouping
@ 2009-02-25 8:58 Martin Pohlack
0 siblings, 0 replies; 4+ messages in thread
From: Martin Pohlack @ 2009-02-25 8:58 UTC (permalink / raw)
To: emacs-orgmode
[resent, as the previous attempts didn't make it to the list ...]
Hi All,
I hacked together a small workaround for the ungrouped undo-list entries
(undo works only characterwise in org-mode, but usually chunks together
several key strokes in, e.g., text-mode).
I have this piece of code in my emacs startup script.
-----–----------------------------->8-----------------------------------
;; implement undo grouping for org-mode
(setq org-self-insert-command-undo-counter 0)
(defadvice org-self-insert-command (after compact-undo-list () activate)
"Compact the undo list by removing some boundaries."
(if (not (eq last-command 'org-self-insert-command))
(setq org-self-insert-command-undo-counter 1)
(if (>= org-self-insert-command-undo-counter 20)
(setq org-self-insert-command-undo-counter 1)
(when (> org-self-insert-command-undo-counter 0)
(when buffer-undo-list
(when (not (cadr buffer-undo-list)) ; remove nil entry
(setcdr buffer-undo-list (cddr buffer-undo-list)))))
(incf org-self-insert-command-undo-counter))))
-----–----------------------------->8-----------------------------------
The advice post-processes the local buffer-undo-list and removes some
undo-boundaries. The behavior is modeled after emacs' command_loop.
Feedback welcome.
Cheers,
Martin
^ permalink raw reply [flat|nested] 4+ messages in thread
* undo grouping
@ 2009-02-24 20:22 Martin Pohlack
2009-02-25 9:08 ` Martin Pohlack
2009-02-25 12:51 ` Carsten Dominik
0 siblings, 2 replies; 4+ messages in thread
From: Martin Pohlack @ 2009-02-24 20:22 UTC (permalink / raw)
To: emacs-orgmode
Hi All,
I hacked together a small workaround for the ungrouped undo-list entries
(undo works only characterwise in org-mode, but usually chunks together
several key strokes in, e.g., text-mode).
I have this piece of code in my emacs startup script.
-----–----------------------------->8-----------------------------------
;; implement undo grouping for org-mode
(setq org-self-insert-command-undo-counter 0)
(defadvice org-self-insert-command (after compact-undo-list () activate)
"Compact the undo list by removing some boundaries."
(if (not (eq last-command 'org-self-insert-command))
(setq org-self-insert-command-undo-counter 1)
(if (>= org-self-insert-command-undo-counter 20)
(setq org-self-insert-command-undo-counter 1)
(when (> org-self-insert-command-undo-counter 0)
(when buffer-undo-list
(when (not (cadr buffer-undo-list)) ; remove nil entry
(setcdr buffer-undo-list (cddr buffer-undo-list)))))
(incf org-self-insert-command-undo-counter))))
-----–----------------------------->8-----------------------------------
The advice post-processes the local buffer-undo-list and removes some
undo-boundaries. The behavior is modeled after emacs' command_loop.
Feedback welcome.
Cheers,
Martin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: undo grouping
2009-02-24 20:22 Martin Pohlack
@ 2009-02-25 9:08 ` Martin Pohlack
2009-02-25 12:51 ` Carsten Dominik
1 sibling, 0 replies; 4+ messages in thread
From: Martin Pohlack @ 2009-02-25 9:08 UTC (permalink / raw)
To: emacs-orgmode
[...]
> (undo works only characterwise in org-mode, but usually chunks together
^ emacs
> several key strokes in, e.g., text-mode).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: undo grouping
2009-02-24 20:22 Martin Pohlack
2009-02-25 9:08 ` Martin Pohlack
@ 2009-02-25 12:51 ` Carsten Dominik
1 sibling, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2009-02-25 12:51 UTC (permalink / raw)
To: Martin Pohlack; +Cc: emacs-orgmode
Excellent, thank you very much.
I have installed this code (not using advice, but directly).
- Carsten
On Feb 24, 2009, at 9:22 PM, Martin Pohlack wrote:
> Hi All,
>
> I hacked together a small workaround for the ungrouped undo-list
> entries
> (undo works only characterwise in org-mode, but usually chunks
> together
> several key strokes in, e.g., text-mode).
>
> I have this piece of code in my emacs startup script.
>
> -----–-----------------------------
> >8-----------------------------------
> ;; implement undo grouping for org-mode
> (setq org-self-insert-command-undo-counter 0)
> (defadvice org-self-insert-command (after compact-undo-list ()
> activate)
> "Compact the undo list by removing some boundaries."
> (if (not (eq last-command 'org-self-insert-command))
> (setq org-self-insert-command-undo-counter 1)
> (if (>= org-self-insert-command-undo-counter 20)
> (setq org-self-insert-command-undo-counter 1)
> (when (> org-self-insert-command-undo-counter 0)
> (when buffer-undo-list
> (when (not (cadr buffer-undo-list)) ; remove nil entry
> (setcdr buffer-undo-list (cddr buffer-undo-list)))))
> (incf org-self-insert-command-undo-counter))))
> -----–-----------------------------
> >8-----------------------------------
>
> The advice post-processes the local buffer-undo-list and removes some
> undo-boundaries. The behavior is modeled after emacs' command_loop.
>
> Feedback welcome.
>
> Cheers,
> Martin
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-25 12:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 8:58 undo grouping Martin Pohlack
-- strict thread matches above, loose matches on Subject: below --
2009-02-24 20:22 Martin Pohlack
2009-02-25 9:08 ` Martin Pohlack
2009-02-25 12:51 ` Carsten Dominik
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).