all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Mark Oteiza <mvoteiza@udel.edu>
Cc: 16477@debbugs.gnu.org
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	[thread overview]
Message-ID: <87mwiv595h.fsf@mail.jurta.org> (raw)
In-Reply-To: <871u07p0e2.fsf@holos.localdomain> (Mark Oteiza's message of "Fri, 17 Jan 2014 01:50:45 -0500")

> (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






  reply	other threads:[~2014-01-17  8:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17  6:50 bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename Mark Oteiza
2014-01-17  8:01 ` Juri Linkov [this message]
2014-01-17 14:38   ` Stefan Monnier
2014-01-18  2:20   ` Glenn Morris
2014-01-19  3:02     ` Stefan Monnier
2014-01-20  8:55       ` Juri Linkov
2014-01-20  8:52     ` Juri Linkov
2014-01-20 17:02       ` Glenn Morris
2014-01-20 18:19         ` Stefan Monnier

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=87mwiv595h.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=16477@debbugs.gnu.org \
    --cc=mvoteiza@udel.edu \
    /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.