From 62f44662538ae73558d921812efa85599272a12a Mon Sep 17 00:00:00 2001 From: Per Abrahamsen Date: Fri, 4 Jul 1997 09:44:36 +0000 Subject: [PATCH] Synched with 1.9944. --- lisp/cus-edit.el | 2 +- lisp/wid-edit.el | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index eb80e462a24..c6ff8495213 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4,7 +4,7 @@ ;; ;; Author: Per Abrahamsen ;; Keywords: help, faces -;; Version: 1.9942 +;; Version: 1.9944 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ ;; This file is part of GNU Emacs. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 198599ba6ed..c84a6894bb9 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -4,7 +4,7 @@ ;; ;; Author: Per Abrahamsen ;; Keywords: extensions -;; Version: 1.9942 +;; Version: 1.9944 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ ;; This file is part of GNU Emacs. @@ -129,6 +129,7 @@ is the string or buffer containing the text." :link '(custom-manual "(widget)Top") :link '(url-link :tag "Development Page" "http://www.dina.kvl.dk/~abraham/custom/") + :link '(emacs-library-link :tag "Lisp File" "widget.el") :prefix "widget-" :group 'extensions :group 'hypermedia) @@ -391,10 +392,13 @@ new value." ;; at the end of the overlay. (save-excursion (goto-char to) - (when widget-field-add-space - (insert-and-inherit " ")) + (cond ((null (widget-get widget :size)) + (forward-char 1)) + (widget-field-add-space + (insert-and-inherit " "))) (setq to (point))) - (if widget-field-add-space + (if (or widget-field-add-space + (null (widget-get widget :size))) (add-text-properties (1- to) to '(front-sticky nil start-open t read-only to)) (add-text-properties to (1+ to) @@ -404,7 +408,9 @@ new value." (let ((map (widget-get widget :keymap)) (face (or (widget-get widget :value-face) 'widget-field-face)) (help-echo (widget-get widget :help-echo)) - (overlay (make-overlay from to nil nil t))) + (overlay (make-overlay from to nil + nil (or (not widget-field-add-space) + (widget-get widget :size))))) (unless (or (stringp help-echo) (null help-echo)) (setq help-echo 'widget-mouse-help)) (widget-put widget :field-overlay overlay) @@ -1268,7 +1274,8 @@ When not inside a field, move to the previous button or field." "Return the end of WIDGET's editing field." (let ((overlay (widget-get widget :field-overlay))) ;; Don't subtract one if local-map works at the end of the overlay. - (and overlay (if widget-field-add-space + (and overlay (if (or widget-field-add-space + (null (widget-get widget :size))) (1- (overlay-end overlay)) (overlay-end overlay))))) @@ -1785,6 +1792,26 @@ If END is omitted, it defaults to the length of LIST." (require 'browse-url) (funcall browse-url-browser-function (widget-value widget))) +;;; The `file-link' Widget. + +(define-widget 'file-link 'link + "A link to a file." + :action 'widget-file-link-action) + +(defun widget-file-link-action (widget &optional event) + "Find the file specified by WIDGET." + (find-file (widget-value widget))) + +;;; The `emacs-library-link' Widget. + +(define-widget 'emacs-library-link 'link + "A link to an Emacs Lisp library file." + :action 'widget-emacs-library-link-action) + +(defun widget-emacs-library-link-action (widget &optional event) + "Find the Emacs Library file specified by WIDGET." + (find-file (locate-library (widget-value widget)))) + ;;; The `editable-field' Widget. (define-widget 'editable-field 'default -- 2.39.2