diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-04-13 15:51:15 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-04-13 15:51:15 -0400 |
commit | 84e0b7dad6f1a8e53261f9b96f5a9080fea681a4 (patch) | |
tree | 99dd57860e7fa4c01de3e4032388db3a1d1f0518 /lisp/erc | |
parent | b430d2a836f5a1bc8d8ae996893bb8338fc4780b (diff) | |
download | emacs-84e0b7dad6f1a8e53261f9b96f5a9080fea681a4.tar.gz |
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
pre-redisplay-functions.
* 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.
(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
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* 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.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
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.
Diffstat (limited to 'lisp/erc')
-rw-r--r-- | lisp/erc/erc-stamp.el | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index 1ec3f32a81e..cbcd055c3b0 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -114,7 +114,7 @@ If `erc-timestamp-format' is set, this will not be used." (string))) (defcustom erc-insert-away-timestamp-function - 'erc-insert-timestamp-left-and-right + #'erc-insert-timestamp-left-and-right "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." (t (- (window-width) str-width 1)))) (from (point)) - (col (current-column)) - indent) + (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)) 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." (erc-munge-invisibility-spec))) (erc-buffer-list))) -(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 stamp)))))) |