changeset 18598:e12b4c195b2b

Synched with 1.9944.
author Per Abrahamsen <abraham@dina.kvl.dk>
date Fri, 04 Jul 1997 09:44:36 +0000
parents 515b7c955cd8
children bdb4c815ce21
files lisp/cus-edit.el lisp/wid-edit.el
diffstat 2 files changed, 34 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/cus-edit.el	Fri Jul 04 05:07:07 1997 +0000
+++ b/lisp/cus-edit.el	Fri Jul 04 09:44:36 1997 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; 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.
--- a/lisp/wid-edit.el	Fri Jul 04 05:07:07 1997 +0000
+++ b/lisp/wid-edit.el	Fri Jul 04 09:44:36 1997 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; 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 @@
   :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 @@
   ;; 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 @@
   (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 @@
   "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 @@
   (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