emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Martin Pohlack <mp26@os.inf.tu-dresden.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: undo grouping
Date: Wed, 25 Feb 2009 13:51:08 +0100	[thread overview]
Message-ID: <5F88EAC2-D945-4C12-9E93-07D6C0A7C28B@uva.nl> (raw)
In-Reply-To: <49A4571A.8070509@os.inf.tu-dresden.de>


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

  parent reply	other threads:[~2009-02-25 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-24 20:22 Martin Pohlack
2009-02-25  9:08 ` Martin Pohlack
2009-02-25 12:51 ` Carsten Dominik [this message]
2009-02-25  8:58 Martin Pohlack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5F88EAC2-D945-4C12-9E93-07D6C0A7C28B@uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=mp26@os.inf.tu-dresden.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).