emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Good Bad <nbko3@yahoo.com>
Cc: Emacs Org-mode <emacs-orgmode@gnu.org>
Subject: Re: something odd with org-remember-mode and kill-ring-save
Date: Thu, 17 Dec 2009 08:42:36 +0100	[thread overview]
Message-ID: <6082468C-E9CC-4A76-B7CC-F02E6A3A0013@gmail.com> (raw)
In-Reply-To: <109899.17894.qm@web45104.mail.sp1.yahoo.com>


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	other threads:[~2009-12-17  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-05 14:40 something odd with org-remember-mode and kill-ring-save Good Bad
2009-12-17  7:42 ` Carsten Dominik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6082468C-E9CC-4A76-B7CC-F02E6A3A0013@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nbko3@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).