X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d0079c9324e575107b8a90944c9012dd3842946c..c430f7e23fc2c22f251ace4254e37dea1452dfc3:/lisp/wid-edit.el diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index e98ac18fc5..10b10456f3 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1,6 +1,6 @@ ;;; wid-edit.el --- Functions for creating and using widgets -*-byte-compile-dynamic: t; lexical-binding:t -*- ;; -;; Copyright (C) 1996-1997, 1999-2015 Free Software Foundation, Inc. +;; Copyright (C) 1996-1997, 1999-2016 Free Software Foundation, Inc. ;; ;; Author: Per Abrahamsen ;; Maintainer: emacs-devel@gnu.org @@ -102,8 +102,6 @@ This exists as a variable so it can be set locally in certain buffers.") "Face used for documentation text." :group 'widget-documentation :group 'widget-faces) -(define-obsolete-face-alias 'widget-documentation-face - 'widget-documentation "22.1") (defvar widget-button-face 'widget-button "Face used for buttons in widgets. @@ -112,7 +110,6 @@ This exists as a variable so it can be set locally in certain buffers.") (defface widget-button '((t (:weight bold))) "Face used for widget buttons." :group 'widget-faces) -(define-obsolete-face-alias 'widget-button-face 'widget-button "22.1") (defcustom widget-mouse-face 'highlight "Face used for widget buttons when the mouse is above them." @@ -135,7 +132,6 @@ This exists as a variable so it can be set locally in certain buffers.") :slant italic)) "Face used for editable fields." :group 'widget-faces) -(define-obsolete-face-alias 'widget-field-face 'widget-field "22.1") (defface widget-single-line-field '((((type tty)) :background "green3" @@ -150,8 +146,6 @@ This exists as a variable so it can be set locally in certain buffers.") :slant italic)) "Face used for editable fields spanning only a single line." :group 'widget-faces) -(define-obsolete-face-alias 'widget-single-line-field-face - 'widget-single-line-field "22.1") ;;; This causes display-table to be loaded, and not usefully. ;;;(defvar widget-single-line-display-table @@ -427,8 +421,6 @@ the :notify function can't know the new value.") '((t :inherit shadow)) "Face used for inactive widgets." :group 'widget-faces) -(define-obsolete-face-alias 'widget-inactive-face - 'widget-inactive "22.1") (defun widget-specify-inactive (widget from to) "Make WIDGET inactive for user modifications." @@ -905,8 +897,6 @@ Note that such modes will need to require wid-edit.") (:weight bold :underline t))) "Face used for pressed buttons." :group 'widget-faces) -(define-obsolete-face-alias 'widget-button-pressed-face - 'widget-button-pressed "22.1") (defvar widget-button-click-moves-point nil "If non-nil, `widget-button-click' moves point to a button after invoking it. @@ -1267,7 +1257,7 @@ When not inside a field, signal an error." (defun widget-field-find (pos) "Return the field at POS. -Unlike (get-char-property POS 'field), this works with empty fields too." +Unlike (get-char-property POS \\='field), this works with empty fields too." (let ((fields widget-field-list) field found) (while fields @@ -1676,7 +1666,7 @@ as the argument to `documentation-property'." (cond ((functionp doc-prop) (funcall doc-prop value)) ((symbolp doc-prop) - (documentation-property value doc-prop))))))) + (documentation-property value doc-prop t))))))) (when (and (stringp doc) (> (length doc) 0)) ;; Remove any redundant `*' in the beginning. (when (eq (aref doc 0) ?*) @@ -1789,7 +1779,13 @@ If END is omitted, it defaults to the length of LIST." "An embedded link." :button-prefix 'widget-link-prefix :button-suffix 'widget-link-suffix - :follow-link 'mouse-face + ;; The `follow-link' property should only be used in those contexts where the + ;; mouse-1 event normally doesn't follow the link, yet the `link' widget + ;; seems to almost always be used in contexts where (down-)mouse-1 is bound + ;; to `widget-button-click' and hence the "mouse-1 to mouse-2" remapping is + ;; not necessary (and can even be harmful). So let's not add a :follow-link + ;; by default. See (bug#22434). + ;; :follow-link 'mouse-face :help-echo "Follow the link." :format "%[%t%]") @@ -2654,8 +2650,7 @@ Return an alist of (TYPE MATCH)." (save-excursion (let ((children (widget-get widget :children)) (inhibit-read-only t) - before-change-functions - after-change-functions) + (inhibit-modification-hooks t)) (cond (before (goto-char (widget-get before :entry-from))) (t @@ -2679,8 +2674,7 @@ Return an alist of (TYPE MATCH)." (let ((buttons (copy-sequence (widget-get widget :buttons))) button (inhibit-read-only t) - before-change-functions - after-change-functions) + (inhibit-modification-hooks t)) (while buttons (setq button (car buttons) buttons (cdr buttons)) @@ -2691,8 +2685,7 @@ Return an alist of (TYPE MATCH)." (let ((entry-from (widget-get child :entry-from)) (entry-to (widget-get child :entry-to)) (inhibit-read-only t) - before-change-functions - after-change-functions) + (inhibit-modification-hooks t)) (widget-delete child) (delete-region entry-from entry-to) (set-marker entry-from nil) @@ -3477,10 +3470,10 @@ themselves. A list, for example, is defined as either nil, or a cons cell whose cdr itself is a list. The obvious way to translate this into a widget type would be - (define-widget 'my-list 'choice + (define-widget \\='my-list \\='choice \"A list of sexps.\" :tag \"Sexp list\" - :args '((const nil) (cons :value (nil) sexp my-list))) + :args \\='((const nil) (cons :value (nil) sexp my-list))) Here we attempt to define my-list as a choice of either the constant nil, or a cons-cell containing a sexp and my-lisp. This will not work @@ -3489,10 +3482,10 @@ because the `choice' widget does not allow recursion. Using the `lazy' widget you can overcome this problem, as in this example: - (define-widget 'sexp-list 'lazy + (define-widget \\='sexp-list \\='lazy \"A list of sexps.\" :tag \"Sexp list\" - :type '(choice (const nil) (cons :value (nil) sexp sexp-list)))" + :type \\='(choice (const nil) (cons :value (nil) sexp sexp-list)))" :format "%{%t%}: %v" ;; We don't convert :type because we want to allow recursive ;; data structures. This is slow, so we should not create speed