From: Grant Rettke <gcr@wisdomandwonder.com>
To: Emacs Help <help-gnu-emacs@gnu.org>
Subject: Unsure of error in passing an anonymous function to another function
Date: Sat, 15 Aug 2015 21:44:25 -0500 [thread overview]
Message-ID: <CAAjq1mcFTf5=f2FSKjBGPuL7OTTftLuCPsjyFMdpZ-Kk5nhTJg@mail.gmail.com> (raw)
Good evening,
Emacs-Lisp question.
Emacs: 24.4.1.
Lexical binding: nil
Trying to refactor a function. Broke it down by my intention:
• Save excursion
• Go to start of buffer
• Do something (In this case just insert some text to see that is is working)
Expected result
• To see "XXX" at the start of the buffer
Actual result
• save-excursion: Symbol's function definition is void: fn
• the function `fn' is not known to be defined.
To address this I started by reading more on Emacs-Lisp and scoping and
function definitions.
What am I doing wrong?
┌────
│ (defun doer (fn)
│ (interactive)
│ (save-excursion
│ (goto-char (point-min))
│ (fn)))
│
│ (defun useit ()
│ (interactive)
│ (doer
│ (lambda ()
│ (insert "XXX"))))
│
│ (useit)
└────
Grant Rettke
--
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
“All creativity is an extended form of a joke.” --Kay
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson
next reply other threads:[~2015-08-16 2:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-16 2:44 Grant Rettke [this message]
2015-08-16 2:56 ` Unsure of error in passing an anonymous function to another function Ian Zimmerman
[not found] ` <mailman.8406.1439693823.904.help-gnu-emacs@gnu.org>
2015-08-16 3:05 ` Rusi
2015-08-17 7:53 ` Joost Kremers
2015-08-17 17:41 ` Grant Rettke
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAjq1mcFTf5=f2FSKjBGPuL7OTTftLuCPsjyFMdpZ-Kk5nhTJg@mail.gmail.com' \
--to=gcr@wisdomandwonder.com \
--cc=help-gnu-emacs@gnu.org \
/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 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.