summaryrefslogtreecommitdiff
path: root/lisp/net/newst-treeview.el
diff options
context:
space:
mode:
authorUlf Jasper <ulf.jasper@web.de>2021-02-19 17:07:36 +0100
committerUlf Jasper <ulf.jasper@web.de>2021-02-19 17:07:36 +0100
commit6830199984b9964286fda8e4c904ce84aa68e514 (patch)
treeca3bdb3a5ac39fe475136606860a8c7526a3bfe8 /lisp/net/newst-treeview.el
parentd4f6927d48043d01929a93da53a64b1e4296f994 (diff)
downloademacs-6830199984b9964286fda8e4c904ce84aa68e514.tar.gz
Enable newsticker--group-shift-feed-(up|down) to move groups as well
Fix broken newsticker--group-shift-group-(up-down). * lisp/net/newst-treeview.el (newsticker-treeview-jump): Change prompt string. (newsticker--group-shift): Move the group when a group is currently selected. Fix error when explicitly shifting a group. (Fixes first issue in Bug#41376.)
Diffstat (limited to 'lisp/net/newst-treeview.el')
-rw-r--r--lisp/net/newst-treeview.el30
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index cf55f66e780..a2d4d89ee55 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1626,7 +1626,7 @@ Return t if a new feed was activated, nil otherwise."
(interactive
(list (let ((completion-ignore-case t))
(completing-read
- "Jump to feed: "
+ "Jump to feed/group: "
(append '("new" "obsolete" "immortal" "all")
(mapcar #'car (append newsticker-url-list
newsticker-url-list-defaults)))
@@ -1852,28 +1852,34 @@ of the shift. If MOVE-GROUP is nil the currently selected feed
`newsticker--treeview-current-feed' is shifted, if it is t then
the current feed's parent group is shifted.."
(let* ((cur-feed newsticker--treeview-current-feed)
- (thing (if move-group
- (newsticker--group-find-parent-group cur-feed)
+ (thing (if (and move-group
+ (not (newsticker--group-get-group cur-feed)))
+ (car (newsticker--group-find-parent-group cur-feed))
cur-feed))
(parent-group (newsticker--group-find-parent-group
- (if move-group (car thing) thing))))
+ ;;(if move-group (car thing) thing)
+ thing)))
(unless parent-group
(error "Group not found!"))
(let* ((siblings (cdr parent-group))
- (pos (cl-position thing siblings :test 'equal))
+ (pos (cl-position thing siblings :test
+ (lambda (o1 o2)
+ (equal (if (listp o1) (car o1) o1)
+ (if (listp o2) (car o2) o2)))))
(tpos (+ pos delta ))
(new-pos (max 0 (min (length siblings) tpos)))
(beg (cl-subseq siblings 0 (min pos new-pos)))
(end (cl-subseq siblings (+ 1 (max pos new-pos))))
(p (elt siblings new-pos)))
(when (not (= pos new-pos))
- (setcdr parent-group
- (cl-concatenate 'list
- beg
- (if (> delta 0)
- (list p thing)
- (list thing p))
- end))
+ (let ((th (or (newsticker--group-get-group thing) thing)))
+ (setcdr parent-group
+ (cl-concatenate 'list
+ beg
+ (if (> delta 0)
+ (list p th)
+ (list th p))
+ end)))
(newsticker--treeview-tree-update)
(newsticker-treeview-update)
(newsticker-treeview-jump cur-feed)))))