all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Meaning of the hash character
@ 2008-11-20 13:35 Nordlöw
  2008-11-20 14:16 ` Juanma Barranquero
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nordlöw @ 2008-11-20 13:35 UTC (permalink / raw)
  To: help-gnu-emacs

I have long wondered about the meaning of the hash character # in
emacs lisp.

Here is an example taken from hl-line.el
(add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t)

What effect does it have?

/Nordlöw


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Meaning of the hash character
  2008-11-20 13:35 Meaning of the hash character Nordlöw
@ 2008-11-20 14:16 ` Juanma Barranquero
  2008-11-20 17:45 ` Barry Margolin
  2008-11-20 20:39 ` Nikolaj Schumacher
  2 siblings, 0 replies; 4+ messages in thread
From: Juanma Barranquero @ 2008-11-20 14:16 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

On Thu, Nov 20, 2008 at 14:35, Nordlöw <per.nordlow@gmail.com> wrote:

> I have long wondered about the meaning of the hash character # in
> emacs lisp.

From the "Anonymous Functions" node of the Emacs Lisp Reference:

   The read syntax `#'' is a short-hand for using `function'.  For
example,

     #'(lambda (x) (* x x))

is equivalent to

     (function (lambda (x) (* x x)))

 -- Special Form: function function-object
     This special form returns FUNCTION-OBJECT without evaluating it.
     In this, it is equivalent to `quote'.  However, it serves as a
     note to the Emacs Lisp compiler that FUNCTION-OBJECT is intended
     to be used only as a function, and therefore can safely be
     compiled.  Contrast this with `quote', in *Note Quoting::.

   *Note describe-symbols example::, for a realistic example using
`function' and an anonymous function.

  Juanma

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Meaning of the hash character
  2008-11-20 13:35 Meaning of the hash character Nordlöw
  2008-11-20 14:16 ` Juanma Barranquero
@ 2008-11-20 17:45 ` Barry Margolin
  2008-11-20 20:39 ` Nikolaj Schumacher
  2 siblings, 0 replies; 4+ messages in thread
From: Barry Margolin @ 2008-11-20 17:45 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

In article 
<15d554aa-7f1c-45e5-a26f-017bd6258140@d32g2000yqe.googlegroups.com>,
 Nordlöw <per.nordlow@gmail.com> wrote:

> I have long wondered about the meaning of the hash character # in
> emacs lisp.
> 
> Here is an example taken from hl-line.el
> (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t)
> 
> What effect does it have?
> 
> /Nordlöw

#' is to 'function' as ' is to 'quote', i.e.

'foo ==> (quote foo)
#'foo ==> (function foo)

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Meaning of the hash character
  2008-11-20 13:35 Meaning of the hash character Nordlöw
  2008-11-20 14:16 ` Juanma Barranquero
  2008-11-20 17:45 ` Barry Margolin
@ 2008-11-20 20:39 ` Nikolaj Schumacher
  2 siblings, 0 replies; 4+ messages in thread
From: Nikolaj Schumacher @ 2008-11-20 20:39 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

Nordlöw <per.nordlow@gmail.com> wrote:

> I have long wondered about the meaning of the hash character # in
> emacs lisp.
>
> Here is an example taken from hl-line.el
> (add-hook 'change-major-mode-hook #'hl-line-unhighlight nil t)
>
> What effect does it have?

From the manual:

We sometimes write `function' instead of `quote' when quoting the name
of a function, but this usage is just a sort of comment:

     (function SYMBOL) == (quote SYMBOL) == 'SYMBOL

The read syntax `#'' is a short-hand for using `function'.



regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-20 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-20 13:35 Meaning of the hash character Nordlöw
2008-11-20 14:16 ` Juanma Barranquero
2008-11-20 17:45 ` Barry Margolin
2008-11-20 20:39 ` Nikolaj Schumacher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.