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



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to