From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename Date: Fri, 17 Jan 2014 10:01:46 +0200 Organization: JURTA Message-ID: <87mwiv595h.fsf@mail.jurta.org> References: <871u07p0e2.fsf@holos.localdomain> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389945851 24116 80.91.229.3 (17 Jan 2014 08:04:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Jan 2014 08:04:11 +0000 (UTC) Cc: 16477@debbugs.gnu.org To: Mark Oteiza Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 17 09:04:17 2014 Return-path: Envelope-to: geb-bug-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 1W44PZ-0007bL-3y for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Jan 2014 09:04:17 +0100 Original-Received: from localhost ([::1]:36724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44PY-0000dq-Mi for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Jan 2014 03:04:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44PQ-0000dh-R6 for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2014 03:04:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W44PK-0000Lz-RO for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2014 03:04:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W44PK-0000Lv-NP for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2014 03:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W44PK-0002H8-6H for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2014 03:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Jan 2014 08:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16477 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16477-submit@debbugs.gnu.org id=B16477.13899458168705 (code B ref 16477); Fri, 17 Jan 2014 08:04:02 +0000 Original-Received: (at 16477) by debbugs.gnu.org; 17 Jan 2014 08:03:36 +0000 Original-Received: from localhost ([127.0.0.1]:54368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W44Ot-0002GK-Gr for submit@debbugs.gnu.org; Fri, 17 Jan 2014 03:03:35 -0500 Original-Received: from [69.163.184.122] (port=33097 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W44Oq-0002G8-O4 for 16477@debbugs.gnu.org; Fri, 17 Jan 2014 03:03:33 -0500 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.184.122]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 0A9DE301D00931; Fri, 17 Jan 2014 00:03:30 -0800 (PST) In-Reply-To: <871u07p0e2.fsf@holos.localdomain> (Mark Oteiza's message of "Fri, 17 Jan 2014 01:50:45 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83628 Archived-At: > (setq-default save-place t) > (require 'saveplace) > (eshell) > (kill-emacs) > Debugger entered--Lisp error: (void-function dired-get-filename) > dired-get-filename(nil t) > save-place-to-alist() > save-places-to-alist() > save-place-kill-emacs-hook() > kill-emacs() > eval((kill-emacs) nil) > eval-expression((kill-emacs) nil) > call-interactively(eval-expression nil nil) > command-execute(eval-expression) Thanks for the report. `eshell' sets the variable `dired-directory', so we have to check if we are in dired mode as well: === modified file 'lisp/saveplace.el' --- lisp/saveplace.el 2014-01-01 07:43:34 +0000 +++ lisp/saveplace.el 2014-01-17 08:01:20 +0000 @@ -152,7 +152,8 @@ (defun toggle-save-place (&optional parg \(setq-default save-place t\)" (interactive "P") - (if (not (or buffer-file-name dired-directory)) + (if (not (or buffer-file-name (and (derived-mode-p 'dired-mode) + dired-directory))) (message "Buffer `%s' not visiting a file or directory" (buffer-name)) (if (and save-place (or (not parg) (<= parg 0))) (progn @@ -172,7 +173,8 @@ (defun save-place-to-alist () ;; will be saved again when Emacs is killed. (or save-place-loaded (load-save-place-alist-from-file)) (let ((item (or buffer-file-name - (and dired-directory + (and (derived-mode-p 'dired-mode) + dired-directory (if (consp dired-directory) (expand-file-name (car dired-directory)) (expand-file-name dired-directory)))))) @@ -184,7 +186,8 @@ (defun save-place-to-alist () (position (cond ((eq major-mode 'hexl-mode) (with-no-warnings (1+ (hexl-current-address)))) - (dired-directory + ((and (derived-mode-p 'dired-mode) + dired-directory) (let ((filename (dired-get-filename nil t))) (if filename `((dired-filename . ,filename)) @@ -301,7 +304,8 @@ (defun save-places-to-alist () (with-current-buffer (car buf-list) ;; save-place checks buffer-file-name too, but we can avoid ;; overhead of function call by checking here too. - (and (or buffer-file-name dired-directory) + (and (or buffer-file-name (and (derived-mode-p 'dired-mode) + dired-directory)) (save-place-to-alist)) (setq buf-list (cdr buf-list)))))) @@ -321,9 +325,11 @@ (declare-function dired-goto-file "dired (defun save-place-dired-hook () "Position the point in a dired buffer." (or save-place-loaded (load-save-place-alist-from-file)) - (let ((cell (assoc (if (consp dired-directory) - (expand-file-name (car dired-directory)) - (expand-file-name dired-directory)) + (let ((cell (assoc (and (derived-mode-p 'dired-mode) + dired-directory + (if (consp dired-directory) + (expand-file-name (car dired-directory)) + (expand-file-name dired-directory))) save-place-alist))) (if cell (progn