unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* hooks and let-bound variables
@ 2015-06-23 19:15 Alan Schmitt
  2015-06-23 21:44 ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2015-06-23 19:15 UTC (permalink / raw)
  To: help-gnu-emacs

[-- 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 --]

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

end of thread, other threads:[~2015-06-24 15:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 19:15 hooks and let-bound variables Alan Schmitt
2015-06-23 21:44 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).