* bug#19436: 24.4; dired-insert-subdir with saveplace
@ 2014-12-24 14:24 Tak Kunihiro
2014-12-25 19:31 ` Juri Linkov
0 siblings, 1 reply; 3+ messages in thread
From: Tak Kunihiro @ 2014-12-24 14:24 UTC (permalink / raw)
To: 19436; +Cc: tak.kunihiro
On `dired-insert-subdir' with saveplace on, point goes to random place.
0. emacs -Q
1. (require 'saveplace)
2. (setq-default save-place t)
3. M-x dired
4. M-x dired-insert-subdir
5. I expect point goes to top of the new inserted directory.
However, it goes to random place.
6. It seems that it has something to do with dired-initial-position-hook
in dired-initial-position.
In GNU Emacs 24.4.1 (i686-pc-mingw32)
of 2014-10-25 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/usr'
Important settings:
value of $LANG: ENU
locale-coding-system: cp932
Major mode: Emacs-Lisp
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-x b u g <tab> <tab> <M-backspace> r e p o r t <tab>
<tab> <backspace> <M-backspace> <M-backspace> r e p
o r <tab> <return> s a v e p l a c e SPC + SPC <down-mouse-1>
<mouse-1> <double-down-mouse-1> <double-mouse-1> C-g
<down-mouse-1> <mouse-1> C-g <down-mouse-1> <mouse-1>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
C-g <help-echo> <down-mouse-1> <mouse-1> C-g <help-echo>
<down-mouse-1> <mouse-1> C-x d C-g C-; C-; C-g M-x
C-g C-h C-g C-x C-f C-g C-h f d i r e d C-a p o s i
<tab> <backspace> <backspace> <backspace> <backspace>
C-e - i n i <tab> <return> C-x o C-e C-b C-b C-b <return>
C-n C-n C-p C-p C-f C-f C-f C-f C-f C-f C-f C-M-SPC
M-w C-x 5 2 <switch-frame> <help-echo> <help-echo>
M-x r e p o r <tab> <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
Quit [5 times]
C-; is undefined [2 times]
Quit [2 times]
C-h C-g is undefined
Quit
Making completion list...
Type C-x 1 to delete the help window.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr find-func dired 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 help-fns mail-prsvr mail-utils help-mode easymenu
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win w32-vars
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
w32notify w32 multi-tty emacs)
Memory information:
((conses 8 81635 14902)
(symbols 32 17881 0)
(miscs 32 61 231)
(strings 16 13041 4284)
(string-bytes 1 322092)
(vectors 8 10161)
(vector-slots 4 401031 5646)
(floats 8 67 243)
(intervals 28 462 0)
(buffers 508 15))
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#19436: 24.4; dired-insert-subdir with saveplace
2014-12-24 14:24 bug#19436: 24.4; dired-insert-subdir with saveplace Tak Kunihiro
@ 2014-12-25 19:31 ` Juri Linkov
2014-12-27 0:40 ` Juri Linkov
0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2014-12-25 19:31 UTC (permalink / raw)
To: Tak Kunihiro; +Cc: 19436
> On `dired-insert-subdir' with saveplace on, point goes to random place.
>
> 0. emacs -Q
> 1. (require 'saveplace)
> 2. (setq-default save-place t)
> 3. M-x dired
> 4. M-x dired-insert-subdir
> 5. I expect point goes to top of the new inserted directory.
> However, it goes to random place.
> 6. It seems that it has something to do with dired-initial-position-hook
> in dired-initial-position.
Thanks for the report. Subdir saving was not supported by
dired-initial-position until now. It's implemented by this patch:
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index a25dba2..a081794 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -153,7 +153,7 @@ (defun toggle-save-place (&optional parg)
\(setq-default save-place t)"
(interactive "P")
(if (not (or buffer-file-name (and (derived-mode-p 'dired-mode)
- dired-directory)))
+ (dired-current-directory))))
(message "Buffer `%s' not visiting a file or directory" (buffer-name))
(setq save-place (if parg
(> (prefix-numeric-value parg) 0)
@@ -172,12 +172,13 @@ (defun save-place-to-alist ()
;; file. If not, do so, then feel free to modify the alist. It
;; 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 (derived-mode-p 'dired-mode)
- dired-directory
- (expand-file-name (if (consp dired-directory)
- (car dired-directory)
- dired-directory))))))
+ (let* ((directory (and (derived-mode-p 'dired-mode)
+ (dired-current-directory)))
+ (item (or buffer-file-name
+ (and directory
+ (expand-file-name (if (consp directory)
+ (car directory)
+ directory))))))
(when (and item
(or (not save-place-ignore-files-regexp)
(not (string-match save-place-ignore-files-regexp
@@ -186,8 +187,7 @@ (defun save-place-to-alist ()
(position (cond ((eq major-mode 'hexl-mode)
(with-no-warnings
(1+ (hexl-current-address))))
- ((and (derived-mode-p 'dired-mode)
- dired-directory)
+ ((and (derived-mode-p 'dired-mode) directory)
(let ((filename (dired-get-filename nil t)))
(if filename
`((dired-filename . ,filename))
@@ -305,7 +305,7 @@ (defun save-places-to-alist ()
;; save-place checks buffer-file-name too, but we can avoid
;; overhead of function call by checking here too.
(and (or buffer-file-name (and (derived-mode-p 'dired-mode)
- dired-directory))
+ (dired-current-directory)))
(save-place-to-alist))
(setq buf-list (cdr buf-list))))))
@@ -325,12 +325,13 @@ (declare-function dired-goto-file "dired" (file))
(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 (and (derived-mode-p 'dired-mode)
- dired-directory
- (expand-file-name (if (consp dired-directory)
- (car dired-directory)
- dired-directory)))
- save-place-alist)))
+ (let* ((directory (and (derived-mode-p 'dired-mode)
+ (dired-current-directory)))
+ (cell (assoc (and directory
+ (expand-file-name (if (consp directory)
+ (car directory)
+ directory)))
+ save-place-alist)))
(if cell
(progn
(or revert-buffer-in-progress-p
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-27 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-24 14:24 bug#19436: 24.4; dired-insert-subdir with saveplace Tak Kunihiro
2014-12-25 19:31 ` Juri Linkov
2014-12-27 0:40 ` Juri Linkov
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).