help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: goof in small function where???


From: Michael Heerdegen
Subject: Re: goof in small function where???
Date: Tue, 22 Jul 2014 12:02:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux)

ken <gebser@mousecar.com> writes:

> (defun file-name-into-kill-buffer ()
> "Put path/filename of current buffer onto kill-ring so to paste
> into an X application.  Also display it in minibuffer."
> (interactive)
>      (let ((str (buffer-file-name)))
>        (and str
>             (kill-new str)
>             (message "Copied filename %s to kill ring" str)))
> )

This doesn't work when `kill-new' returns nil, which happens when
`interprogram-cut-function' is nil (which is the default).  Note that
the doc of `kill-new' doesn't say anything about the return value, it
can be anything.

Ergo: the `and' should better be a `when'.




reply via email to

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