[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUGFIX] w3m-session-delete [PATCH]
On Wed, 13 Dec 2017 07:18:51 -0500, Boruch Baum wrote:
> A few days ago, I pushed a patch ~[emacs-w3m:12832] to stop the cursor
> from jumping after deleting a session in the session-select buffer (M-s,
> by default). That patch had a bug in the case of deleting the final item
> on the list. Patch attached.
After deleting (or renaming) a session, the point moves to
the next session (or the current session when renaming), however
the first session looks being selected since it is highlighted
using the `w3m-session-selected' face. How about this instead?
* w3m-session.el (w3m-session-select-rename, w3m-session-select-delete):
Make the selected session highlighted after renaming or deletion.
(w3m-session-select): Allow specifying the session number.
(w3m-session-rename): Use the current title as the initial value.
--- w3m-session.el~ 2017-12-07 06:36:37.848393500 +0000
+++ w3m-session.el 2017-12-14 00:27:12.057684400 +0000
@@ -631,10 +631,8 @@
(let ((num (get-text-property
(w3m-session-rename sessions num)
- (forward-line num)))
+ (w3m-session-select num)))
(defun w3m-session-select-delete ()
"Delete the session."
@@ -646,12 +644,12 @@
(w3m-session-delete sessions num)
- (forward-line num))))
+ (w3m-session-select num))))
-(defun w3m-session-select ()
- "Select session from session list."
+(defun w3m-session-select (&optional n)
+ "Select session from session list.
+Position point at N-th session if N is given."
(let* ((sessions (w3m-load-list w3m-session-file))
@@ -680,7 +678,8 @@
(setq w3m-session-select-wincfg wincfg)
- (w3m-session-select-mode sessions))))
+ (w3m-session-select-mode sessions)
+ (when n (w3m-session-select-next n)))))
(defun w3m-session-goto-session (session)
@@ -723,7 +722,7 @@
(tmp (nth num sessions))
(otitle (car tmp)))
(while (not title)
- (setq title (read-from-minibuffer prompt nil nil nil nil otitle))
+ (setq title (read-from-minibuffer prompt otitle))
((string= title "")
(setq title nil