From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Schmitt Newsgroups: gmane.emacs.help Subject: hooks and let-bound variables Date: Tue, 23 Jun 2015 21:15:06 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1435086944 23094 80.91.229.3 (23 Jun 2015 19:15:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jun 2015 19:15:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 23 21:15:38 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z7TfV-0006WO-RH for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2015 21:15:37 +0200 Original-Received: from localhost ([::1]:47087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7TfV-00026n-3h for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2015 15:15:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7TfJ-00026V-I8 for help-gnu-emacs@gnu.org; Tue, 23 Jun 2015 15:15:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7TfD-0005FK-92 for help-gnu-emacs@gnu.org; Tue, 23 Jun 2015 15:15:25 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:56094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7TfD-0005Eq-2F for help-gnu-emacs@gnu.org; Tue, 23 Jun 2015 15:15:19 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z7TfB-0006L0-4n for help-gnu-emacs@gnu.org; Tue, 23 Jun 2015 21:15:17 +0200 Original-Received: from cbg35-2-78-242-14-140.fbx.proxad.net ([78.242.14.140]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Jun 2015 21:15:17 +0200 Original-Received: from alan.schmitt by cbg35-2-78-242-14-140.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Jun 2015 21:15:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 66 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: cbg35-2-78-242-14-140.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:wI/If7OA61STHpgwIcUVii8/xk8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105103 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, I=E2=80=99m trying to get eshell-autojump to work (http://www.emacswiki.org/emacs/EshellAutojump) but I=E2=80=99m getting err= ors 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-auto= jump-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 =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Weekly CO=E2=82=82 average (2015-05-30, Mauna Loa Observatory): 403.41 ppm --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJVibA6AAoJEAQNCjtO0uXHpq0H/1ON69SCZl1JK7nepX4Hnzzz +KwLv+PAc4zoOY1mYbkqmlD/ApzwOXOnSsYX6/fmduL4QN93LoW+TSL0brMl9eaU LKOq/YWRJDNLvX/doM0ZamLeQxxp5r1QdUneIda1zMeTtmTPy2bNj/0Lg22+h5ft w0m64DxVMxef5CLd8LbMs+4w0pj8+sAQnNgdPN0uZK13XgKdjUztT4qHsh6RR1eZ m0J4Rj861BumlqDRy1l6yprg34Q7uDrkaQk4JYAluXxewjNenen5WiTb/+/drFyH +LU28SnDs/9hywQzIaPw8oT2+JlAVbr80V5T/lI/h04Q4f5J+VNLUr//Sh6K1C0= =Iu22 -----END PGP SIGNATURE----- --=-=-=--