Commit 84e0b7da authored by Stefan Monnier's avatar Stefan Monnier

Deprecate `intangible' and `point-entered' properties

* lisp/emacs-lisp/cursor-sensor.el: New file.

* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on

* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it.  Use cursor-intangible rather
than point-entered to make the prompt intangible.

* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.

* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.

* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'.  Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook.  Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.

* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec.  Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
(erc-insert-timestamp-right): Remove unused vars `current-window' and

* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.

* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.

* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.

* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.

* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only.  Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.

* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
parent b430d2a8
......@@ -693,6 +693,13 @@ word syntax, use `\sw' instead.
* Lisp Changes in Emacs 25.1
** New hook `pre-redisplay-functions', a bit easier to use than pre-redisplay-function.
** Obsolete text properties `intangible', `point-entered', and `point-left'.
Replaced by properties `cursor-intangible' and `cursor-sensor-functions',
implemented by the new `cursor-intangible-mode' and
`cursor-sensor-mode' minor modes.
** New process type `pipe', which can be used in combination with the
`:stderr' keyword of make-process to handle standard error output
of subprocess.
;;; cus-start.el --- define customization properties of builtins
;;; cus-start.el --- define customization properties of builtins -*- lexical-binding:t -*-
;; Copyright (C) 1997, 1999-2015 Free Software Foundation, Inc.
......@@ -33,6 +33,14 @@
;;; Code:
(defun minibuffer-prompt-properties--setter (symbol value)
(set-default symbol value)
(if (memq 'cursor-intangible value)
(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode)
;; Removing it is a bit trickier since it could have been added by someone
;; else as well, so let's just not bother.
;; Elements of this list have the form:
;; SYMBOL is the name of the variable.
......@@ -46,7 +54,23 @@
;; :risky - risky-local-variable property
;; :safe - safe-local-variable property
;; :tag - custom-tag property
(let ((all '(;; alloc.c
(let (standard native-p prop propval
;; This function turns a value
;; into an expression which produces that value.
(quoter (lambda (sexp)
;; FIXME: We'd like to use macroexp-quote here, but cus-start
;; is loaded too early in loadup.el for that.
(if (or (memq sexp '(t nil))
(keywordp sexp)
(and (listp sexp)
(memq (car sexp) '(lambda)))
(stringp sexp)
(numberp sexp))
(list 'quote sexp)))))
(`(,symbol ,group ,type ,version . ,rest)
'(;; alloc.c
(gc-cons-threshold alloc integer)
(gc-cons-percentage alloc float)
(garbage-collection-messages alloc boolean)
......@@ -269,10 +293,10 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
(make-pointer-invisible mouse boolean "23.2")
(menu-bar-mode frames boolean nil
; :initialize custom-initialize-default
;; :initialize custom-initialize-default
:set custom-set-minor-mode)
(tool-bar-mode (frames mouse) boolean nil
; :initialize custom-initialize-default
;; :initialize custom-initialize-default
:set custom-set-minor-mode)
(frame-resize-pixelwise frames boolean "24.4")
(frame-inhibit-implied-resize frames
......@@ -342,14 +366,15 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
:doc "Prevent point from ever entering prompt"
:format "%t%n%h"
:inline t
(point-entered minibuffer-avoid-prompt)))
(cursor-intangible t)))
(repeat :inline t
:tag "Other Properties"
(list :inline t
:format "%v"
(symbol :tag "Property")
(sexp :tag "Value"))))
:set minibuffer-prompt-properties--setter)
(minibuffer-auto-raise minibuffer boolean)
;; options property set at end
(read-buffer-function minibuffer
......@@ -550,27 +575,7 @@ since it could result in memory overflow and make Emacs crash."
(x-select-enable-clipboard-manager killing boolean "24.1")
;; xsettings.c
(font-use-system-font font-selection boolean "23.2")))
this symbol group type standard version native-p rest prop propval
;; This function turns a value
;; into an expression which produces that value.
(quoter (lambda (sexp)
(if (or (memq sexp '(t nil))
(keywordp sexp)
(and (listp sexp)
(memq (car sexp) '(lambda)))
(stringp sexp)
(numberp sexp))
(list 'quote sexp)))))
(while all
(setq this (car all)
all (cdr all)
symbol (nth 0 this)
group (nth 1 this)
type (nth 2 this)
version (nth 3 this)
rest (nthcdr 4 this)
;; If we did not specify any standard value expression above,
(setq ;; If we did not specify any standard value expression above,
;; use the current value as the standard value.
standard (if (setq prop (memq :standard rest))
(cadr prop)
;;; cursor-sensor.el --- React to cursor movement -*- lexical-binding: t; -*-
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Stefan Monnier <>
;; Keywords:
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <>.
;;; Commentary:
;; This package implements the `cursor-intangible' property, which is
;; meant to replace the old `intangible' property. To use it, just enable the
;; `cursor-intangible-mode', after which this package will move point away from
;; any position that has a non-nil `cursor-intangible' property. This is only
;; done just before redisplay happens, contrary to the old `intangible'
;; property which was done at a much lower level.
;;; Code:
(defvar cursor-sensor-inhibit nil)
(defun cursor-sensor--intangible-p (pos)
(let ((p (get-pos-property pos 'cursor-intangible)))
(if p
(let (a b)
(if (and (setq a (get-char-property pos 'cursor-intangible))
(setq b (if (> pos (point-min))
(get-char-property (1- pos) 'cursor-intangible)))
(not (eq a b)))
;; If we're right between two different intangible thingies,
;; we can stop here. This is not quite consistent with the
;; interpretation of "if it's sticky, then this boundary is
;; itself intangible", but it's convenient (and it better matches
;; the behavior of `intangible', making it easier to port code).
nil p))
(defun cursor-sensor-tangible-pos (curpos window &optional second-chance)
(let ((newpos curpos))
(when (cursor-sensor--intangible-p newpos)
(let ((oldpos (window-parameter window 'cursor-intangible--last-point)))
((or (and (integerp oldpos) (< oldpos newpos))
(eq newpos (point-min)))
(when (< newpos (point-max))
(setq newpos
(if (get-char-property newpos 'cursor-intangible)
newpos 'cursor-intangible nil (point-max))
(1+ newpos)))
(cursor-sensor--intangible-p newpos))))
(t ;; (>= oldpos newpos)
(when (> newpos (point-min))
(setq newpos
(if (get-char-property (1- newpos) 'cursor-intangible)
newpos 'cursor-intangible nil (point-min))
(1- newpos)))
(cursor-sensor--intangible-p newpos)))))
(if (not (and (or (eq newpos (point-min)) (eq newpos (point-max)))
(cursor-sensor--intangible-p newpos)))
;; All clear, we're good to go.
;; We're still on an intangible position because we bumped
;; into an intangible BOB/EOB: try to move in the other direction.
(if second-chance
;; Actually, we tried already and that failed!
(cursor-sensor-tangible-pos newpos window 'second-chance)))))))
(defun cursor-sensor-move-to-tangible (window)
(let* ((curpos (window-point window))
(newpos (cursor-sensor-tangible-pos curpos window)))
(when newpos (set-window-point window newpos))
(set-window-parameter window 'cursor-intangible--last-point
(or newpos curpos))))
(defun cursor-sensor--move-to-tangible (window)
(unless cursor-sensor-inhibit
(cursor-sensor-move-to-tangible window)))
(define-minor-mode cursor-intangible-mode
"Keep cursor outside of any `cursor-intangible' text property."
nil nil nil
(if cursor-intangible-mode
(add-hook 'pre-redisplay-functions #'cursor-sensor--move-to-tangible
nil t)
(remove-hook 'pre-redisplay-functions #'cursor-sensor--move-to-tangible t)))
;;; Detect cursor movement.
(defun cursor-sensor--detect (window)
(unless cursor-sensor-inhibit
(let* ((point (window-point window))
;; It's often desirable to make the cursor-sensor-functions property
;; non-sticky on both ends, but that means get-pos-property might
;; never see it.
(new (or (get-char-property point 'cursor-sensor-functions)
(unless (bobp)
(get-char-property (1- point) 'cursor-sensor-functions))))
(old (window-parameter window 'cursor-sensor--last-state))
(oldposmark (car old))
(oldpos (or (if oldposmark (marker-position oldposmark))
(start (min oldpos point))
(end (max oldpos point)))
(unless (or (null old) (eq (marker-buffer oldposmark) (current-buffer)))
;; `window' does not display the same buffer any more!
(setcdr old nil))
(if (or (and (null new) (null (cdr old)))
(and (eq new (cdr old))
(eq (next-single-property-change
start 'cursor-sensor-functions nil end)
;; Clearly nothing to do.
;; Maybe something to do. Let's see exactly what needs to run.
(let* ((missing-p
(lambda (f)
"Non-nil if F is missing somewhere between START and END."
(let ((pos start)
(missing nil))
(while (< pos end)
(setq pos (next-single-property-change
pos 'cursor-sensor-functions
nil end))
(unless (memq f (get-char-property
pos 'cursor-sensor-functions))
(setq missing t)))
(dolist (f (cdr old))
(unless (and (memq f new) (not (funcall missing-p f)))
(funcall f window oldpos 'left)))
(dolist (f new)
(unless (and (memq f (cdr old)) (not (funcall missing-p f)))
(funcall f window oldpos 'entered)))))
;; Remember current state for next time.
;; Re-read cursor-sensor-functions since the functions may have moved
;; window-point!
(if old
(progn (move-marker (car old) point)
(setcdr old new))
(set-window-parameter window 'cursor-sensor--last-state
(cons (copy-marker point) new))))))
(define-minor-mode cursor-sensor-mode
"Handle the `cursor-sensor-functions' text property.
This property should hold a list of functions which react to the motion
of the cursor. They're called with three arguments (WINDOW OLDPOS DIR)
where WINDOW is the affected window, OLDPOS is the last known position of
the cursor and DIR can be `left' or `entered' depending on whether the cursor is
entering the area covered by the text-property property or leaving it."
nil nil nil
(if cursor-sensor-mode
(add-hook 'pre-redisplay-functions #'cursor-sensor--detect
nil t)
(remove-hook 'pre-redisplay-functions #'cursor-sensor--detect
(provide 'cursor-sensor)
;;; cursor-sensor.el ends here
......@@ -114,7 +114,7 @@ If `erc-timestamp-format' is set, this will not be used."
(defcustom erc-insert-away-timestamp-function
"Function to use to insert the away timestamp.
See `erc-insert-timestamp-function' for details."
......@@ -161,12 +161,12 @@ from entering them and instead jump over them."
;;;###autoload (autoload 'erc-timestamp-mode "erc-stamp" nil t)
(define-erc-module stamp timestamp
"This mode timestamps messages in the channel buffers."
((add-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
(add-hook 'erc-insert-modify-hook 'erc-add-timestamp t)
(add-hook 'erc-send-modify-hook 'erc-add-timestamp t))
((remove-hook 'erc-mode-hook 'erc-munge-invisibility-spec)
(remove-hook 'erc-insert-modify-hook 'erc-add-timestamp)
(remove-hook 'erc-send-modify-hook 'erc-add-timestamp)))
((add-hook 'erc-mode-hook #'erc-munge-invisibility-spec)
(add-hook 'erc-insert-modify-hook #'erc-add-timestamp t)
(add-hook 'erc-send-modify-hook #'erc-add-timestamp t))
((remove-hook 'erc-mode-hook #'erc-munge-invisibility-spec)
(remove-hook 'erc-insert-modify-hook #'erc-add-timestamp)
(remove-hook 'erc-send-modify-hook #'erc-add-timestamp)))
(defun erc-add-timestamp ()
"Add timestamp and text-properties to message.
......@@ -188,7 +188,8 @@ or `erc-send-modify-hook'."
(add-text-properties (point-min) (point-max)
(list 'timestamp ct))
(add-text-properties (point-min) (point-max)
(list 'point-entered 'erc-echo-timestamp)))))
(list 'cursor-sensor-functions
(list #'erc-echo-timestamp))))))
(defvar erc-timestamp-last-inserted nil
"Last timestamp inserted into the buffer.")
......@@ -289,8 +290,7 @@ be printed just before the window-width."
(setq erc-timestamp-last-inserted string)
(goto-char (point-max))
(forward-char -1);; before the last newline
(let* ((current-window (get-buffer-window (current-buffer)))
(str-width (string-width string))
(let* ((str-width (string-width string))
(pos (cond
(erc-timestamp-right-column erc-timestamp-right-column)
((and (boundp 'erc-fill-mode)
......@@ -303,8 +303,7 @@ be printed just before the window-width."
(- (window-width) str-width 1))))
(from (point))
(col (current-column))
(col (current-column)))
;; The following is a kludge used to calculate whether to move
;; to the next line before inserting a stamp. It allows for
;; some margin of error if what is displayed on the line differs
......@@ -319,9 +318,9 @@ be printed just before the window-width."
(erc-put-text-property from (point) 'field 'erc-timestamp)
(erc-put-text-property from (point) 'rear-nonsticky t)
(when erc-timestamp-intangible
(erc-put-text-property from (1+ (point)) 'intangible t)))))
(erc-put-text-property from (1+ (point)) 'cursor-intangible t)))))
(defun erc-insert-timestamp-left-and-right (string)
(defun erc-insert-timestamp-left-and-right (_string)
"This is another function that can be assigned to
`erc-insert-timestamp-function'. If the date is changed, it will
print a blank line, the date, and another blank line. If the time is
......@@ -356,7 +355,7 @@ Return the empty string if FORMAT is nil."
;; inelegant, hack. -- BPT
(and erc-timestamp-intangible
(not erc-hide-timestamps) ; bug#11706
(erc-put-text-property 0 (length ts) 'intangible t ts))
(erc-put-text-property 0 (length ts) 'cursor-intangible t ts))
......@@ -366,15 +365,13 @@ Return the empty string if FORMAT is nil."
;; please modify this function and move it to a more appropriate
;; location.
(defun erc-munge-invisibility-spec ()
(and erc-timestamp-intangible (not (bound-and-true-p cursor-intangible-mode))
(cursor-intangible-mode 1))
(and erc-echo-timestamps (not (bound-and-true-p cursor-sensor-mode))
(cursor-sensor-mode 1))
(if erc-hide-timestamps
(setq buffer-invisibility-spec
(if (listp buffer-invisibility-spec)
(cons 'timestamp buffer-invisibility-spec)
(list 't 'timestamp)))
(setq buffer-invisibility-spec
(if (listp buffer-invisibility-spec)
(remove 'timestamp buffer-invisibility-spec)
(list 't)))))
(add-to-invisibility-spec 'timespec)
(remove-from-invisibility-spec 'timespec)))
(defun erc-hide-timestamps ()
"Hide timestamp information from display."
......@@ -405,12 +402,11 @@ enabled when the message was inserted."
(defun erc-echo-timestamp (before now)
"Print timestamp text-property of an IRC message.
Argument BEFORE is where point was before it got moved and
NOW is position of point currently."
(when erc-echo-timestamps
(let ((stamp (get-text-property now 'timestamp)))
(defun erc-echo-timestamp (window _before dir)
"Print timestamp text-property of an IRC message."
(when (and erc-echo-timestamps (eq 'entered dir))
(let* ((now (window-point window))
(stamp (get-text-property now 'timestamp)))
(when stamp
(message "%s" (format-time-string erc-echo-timestamp-format
......@@ -297,9 +297,6 @@
;;; Global variables and constants:
(provide 'forms) ;;; official
(provide 'forms-mode) ;;; for compatibility
(defcustom forms-mode-hook nil
"Hook run upon entering Forms mode."
:group 'forms
......@@ -443,6 +440,7 @@ Also, initial position is at last record."
(defun forms-mode (&optional primary)
;; FIXME: use define-derived-mode
"Major mode to visit files in a field-structured manner using a form.
Commands: Equivalent keys in read-only mode:
......@@ -637,6 +635,8 @@ Commands: Equivalent keys in read-only mode:
(setq major-mode 'forms-mode)
(setq mode-name "Forms")
(cursor-intangible-mode 1)
;; find the data file
(setq forms--file-buffer (find-file-noselect forms-file))
......@@ -647,7 +647,7 @@ Commands: Equivalent keys in read-only mode:
(with-current-buffer forms--file-buffer
(let ((inhibit-read-only t)
(file-modified (buffer-modified-p)))
(run-hooks 'read-file-filter)
(mapc #'funcall read-file-filter)
(if (not file-modified) (set-buffer-modified-p nil)))
(if write-file-filter
(add-hook 'write-file-functions write-file-filter nil t)))
......@@ -921,7 +921,7 @@ Commands: Equivalent keys in read-only mode:
,@(if (numberp (car forms-format-list))
'((add-text-properties (point-min) (1+ (point-min))
'(front-sticky (read-only intangible)))))
'(front-sticky (read-only cursor-intangible)))))
;; Prevent insertion after the last text.
(remove-text-properties (1- (point)) (point)
......@@ -1005,10 +1005,10 @@ Commands: Equivalent keys in read-only mode:
(list 'face forms--ro-face ; read-only appearance
'read-only ,@(list (1+ forms--marker))
'intangible ,@(list (1+ forms--marker))
'cursor-intangible ,@(list (1+ forms--marker))
'insert-in-front-hooks '(forms--iif-hook)
'rear-nonsticky '(face read-only insert-in-front-hooks
((numberp el)
`((let ((here (point)))
......@@ -1034,10 +1034,10 @@ Commands: Equivalent keys in read-only mode:
(list 'face forms--ro-face
'read-only ,@(list (1+ forms--marker))
'intangible ,@(list (1+ forms--marker))
'cursor-intangible ,@(list (1+ forms--marker))
'insert-in-front-hooks '(forms--iif-hook)
'rear-nonsticky '(read-only face insert-in-front-hooks
;; end of cond
......@@ -2055,4 +2055,6 @@ Usage: (setq forms-number-of-fields
(goto-char (point-max))
(insert ret)))))
(provide 'forms-mode) ; for compatibility
(provide 'forms)
;;; forms.el ends here
......@@ -478,6 +478,26 @@ simple manner.")
(defvar gnus-group-edit-buffer nil)
(defvar gnus-tmp-news-method)
(defvar gnus-tmp-colon)
(defvar gnus-tmp-news-server)
(defvar gnus-tmp-decoded-group)
(defvar gnus-tmp-header)
(defvar gnus-tmp-process-marked)
(defvar gnus-tmp-summary-live)
(defvar gnus-tmp-news-method-string)
(defvar gnus-tmp-group-icon)
(defvar gnus-tmp-moderated-string)
(defvar gnus-tmp-newsgroup-description)
(defvar gnus-tmp-comment)
(defvar gnus-tmp-qualified-group)
(defvar gnus-tmp-subscribed)
(defvar gnus-tmp-number-of-read)
(defvar gnus-inhibit-demon)
(defvar gnus-pick-mode)
(defvar gnus-tmp-marked-mark)
(defvar gnus-tmp-number-of-unread)
(defvar gnus-group-line-format-alist
`((?M gnus-tmp-marked-mark ?c)
(?S gnus-tmp-subscribed ?c)
......@@ -1140,8 +1160,7 @@ The following commands are available:
(let ((gnus-process-mark ?\200)
(gnus-group-update-hook nil)
(gnus-group-marked '(""))
(gnus-active-hashtb (make-vector 10 0))
(topic ""))
(gnus-active-hashtb (make-vector 10 0)))
(gnus-set-active "" '(0 . 0))
(gnus-group-insert-group-line "" 0 nil 0 nil)
......@@ -1574,7 +1593,7 @@ if it is a string, only list groups matching REGEXP."
gnus-process-mark ? ))
(buffer-read-only nil)
beg end
header gnus-tmp-header) ; passed as parameter to user-funcs.
gnus-tmp-header) ; passed as parameter to user-funcs.
(setq beg (point))
......@@ -1592,20 +1611,31 @@ if it is a string, only list groups matching REGEXP."
gnus-indentation ,gnus-group-indentation
gnus-level ,gnus-tmp-level))
(setq end (point))
(when gnus-group-update-tool-bar
(gnus-put-text-property beg end 'point-entered
(gnus-put-text-property beg end 'point-left
(gnus-group--setup-tool-bar-update beg end)
(forward-line -1)
(when (inline (gnus-visual-p 'group-highlight 'highlight))
(gnus-group-highlight-line gnus-tmp-group beg end))
(gnus-run-hooks 'gnus-group-update-hook)
(defun gnus-group--setup-tool-bar-update (beg end)
(when gnus-group-update-tool-bar
(if (fboundp 'cursor-sensor-mode)
(unless (bound-and-true-p cursor-sensor-mode)
(cursor-sensor-mode 1))
(gnus-put-text-property beg end 'cursor-sensor-functions
(gnus-put-text-property beg end 'point-entered
(gnus-put-text-property beg end 'point-left
(defun gnus-group-update-eval-form (group list)
"Eval `car' of each element of LIST, and return the first that return t.
Some value are bound so the form can use them."
(defvar group-age) (defvar ticked) (defvar score) (defvar level)
(defvar mailp) (defvar total) (defvar unread)
(when list
(let* ((entry (gnus-group-entry group))
(unread (if (numberp (car entry)) (car entry) 0))
......@@ -3107,8 +3137,8 @@ If SOLID (the prefix), create a solid group."
(defvar nnrss-group-alist)
(defun nnrss-discover-feed (arg))
(defun nnrss-save-server-data (arg)))
(defun nnrss-discover-feed (_arg))
(defun nnrss-save-server-data (_arg)))
(defun gnus-group-make-rss-group (&optional url)
"Given a URL, discover if there is an RSS feed.
If there is, use Gnus to create an nnrss group"
......@@ -3757,7 +3787,7 @@ group line."
nil nil (gnus-read-active-file-p))))
(let ((newsrc (gnus-group-entry group)))
((string-match "^[ \t]*$" group)
((string-match "\\`[ \t]*\\'" group)
(error "Empty group name"))
;; Toggle subscription flag.
......@@ -154,7 +154,7 @@ See Info node `(gnus)Formatting Variables'."
"Go to TOPIC."
(list (gnus-completing-read "Go to topic" (gnus-topic-list) t)))
(let ((buffer-read-only nil))
(let ((inhibit-read-only t))
(dolist (topic (gnus-current-topics topic))
(unless (gnus-topic-goto-topic topic)
(gnus-topic-goto-missing-topic topic)
......@@ -427,7 +427,7 @@ If PREDICATE is a function, list groups that the function returns non-nil;
if it is t, list groups that have no unread articles.
If LOWEST is non-nil, list all newsgroups of level LOWEST or higher."
(set-buffer gnus-group-buffer)
(let ((buffer-read-only nil)
(let ((inhibit-read-only t)
(lowest (or lowest 1))
(and gnus-group-listed-groups
......@@ -582,11 +582,7 @@ articles in the topic and its subtopics."
(not (eq (nth 2 type) 'hidden))
level all-entries unread))
(gnus-topic-update-unreads (car type) unread)
(when gnus-group-update-tool-bar
(gnus-put-text-property beg end 'point-entered
(gnus-put-text-property beg end 'point-left
(gnus-group--setup-tool-bar-update beg end)
(goto-char end)
......@@ -684,7 +680,7 @@ articles in the topic and its subtopics."
(let ((group (gnus-group-group-name))
(m (point-marker))
(buffer-read-only nil))
(inhibit-read-only t))
(when (and group
(gnus-get-info group)
(gnus-topic-goto-topic (gnus-current-topic)))
......@@ -902,7 +898,7 @@ articles in the topic and its subtopics."
(defun gnus-topic-change-level (group level oldlevel &optional previous)
"Run when changing levels to enter/remove groups from topics."
(with-current-buffer gnus-group-buffer
(let ((buffer-read-only nil))
(let ((inhibit-read-only t))
(unless gnus-topic-inhibit-change-level
(gnus-group-goto-group (or (car (nth 2 previous)) group))
(when (and gnus-topic-mode
......@@ -1131,22 +1127,17 @@ articles in the topic and its subtopics."
["Edit parameters" gnus-topic-edit-parameters t])
["List active" gnus-topic-list-active t]))))
(defun gnus-topic-mode (&optional arg redisplay)
(define-minor-mode gnus-topic-mode
"Minor mode for topicsifying Gnus group buffers."
;; FIXME: Use define-minor-mode.
(interactive (list current-prefix-arg t))
(when (eq major-mode 'gnus-group-mode)