[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

[BUGFIX] rename buffers in session file [PATCH]



The attached patch fixes a problem I found in my work from a few days
ago, in that the code was not properly searching for existing matches of
a rename operation. What I mean is if one wants to rename 'a' to 'b' and
the name 'b' already exists, that search wasn't being performed
properly.

Note that this patch is incremental after all the previous patches that
I've pushed today. Because of either a limitation in cvs or in my
knowledge of how to use it, the only diffs I could get it to create were
against a repository version, and since that has been static, the diffs
would end up being cumulative instead of incremental. Fortunately, there
were no conflicts, so I took the risk of manually cutting out sections
of the actual diff output that were from prior patches.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
Index: ChangeLog
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/ChangeLog,v
retrieving revision 1.3648
diff -u -r1.3648 ChangeLog
--- ChangeLog	16 Feb 2018 06:53:15 -0000	1.3648
+++ ChangeLog	18 Feb 2018 21:20:10 -0000
@@ -1,3 +1,8 @@
+2018-02-18  Boruch Baum  <boruch_baum@xxxxxxx>
+
+	* w3m-session.el (w3m-session-rename): BUGFIX: had been failing to find
+	buffers with identical names to rename candidate.
+
 2018-02-16  Katsumi Yamaoka  <yamaoka@xxxxxxx>

 	* w3m-fb.el (w3m-fb-mode, w3m-fb-delete-frame-kill-buffers):
Index: w3m-session.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-session.el,v
retrieving revision 1.42
diff -u -r1.42 w3m-session.el
--- w3m-session.el	16 Feb 2018 06:53:15 -0000	1.42
+++ w3m-session.el	18 Feb 2018 21:20:10 -0000
@@ -833,16 +837,15 @@
         (setq prompt (concat title
       		       " is same as original title (C-g to abort): ")
       	title nil))
-       ((assoc title (if group nil sessions)
+       ((and (not group) (assoc title sessions))
         (if (not (y-or-n-p (format "\"%s\" exists. Overwrite? " title)))
             (setq prompt default-prompt
-      	    title nil))
-         (cond
-          (group ; handle *buffer* rename within a session ("session-group")
-            (setq prompt "Not yet supported. Manually delete the other entry, or try again."
-                  title nil))
-          (t
-            (setq sessions (delq (assoc title sessions) sessions))
-            (setq num (seq-position sessions (assoc otitle sessions)))))))))
+      	          title nil)
+         (setq sessions (delq (assoc title sessions) sessions))
+         (setq num (seq-position sessions (assoc otitle sessions)))))
+       ((and group (member title (mapcar (lambda (x) (car (last x))) group)))
+        ; handle *buffer* rename (overwrite existing) within a session ("session-group")
+        (setq prompt "Not yet supported. Manually delete the other entry, or try again. "
+              title nil))))
     ; in this case, wrapper must decrement its copy of num
     ; BB_2018-02-15: I don't understand that comment