[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs Lisp Question
From: |
Barry Margolin |
Subject: |
Re: Emacs Lisp Question |
Date: |
Thu, 27 Jun 2013 11:33:00 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.2559.1372339138.22516.help-gnu-emacs@gnu.org>,
drain <aeuster@gmail.com> wrote:
> (defun copy-region-as-kill (beg end)
> "Save the region as if killed, but don't kill it.
> In Transient Mark mode, deactivate the mark.
> If `interprogram-cut-function' is non-nil, also save the text for a
> window
> system cut and paste."
> (interactive "r")
> (if (eq last-command 'kill-region)
> (kill-append (filter-buffer-substring beg end) (< end beg))
> (kill-new (filter-buffer-substring beg end)))
> (if transient-mark-mode
> (setq deactivate-mark t))
> nil)
>
> What is the "nil" doing at the end here? The syntax seems to be:
>
> (defun copy-region-as-kill (beg end) [...] nil)
I suspect it's left over from an old version of the function whose last
expression returned the contents of the kill ring (probably before
transient mark mode was added to Emacs). If you ran it interactively
(e.g. in the *scratch* buffer), this would produce enormous amounts of
output. So they put nil there to avoid this.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***