unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
@ 2014-01-17  6:50 Mark Oteiza
  2014-01-17  8:01 ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Oteiza @ 2014-01-17  6:50 UTC (permalink / raw)
  To: 16477


From emacs -Q:

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




In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2014-01-17 on holos
Repository revision: 
Windowing system distributor `The X.Org Foundation', version 11.0.11500000
Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=lucid --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
 --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: EShell

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-: M-( s e q <backspace> t q - d e f <tab> SPC s a 
v e - p l a c t <backspace> <tab> SPC t <return> M-: 
M-( r e q u i <tab> SPC ' s a v e p <tab> <return> 
M-x e s h <tab> <return> C-x C-c M-x r e p o <tab> 
r <tab> <return>

Recent messages:
Loading em-glob...done
Loading em-hist...done
Loading em-ls...done
Loading em-prompt...done
Loading em-script...done
Loading em-term...done
Loading em-unix...done
(No files need saving)
save-place-to-alist: Symbol's function definition is void: dired-get-filename
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode em-unix em-term term disp-table easymenu
ehelp em-script em-prompt em-ls cl-loaddefs cl-lib em-hist em-pred
em-glob em-dirs em-cmpl em-basic em-banner em-alias pcomplete comint
ansi-color ring esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg
esh-groups eshell esh-module esh-mode esh-util saveplace eldoc help-fns
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting x-toolkit x multi-tty emacs)





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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  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
  2014-01-17 14:38   ` Stefan Monnier
  2014-01-18  2:20   ` Glenn Morris
  0 siblings, 2 replies; 9+ messages in thread
From: Juri Linkov @ 2014-01-17  8:01 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: 16477

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






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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  2014-01-17  8:01 ` Juri Linkov
@ 2014-01-17 14:38   ` Stefan Monnier
  2014-01-18  2:20   ` Glenn Morris
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-01-17 14:38 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Mark Oteiza, 16477

>  		       (if (consp dired-directory)
>  			   (expand-file-name (car dired-directory))
>  			 (expand-file-name dired-directory))))))

Unrelated, but couldn't resist:

		       (expand-file-name (if (consp dired-directory)
                                             (car dired-directory)
			                   dired-directory))))))

-- Stefan





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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  2014-01-17  8:01 ` Juri Linkov
  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:52     ` Juri Linkov
  1 sibling, 2 replies; 9+ messages in thread
From: Glenn Morris @ 2014-01-18  2:20 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Mark Oteiza, 16477

Juri Linkov wrote:

> `eshell' sets the variable `dired-directory'

Why does it do that?





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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2014-01-19  3:02 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Mark Oteiza, 16477

>> `eshell' sets the variable `dired-directory'
> Why does it do that?

Maybe it should use list-buffers-directory instead?


        Stefan





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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  2014-01-18  2:20   ` Glenn Morris
  2014-01-19  3:02     ` Stefan Monnier
@ 2014-01-20  8:52     ` Juri Linkov
  2014-01-20 17:02       ` Glenn Morris
  1 sibling, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2014-01-20  8:52 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Mark Oteiza, 16477

>> `eshell' sets the variable `dired-directory'
>
> Why does it do that?

Maybe some external packages rely on it to implement
closer integration with dired?





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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  2014-01-19  3:02     ` Stefan Monnier
@ 2014-01-20  8:55       ` Juri Linkov
  0 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2014-01-20  8:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Mark Oteiza, 16477-done

>>> `eshell' sets the variable `dired-directory'
>> Why does it do that?
>
> Maybe it should use list-buffers-directory instead?

Actually I see that eshell-mode sets both dired-directory
and list-buffers-directory, so it seems that authors of eshell
think both are necessary.





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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  2014-01-20  8:52     ` Juri Linkov
@ 2014-01-20 17:02       ` Glenn Morris
  2014-01-20 18:19         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2014-01-20 17:02 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Mark Oteiza, 16477

Juri Linkov wrote:

> Maybe some external packages rely on it to implement closer
> integration with dired?

Then why does no other part of Emacs set dired-directory, except for
dired itself? Eg M-x shell does not. It has no effect on M-x dired. I
imagine setting default-directory after cd does all that is necessary.

Since this is ancient code from the very first version of eshell,
personally I suspect it is simply a mistake.





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

* bug#16477: 24.3.50; [saveplace] symbol's function defn is void: dired-get-filename
  2014-01-20 17:02       ` Glenn Morris
@ 2014-01-20 18:19         ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2014-01-20 18:19 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Mark Oteiza, 16477

> Since this is ancient code from the very first version of eshell,
> personally I suspect it is simply a mistake.

Agreed,


        Stefan





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

end of thread, other threads:[~2014-01-20 18:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).