emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] something odd with org-remember-mode and kill-ring-save


From: Carsten Dominik
Subject: Re: [Orgmode] something odd with org-remember-mode and kill-ring-save
Date: Thu, 17 Dec 2009 08:42:36 +0100


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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]