changeset 482:f4f05bb53234

[xemacs-hg @ 2001-04-24 14:40:09 by hrvojen] Use compose-mail for mailto links. Published in <sxsoftm4b29.fsf@florida.arsdigita.de>.
author hrvojen
date Tue, 24 Apr 2001 14:40:10 +0000
parents 1662439f54c2
children 991f80dc633d
files lisp/ChangeLog lisp/about.el
diffstat 2 files changed, 35 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Apr 24 14:06:40 2001 +0000
+++ b/lisp/ChangeLog	Tue Apr 24 14:40:10 2001 +0000
@@ -1,3 +1,10 @@
+2001-04-24  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+	* about.el (about-mailto-link): Use compose-mail for sending mail.
+	(about-finish-buffer): Kill/bury the buffer where the user
+	clicked, not the one that happens to be the current buffer at the
+	time.
+
 2001-04-24  Hrvoje Niksic  <hniksic@arsdigita.com>
 
 	* about.el (about-personal-info): Update my bio.
--- a/lisp/about.el	Tue Apr 24 14:06:40 2001 +0000
+++ b/lisp/about.el	Tue Apr 24 14:40:10 2001 +0000
@@ -242,12 +242,16 @@
 		 :tag (or text-to-insert url)
 		 url))
 
-;; Insert a mailto: link in the buffer.
+;; Insert a mail link in the buffer.
 (defun about-mailto-link (address)
-  (about-url-link
-   (concat "mailto:" address) address
-   (concat "Send mail to " address)
-   ))
+  (lexical-let ((address address))
+    (widget-create 'link
+		   :tag address
+		   :button-prefix ""
+		   :button-suffix ""
+		   :action (lambda (widget &optional event)
+			     (compose-mail address))
+		   :help-echo (format "Send mail to %s" address))))
 
 ;; Attach a face to a string, in order to be inserted into the buffer.
 ;; Make sure that the extent is duplicable, but unique.  Returns the
@@ -291,19 +295,29 @@
 	 nil)))
 
 ;; Set up the stuff needed by widget.  Allowed types are `bury' and
-;; `kill'.
+;; `kill'.  The reason why we offer both types is performance: when a
+;; large buffer is merely buried, `about' will find it again when the
+;; user requests it, instead of recreating it.  Small buffers can be
+;; killed because it is cheap to generate their contents.
+
 (defun about-finish-buffer (&optional type)
   (or type (setq type 'bury))
   (widget-insert "\n")
   (if (eq type 'bury)
-      (widget-create 'link :help-echo "Bury buffer"
-		     :action (lambda (&rest ignore)
-			       (bury-buffer))
-		     "Remove")
-    (widget-create 'link :help-echo "Kill buffer"
-		   :action (lambda (&rest ignore)
-			     (kill-buffer (current-buffer)))
-		   "Kill"))
+      (widget-create 'link
+		     :help-echo "Bury this buffer"
+		     :action (lambda (widget event)
+			       ;; For some reason,
+			       ;; (bury-buffer (event-buffer event))
+			       ;; doesn't work.
+			       (with-selected-window (event-window event)
+				 (bury-buffer)))
+		     :tag "Bury")
+    (widget-create 'link
+		   :help-echo "Kill this buffer"
+		   :action (lambda (widget event)
+			     (kill-buffer (event-buffer event)))
+		   :tag "Kill"))
   (widget-insert " this buffer and return to previous.\n")
   (use-local-map (make-sparse-keymap))
   (set-keymap-parent (current-local-map) widget-keymap)