[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUGFIX] w3m-session-delete [PATCH]
In [emacs-w3m:12847]
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
(point) 'w3m-session-number))
(sessions w3m-session-select-sessions))
- (w3m-session-select-quit)
(w3m-session-rename sessions num)
- (w3m-session-select)
- (forward-line num)))
+ (w3m-session-select num)))
(defun w3m-session-select-delete ()
"Delete the session."
@@ -646,12 +644,12 @@
(sessions w3m-session-select-sessions))
(w3m-session-select-quit)
(w3m-session-delete sessions num)
- (w3m-session-select)
- (forward-line num))))
+ (w3m-session-select num))))
;;;###autoload
-(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."
(interactive)
(w3m-session-ignore-errors
(let* ((sessions (w3m-load-list w3m-session-file))
@@ -680,7 +678,8 @@
(error nil))
(switch-to-buffer showbuf)
(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)
"Goto URLs."
@@ -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))
(cond
((string= title "")
(setq title nil