all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to configure undo steps for single-character insert?
@ 2009-05-14  7:10 Teemu Likonen
  2009-05-14  7:47 ` Tassilo Horn
       [not found] ` <mailman.7140.1242287296.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Teemu Likonen @ 2009-05-14  7:10 UTC (permalink / raw
  To: help-gnu-emacs

I have noticed - and now read from the manual - that undoing
single-character insert _usually_ removes more than just one character.
However, in Org mode the undo command removes characters one by one, of
which feature I'm not sure if I like about. Anyway there must be a way
to configure this. How? I wasn't able to find info from Emacs nor Emacs
Lisp manual.


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

* Re: How to configure undo steps for single-character insert?
  2009-05-14  7:10 How to configure undo steps for single-character insert? Teemu Likonen
@ 2009-05-14  7:47 ` Tassilo Horn
       [not found] ` <mailman.7140.1242287296.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2009-05-14  7:47 UTC (permalink / raw
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

Hi Teemu,

> I have noticed - and now read from the manual - that undoing
> single-character insert _usually_ removes more than just one
> character.  However, in Org mode the undo command removes characters
> one by one, of which feature I'm not sure if I like about.

I guess you use the org version integrated into emacs 23, right?  Newer
versions of org-mode implement a better undo, but that won't make it
into emacs 23.1.

Bye,
Tassilo





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

* Re: How to configure undo steps for single-character insert?
       [not found] ` <mailman.7140.1242287296.31690.help-gnu-emacs@gnu.org>
@ 2009-05-14  8:29   ` Teemu Likonen
  2009-05-14 11:43     ` Tassilo Horn
       [not found]     ` <mailman.7150.1242301410.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Teemu Likonen @ 2009-05-14  8:29 UTC (permalink / raw
  To: help-gnu-emacs

On 2009-05-14 09:47 (+0200), Tassilo Horn wrote:

> Teemu Likonen <tlikonen@iki.fi> writes:
>> I have noticed - and now read from the manual - that undoing
>> single-character insert _usually_ removes more than just one
>> character.  However, in Org mode the undo command removes characters
>> one by one, of which feature I'm not sure if I like about.
>
> I guess you use the org version integrated into emacs 23, right?  Newer
> versions of org-mode implement a better undo, but that won't make it
> into emacs 23.1.

No, I use the Org mode that is integrated with Emacs 22 in Debian
GNU/Linux. Is there not a simple user option for this?


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

* Re: How to configure undo steps for single-character insert?
  2009-05-14  8:29   ` Teemu Likonen
@ 2009-05-14 11:43     ` Tassilo Horn
       [not found]     ` <mailman.7150.1242301410.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2009-05-14 11:43 UTC (permalink / raw
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

Hi Teemu,

>> I guess you use the org version integrated into emacs 23, right?
>> Newer versions of org-mode implement a better undo, but that won't
>> make it into emacs 23.1.
>
> No, I use the Org mode that is integrated with Emacs 22 in Debian
> GNU/Linux.

Oh, even older.

> Is there not a simple user option for this?

Nope, I don't think so.  Looking at org-mode's git repo:

,----[ cd ~/repos/el/org-mode; git log ]
| commit 8b0d614702678b69d4ba520cb33f9177c0832f74
| Author: Carsten Dominik <carsten.dominik@gmail.com>
| Date:   Wed Feb 25 12:43:24 2009 +0100
| 
|     Undo: Cluster self-insert characters for undo
|     
|     Undo will now remove up to 20 characters typed consecutively, just
|     like Emacs normally does.  We need a special implementation for this
|     because Org has its own self-insert command.
|     
|     The code for doing this is a patch by Martin Pohlack.
`----

,----[ cd ~/repos/el/org-mode; git diff 8b0d614702678b69d4ba520cb33f9177c0832f74^ 8b0d614702678b69d4ba520cb33f9177c0832f74 ]
| diff --git a/doc/org.texi b/doc/org.texi
| index e3c927d..fa105db 100644
| --- a/doc/org.texi
| +++ b/doc/org.texi
| @@ -10745,6 +10745,9 @@ links, among other things.
|  @i{Pete Phillips} helped during the development of the TAGS feature, and
|  provided frequent feedback.
|  @item
| +@i{Martin Pohlack} provided the code snippet to bundle character insertion
| +into bundles of 20 for undo.
| +@item
|  @i{T.V. Raman} reported bugs and suggested improvements.
|  @item
|  @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
| diff --git a/lisp/ChangeLog b/lisp/ChangeLog
| index c837af2..aceff8b 100755
| --- a/lisp/ChangeLog
| +++ b/lisp/ChangeLog
| @@ -1,3 +1,12 @@
| +2009-02-25  Carsten Dominik  <carsten.dominik@gmail.com>
| +
| +	* org-table.el (orgtbl-self-insert-command): Cluster undo for 20
| +	characters.
| +
| +	* org.el (org-self-insert-cluster-for-undo): New option.
| +	(org-self-insert-command): Cluster undo for 20 characters.
| +	(org-self-insert-command-undo-counter): New variable.
| +
|  2009-02-24  Carsten Dominik  <carsten.dominik@gmail.com>
|  
|  	* org-exp.el (org-export-as-html): Fix problem with closing colone
| diff --git a/lisp/org-table.el b/lisp/org-table.el
| index 08ceb34..0eae745 100644
| --- a/lisp/org-table.el
| +++ b/lisp/org-table.el
| @@ -3568,14 +3568,27 @@ overwritten, and the table is not marked as requiring realignment."
|  	(goto-char (match-beginning 0))
|  	(self-insert-command N))
|      (setq org-table-may-need-update t)
| -    (let (orgtbl-mode a)
| -      (call-interactively
| -       (or (key-binding
| -	    (or (and (listp function-key-map)
| -		     (setq a (assoc last-input-event function-key-map))
| -		     (cdr a))
| -		(vector last-input-event)))
| -	   'self-insert-command)))))
| +    (let* (orgtbl-mode
| +	   a
| +	   (cmd (or (key-binding
| +		     (or (and (listp function-key-map)
| +			      (setq a (assoc last-input-event function-key-map))
| +			      (cdr a))
| +			 (vector last-input-event)))
| +	   'self-insert-command)))
| +      (call-interactively cmd)
| +      (if (and org-self-insert-cluster-for-undo
| +	       (eq cmd 'self-insert-command))
| +	  (if (not (eq last-command 'orgtbl-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)
| +	      (and (> org-self-insert-command-undo-counter 0)
| +		   buffer-undo-list
| +		   (not (cadr buffer-undo-list)) ; remove nil entry
| +		   (setcdr buffer-undo-list (cddr buffer-undo-list)))
| +	      (setq org-self-insert-command-undo-counter
| +		    (1+ org-self-insert-command-undo-counter))))))))
|  
|  (defvar orgtbl-exp-regexp "^\\([-+]?[0-9][0-9.]*\\)[eE]\\([-+]?[0-9]+\\)$"
|    "Regular expression matching exponentials as produced by calc.")
| diff --git a/lisp/org.el b/lisp/org.el
| index 388d777..0fef029 100644
| --- a/lisp/org.el
| +++ b/lisp/org.el
| @@ -903,6 +903,14 @@ See also the variable `org-table-auto-blank-field'."
|  	  (const :tag "on" t)
|  	  (const :tag "on, optimized" optimized)))
|  
| +(defcustom org-self-insert-cluster-for-undo t
| +  "Non-nil means cluster self-insert commands for undo when possible.
| +If this is set, then, like in the Emacs command loop, 20 consequtive
| +characters will be undone together.
| +This is configurable, because there is some impact on typing performance."
| +  :group 'org-table
| +  :type 'boolean)
| +
|  (defcustom org-table-tab-recognizes-table.el t
|    "Non-nil means, TAB will automatically notice a table.el table.
|  When it sees such a table, it moves point into it and - if necessary -
| @@ -13286,7 +13294,18 @@ overwritten, and the table is not marked as requiring realignment."
|  	(self-insert-command N))
|      (setq org-table-may-need-update t)
|      (self-insert-command N)
| -    (org-fix-tags-on-the-fly)))
| +    (org-fix-tags-on-the-fly)
| +    (if org-self-insert-cluster-for-undo
| +	(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)
| +	    (and (> org-self-insert-command-undo-counter 0)
| +		 buffer-undo-list
| +		 (not (cadr buffer-undo-list)) ; remove nil entry
| +		 (setcdr buffer-undo-list (cddr buffer-undo-list)))
| +	    (setq org-self-insert-command-undo-counter
| +		  (1+ org-self-insert-command-undo-counter)))))))
|  
|  (defun org-fix-tags-on-the-fly ()
|    (when (and (equal (char-after (point-at-bol)) ?*)
`----

So it's not a too trivial patch, and I guess it won't apply to the emacs
22 org version...

Bye,
Tassilo





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

* Re: How to configure undo steps for single-character insert?
       [not found]     ` <mailman.7150.1242301410.31690.help-gnu-emacs@gnu.org>
@ 2009-05-14 15:17       ` Teemu Likonen
  0 siblings, 0 replies; 5+ messages in thread
From: Teemu Likonen @ 2009-05-14 15:17 UTC (permalink / raw
  To: help-gnu-emacs

On 2009-05-14 13:43 (+0200), Tassilo Horn wrote:

> Teemu Likonen <tlikonen@iki.fi> writes:
>> Is there not a simple user option for this?
>
> Nope, I don't think so.  Looking at org-mode's git repo:

> So it's not a too trivial patch, and I guess it won't apply to the
> emacs 22 org version...

Ok, thanks anyway. Fortunately this is not that big issue to me, and the
fix is already waiting for me there somewhere. :-)


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

end of thread, other threads:[~2009-05-14 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14  7:10 How to configure undo steps for single-character insert? Teemu Likonen
2009-05-14  7:47 ` Tassilo Horn
     [not found] ` <mailman.7140.1242287296.31690.help-gnu-emacs@gnu.org>
2009-05-14  8:29   ` Teemu Likonen
2009-05-14 11:43     ` Tassilo Horn
     [not found]     ` <mailman.7150.1242301410.31690.help-gnu-emacs@gnu.org>
2009-05-14 15:17       ` Teemu Likonen

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.