From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: help-gnu-emacs@gnu.org
Subject: hooks and let-bound variables
Date: Tue, 23 Jun 2015 21:15:06 +0200 [thread overview]
Message-ID: <m2si9i6xtx.fsf@polytechnique.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]
Hello,
I’m trying to get eshell-autojump to work
(http://www.emacswiki.org/emacs/EshellAutojump) but I’m getting errors
about an undefined variable (curdir). This variable is bound by a let
before a hook is called:
#+begin_src emacs-lisp
(let ((curdir (eshell/pwd)))
(unless (equal curdir dired-directory)
(eshell-add-to-dir-ring curdir))
(let ((result (cd dired-directory)))
(and eshell-cd-shows-directory
(eshell-printn result)))
(run-hooks 'eshell-directory-change-hook)
...
#+end_src
and here is the hook that is called:
#+begin_src emacs-lisp
(defun eshell-autojump-record ()
"Record the current directory.
`curdir' is set by `eshell/cd'."
(unless eshell-autojump-map
(eshell-autojump-load))
(if (gethash curdir eshell-autojump-map)
(puthash curdir (1+ (gethash curdir eshell-autojump-map)) eshell-autojump-map)
(puthash curdir 1 eshell-autojump-map)))
#+end_src
I tried to edebug this, and curdir is set before the hook is called, but
it is not set in the called function. Is there a reason why it is not
set?
I'm using emacs 24.5.1.
Thanks,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Weekly CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
next reply other threads:[~2015-06-23 19:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 19:15 Alan Schmitt [this message]
2015-06-23 21:44 ` hooks and let-bound variables Drew Adams
2015-06-24 9:13 ` Alan Schmitt
2015-06-24 13:22 ` Drew Adams
2015-06-24 13:35 ` Alan Schmitt
2015-06-24 14:44 ` Drew Adams
2015-06-24 15:48 ` tomas
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=m2si9i6xtx.fsf@polytechnique.org \
--to=alan.schmitt@polytechnique.org \
--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.