emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* something odd with org-remember-mode and kill-ring-save
@ 2009-12-05 14:40 Good Bad
  2009-12-17  7:42 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Good Bad @ 2009-12-05 14:40 UTC (permalink / raw)
  To: Emacs Org-mode

I made a wrapped version of org-remember-kill which saves the remember content to the kill ring and then calls the original org-remember-kill.  It works as I expect in most cases but not always.

First, the relevant elisp code is:

(define-key global-map "\C-cr" 'org-remember)
(defun org-remember-kill-my ()
  (interactive)
  (unless org-remember-mode
    (error "This does not seem to be a remember buffer for Org-mode"))
  (let ((beg (point-min)) 
	(case-fold-search t))
    (beginning-of-buffer)
    (search-forward-regexp "^* " nil t)
    (setq beg (or (match-end 0) beg))
    (goto-char (point-max))
    (skip-chars-backward " \n\r\t")
    (copy-region-as-kill beg (point))
    )
  (org-remember-kill))
(eval-after-load "org-remember" 
		 '(define-key org-remember-mode-map (kbd "C-c r") 'org-remember-kill-my))
(eval-after-load "org-remember" 
		 '(define-key org-remember-mode-map (kbd "C-c C-k") 'org-remember-kill-my))


When I bring up remember window and then writes "one two three" (without quotes), and 
kills one word (by pressing <C-backspace>, which calls backward-kill-word) and press 
C-c C-k or C-c r (which calls the wrapper org-remember-kill-my, then the saved content 
is not "one two ", it's "threeone two". 

The odd thing doesn't happen if I call my wrapper function with M-x, or if I move my cursor
after <C-backspace> and before pressing C-c C-k or C-c r.

It's as if the append-next-kill command is being called somewhere. 
How should I fix my wrapper?


      

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

* Re: something odd with org-remember-mode and kill-ring-save
  2009-12-05 14:40 something odd with org-remember-mode and kill-ring-save Good Bad
@ 2009-12-17  7:42 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-12-17  7:42 UTC (permalink / raw)
  To: Good Bad; +Cc: Emacs Org-mode


On Dec 5, 2009, at 3:40 PM, Good Bad wrote:

> I made a wrapped version of org-remember-kill which saves the  
> remember content to the kill ring and then calls the original org- 
> remember-kill.  It works as I expect in most cases but not always.
>
> First, the relevant elisp code is:
>
> (define-key global-map "\C-cr" 'org-remember)
> (defun org-remember-kill-my ()
>  (interactive)
>  (unless org-remember-mode
>    (error "This does not seem to be a remember buffer for Org-mode"))
>  (let ((beg (point-min))
> 	(case-fold-search t))
>    (beginning-of-buffer)
>    (search-forward-regexp "^* " nil t)
>    (setq beg (or (match-end 0) beg))
>    (goto-char (point-max))
>    (skip-chars-backward " \n\r\t")
>    (copy-region-as-kill beg (point))
>    )
>  (org-remember-kill))
> (eval-after-load "org-remember"
> 		 '(define-key org-remember-mode-map (kbd "C-c r") 'org-remember- 
> kill-my))
> (eval-after-load "org-remember"
> 		 '(define-key org-remember-mode-map (kbd "C-c C-k") 'org-remember- 
> kill-my))
>
>
> When I bring up remember window and then writes "one two  
> three" (without quotes), and
> kills one word (by pressing <C-backspace>, which calls backward-kill- 
> word) and press
> C-c C-k or C-c r (which calls the wrapper org-remember-kill-my, then  
> the saved content
> is not "one two ", it's "threeone two".
>
> The odd thing doesn't happen if I call my wrapper function with M-x,  
> or if I move my cursor
> after <C-backspace> and before pressing C-c C-k or C-c r.
>
> It's as if the append-next-kill command is being called somewhere.
> How should I fix my wrapper?

Set last-command to something that is not a kill command.

- Carsten

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

end of thread, other threads:[~2009-12-17  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-05 14:40 something odd with org-remember-mode and kill-ring-save Good Bad
2009-12-17  7:42 ` 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).