From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: undo grouping Date: Wed, 25 Feb 2009 13:51:08 +0100 Message-ID: <5F88EAC2-D945-4C12-9E93-07D6C0A7C28B@uva.nl> References: <49A4571A.8070509@os.inf.tu-dresden.de> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LcJEI-0005wT-Td for emacs-orgmode@gnu.org; Wed, 25 Feb 2009 07:51:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LcJEG-0005vp-7o for emacs-orgmode@gnu.org; Wed, 25 Feb 2009 07:51:13 -0500 Received: from [199.232.76.173] (port=52609 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LcJEG-0005vg-1T for emacs-orgmode@gnu.org; Wed, 25 Feb 2009 07:51:12 -0500 Received: from fg-out-1718.google.com ([72.14.220.155]:16766) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LcJEF-0008QZ-Di for emacs-orgmode@gnu.org; Wed, 25 Feb 2009 07:51:11 -0500 Received: by fg-out-1718.google.com with SMTP id l27so253544fgb.30 for ; Wed, 25 Feb 2009 04:51:10 -0800 (PST) In-Reply-To: <49A4571A.8070509@os.inf.tu-dresden.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Martin Pohlack Cc: emacs-orgmode@gnu.org 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 =20 > entries > (undo works only characterwise in org-mode, but usually chunks =20 > together > several key strokes in, e.g., text-mode). > > I have this piece of code in my emacs startup script. > > -----=96-----------------------------=20 > >8----------------------------------- > ;; implement undo grouping for org-mode > (setq org-self-insert-command-undo-counter 0) > (defadvice org-self-insert-command (after compact-undo-list () =20 > 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 (>=3D 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)))) > -----=96-----------------------------=20 > >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