Gnus development mailing list
 help / color / mirror / Atom feed
* Buttons for M-x customize-*
@ 2005-12-12 18:55 Ralf Angeli
  2005-12-12 22:30 ` Reiner Steib
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Angeli @ 2005-12-12 18:55 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

Following up on a discussion in de.comm.software.gnus I'd like to
propose a change in the handling of `M-x customize-*' buttons.
Currently `customize-apropos' is called on any such string.  This may
result in a little bit unexpected behavior.  Check for example the
result of `M-x customize-face RET highlight RET'.

In my opinion it would be better if the given function were called
exactly instead of `customize-apropos'.  The attached patch
accomplishes this.  The patch also removes support for "custom:" and
"custom:/" type urls which I've never seen before.  Of course this is
discussable.  Keeping it included would either require two separate
functions for handling the customize stuff or a conditionalization
inside of `gnus-button-handle-custom'.  WDYT?

Here is the patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1295 bytes --]

--- gnus-art.el	26 Nov 2005 15:11:37 +0100	7.132
+++ gnus-art.el	12 Dec 2005 19:37:07 +0100	
@@ -6295,9 +6295,10 @@
 	   (gnus-url-mailto url-mailto))
 	  (t (gnus-message 3 "Invalid string.")))))
 
-(defun gnus-button-handle-custom (url)
-  "Follow a Custom URL."
-  (customize-apropos (gnus-url-unhex-string url)))
+(defun gnus-button-handle-custom (fun symbol)
+  "Call function FUN on SYMBOL.
+Both FUN and SYMBOL are supposed to be strings."
+  (funcall (intern fun) (intern symbol)))
 
 (defvar gnus-button-handle-describe-prefix "^\\(C-h\\|<?[Ff]1>?\\)")
 
@@ -6477,10 +6478,8 @@
      ;; Info links like `C-h i d m CC Mode RET'
      0 (>= gnus-button-emacs-level 1) gnus-button-handle-info-keystrokes 2)
     ;; This is custom
-    ("\\bcustom:\\(//\\)?\\([^'\">\n\t ]+\\)"
-     0 (>= gnus-button-emacs-level 5) gnus-button-handle-custom 2)
-    ("M-x[ \t\n]customize-[^ ]+[ \t\n]RET[ \t\n]\\([^ ]+\\)[ \t\n]RET" 0
-     (>= gnus-button-emacs-level 1) gnus-button-handle-custom 1)
+    ("M-x[ \t\n]\\(customize-[^ ]+\\)[ \t\n]RET[ \t\n]\\([^ ]+\\)[ \t\n]RET" 0
+     (>= gnus-button-emacs-level 1) gnus-button-handle-custom 1 2)
     ;; Emacs help commands
     ("M-x[ \t\n]+apropos[ \t\n]+RET[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET"
      ;; regexp doesn't match arguments containing ` '.

[-- Attachment #3: Type: text/plain, Size: 93 bytes --]


(I'll provide a ChangeLog entry once it is settled what exactly to do
with this.)

-- 
Ralf

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-12-14 13:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-12 18:55 Buttons for M-x customize-* Ralf Angeli
2005-12-12 22:30 ` Reiner Steib
2005-12-13  9:05   ` Ralf Angeli
2005-12-13 16:39   ` Simon Josefsson
2005-12-14 11:25     ` Ralf Angeli
2005-12-14 13:17       ` Reiner Steib
2005-12-14 13:37         ` Ralf Angeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).