aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2018-04-16 23:10:03 +0200
committerLars Ingebrigtsen2018-04-16 23:10:03 +0200
commitc8be645598a53423e4b30954a502f2cfcdf1b434 (patch)
tree89922ad9e9eeb0ad0a62dc0813496ce64cdff868
parent36e5673753b985dee06b255be237dce9e96b0eb7 (diff)
downloademacs-c8be645598a53423e4b30954a502f2cfcdf1b434.tar.gz
emacs-c8be645598a53423e4b30954a502f2cfcdf1b434.zip
Fix inconsistent point movement in the Gnus group buffer
* lisp/gnus/gnus-group.el (gnus-group-goto-group): If we can't find the group we're looking for, then don't move point at all (bug#23021).
-rw-r--r--lisp/gnus/gnus-group.el92
1 files changed, 47 insertions, 45 deletions
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index d1f258fd92a..a53adecd110 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2565,51 +2565,53 @@ If PROMPT (the prefix) is a number, use the prompt specified in
2565If FAR, it is likely that the group is not on the current line. 2565If FAR, it is likely that the group is not on the current line.
2566If TEST-MARKED, the line must be marked." 2566If TEST-MARKED, the line must be marked."
2567 (when group 2567 (when group
2568 (beginning-of-line) 2568 (let ((start (point)))
2569 (cond 2569 (beginning-of-line)
2570 ;; It's quite likely that we are on the right line, so 2570 (cond
2571 ;; we check the current line first. 2571 ;; It's quite likely that we are on the right line, so
2572 ((and (not far) 2572 ;; we check the current line first.
2573 (eq (get-text-property (point) 'gnus-group) 2573 ((and (not far)
2574 (gnus-intern-safe group gnus-active-hashtb)) 2574 (eq (get-text-property (point) 'gnus-group)
2575 (or (not test-marked) (gnus-group-mark-line-p))) 2575 (gnus-intern-safe group gnus-active-hashtb))
2576 (point)) 2576 (or (not test-marked) (gnus-group-mark-line-p)))
2577 ;; Previous and next line are also likely, so we check them as well. 2577 (point))
2578 ((and (not far) 2578 ;; Previous and next line are also likely, so we check them as well.
2579 (save-excursion 2579 ((and (not far)
2580 (forward-line -1) 2580 (save-excursion
2581 (and (eq (get-text-property (point) 'gnus-group) 2581 (forward-line -1)
2582 (gnus-intern-safe group gnus-active-hashtb)) 2582 (and (eq (get-text-property (point) 'gnus-group)
2583 (or (not test-marked) (gnus-group-mark-line-p))))) 2583 (gnus-intern-safe group gnus-active-hashtb))
2584 (forward-line -1) 2584 (or (not test-marked) (gnus-group-mark-line-p)))))
2585 (point)) 2585 (forward-line -1)
2586 ((and (not far) 2586 (point))
2587 (save-excursion 2587 ((and (not far)
2588 (forward-line 1) 2588 (save-excursion
2589 (and (eq (get-text-property (point) 'gnus-group) 2589 (forward-line 1)
2590 (gnus-intern-safe group gnus-active-hashtb)) 2590 (and (eq (get-text-property (point) 'gnus-group)
2591 (or (not test-marked) (gnus-group-mark-line-p))))) 2591 (gnus-intern-safe group gnus-active-hashtb))
2592 (forward-line 1) 2592 (or (not test-marked) (gnus-group-mark-line-p)))))
2593 (point)) 2593 (forward-line 1)
2594 (test-marked 2594 (point))
2595 (goto-char (point-min)) 2595 (test-marked
2596 (let (found) 2596 (goto-char (point-min))
2597 (while (and (not found) 2597 (let (found)
2598 (gnus-goto-char 2598 (while (and (not found)
2599 (text-property-any 2599 (gnus-goto-char
2600 (point) (point-max) 2600 (text-property-any
2601 'gnus-group 2601 (point) (point-max)
2602 (gnus-intern-safe group gnus-active-hashtb)))) 2602 'gnus-group
2603 (if (gnus-group-mark-line-p) 2603 (gnus-intern-safe group gnus-active-hashtb))))
2604 (setq found t) 2604 (if (gnus-group-mark-line-p)
2605 (forward-line 1))) 2605 (setq found t)
2606 found)) 2606 (forward-line 1)))
2607 (t 2607 found))
2608 ;; Search through the entire buffer. 2608 (t
2609 (gnus-goto-char 2609 ;; Search through the entire buffer.
2610 (text-property-any 2610 (unless (gnus-goto-char
2611 (point-min) (point-max) 2611 (text-property-any
2612 'gnus-group (gnus-intern-safe group gnus-active-hashtb))))))) 2612 (point-min) (point-max)
2613 'gnus-group (gnus-intern-safe group gnus-active-hashtb)))
2614 (goto-char start)))))))
2613 2615
2614(defun gnus-group-next-group (n &optional silent) 2616(defun gnus-group-next-group (n &optional silent)
2615 "Go to next N'th newsgroup. 2617 "Go to next N'th newsgroup.