all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Want to delete distinct regions but make capable undo by single command.
@ 2013-04-25  5:27 Oleksandr Gavenko
  2013-04-25 11:13 ` Oleksandr Gavenko
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Gavenko @ 2013-04-25  5:27 UTC (permalink / raw)
  To: help-gnu-emacs

Want to delete distinct regions but make capable undo by single command
(programmatically).

Like this happen after automatic replacement ('!'). You undo by 'M-_' all
replacement at once instead sequentially each individually.

-- 
Best regards!




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

* Re: Want to delete distinct regions but make capable undo by single command.
       [not found] <mailman.24601.1366867653.855.help-gnu-emacs@gnu.org>
@ 2013-04-25  6:01 ` Rami A
  0 siblings, 0 replies; 3+ messages in thread
From: Rami A @ 2013-04-25  6:01 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Oleksander,
I believe the combination C-x C-v replace the file with it's image on the disk. Basically removing any "unsaved" changes to the file.


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

* Re: Want to delete distinct regions but make capable undo by single command.
  2013-04-25  5:27 Want to delete distinct regions but make capable undo by single command Oleksandr Gavenko
@ 2013-04-25 11:13 ` Oleksandr Gavenko
  0 siblings, 0 replies; 3+ messages in thread
From: Oleksandr Gavenko @ 2013-04-25 11:13 UTC (permalink / raw)
  To: help-gnu-emacs

Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:

> 
> Want to delete distinct regions but make capable undo by single command
> (programmatically).
> 
> Like this happen after automatic replacement ('!'). You undo by 'M-_' all
> replacement at once instead sequentially each individually.
> 

Wrote such code:

(defun my-org-kill-by-tag (tag)
  "Put all entries that matches TAG from current org-file to `kill-ring'."
  (interactive (list (completing-read "Enter tag: " (org-get-buffer-tags))))
  (kill-new "")
  (org-scan-tags
   (lambda ()
     (let ( (last-command 'kill-region) )
       (org-cut-subtree)))
   '(member tag tags-list)
   nil) )

See origin:

  http://thread.gmane.org/gmane.emacs.orgmode/71263
            Kill all items with specific tag to kill-ring.

which exploit 'org-cut-subtree' implementation with:

  (let ( (last-command 'kill-region) ) ...kill-commands...)

To make this possible your code MUST use only high-level kill ring
functions. Which take care on "last-command == kill-region".

If some function in code use 'kill-new' or 'kill-append' - 'last-command'
trick fail...




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

end of thread, other threads:[~2013-04-25 11:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-25  5:27 Want to delete distinct regions but make capable undo by single command Oleksandr Gavenko
2013-04-25 11:13 ` Oleksandr Gavenko
     [not found] <mailman.24601.1366867653.855.help-gnu-emacs@gnu.org>
2013-04-25  6:01 ` Rami A

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.