emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defface location in describe-face


From: drkm
Subject: Re: defface location in describe-face
Date: Wed, 05 Jan 2005 05:34:15 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (windows-nt)

Richard Stallman <address@hidden> writes:

> I generalized find-func.el to handle faces in a cleaner way.
> I did not do anything about describe-face, though.

  What do you think of the following?

--drkm

*** cus-face.el.orig    Thu Dec 23 07:01:56 2004
--- cus-face.el Tue Jan  4 01:25:46 2005
***************
*** 53,58 ****
--- 53,59 ----
      (when (and doc (null (face-documentation face)))
        (set-face-documentation face (purecopy doc)))
      (custom-handle-all-keywords face args 'custom-face)
+     (push (cons 'defface face) current-load-list)
      (run-hooks 'custom-define-hook))
    face)
  

*** faces.el.orig       Thu Dec 23 07:01:58 2004
--- faces.el    Wed Jan  5 05:12:04 2005
***************
*** 1244,1255 ****
              (insert "Documentation: "
                      (or (face-documentation f)
                          "Not documented as a face.")
!                     "\n\n")
              (with-current-buffer standard-output
                (save-excursion
                  (re-search-backward
                   (concat "\\(" customize-label "\\)") nil t)
!                 (help-xref-button 1 'help-customize-face f)))
              (dolist (a attrs)
                (let ((attr (face-attribute f (car a) frame)))
                  (insert (make-string (- max-width (length (cdr a))) ?\ )
--- 1244,1267 ----
              (insert "Documentation: "
                      (or (face-documentation f)
                          "Not documented as a face.")
!                     "\n")
              (with-current-buffer standard-output
                (save-excursion
                  (re-search-backward
                   (concat "\\(" customize-label "\\)") nil t)
!                 (help-xref-button 1 'help-customize-face f))
!                 ;; Make a hyperlink to the library if appropriate.
!                 (let ((file-name (symbol-file f 'defface)))
!                   (when file-name
!                     (princ "Defined in `")
!                     (princ file-name)
!                     (princ "'.\n")
!                     (with-current-buffer standard-output
!                       (save-excursion
!                         (re-search-backward "`\\([^`']+\\)'" nil t)
!                         (help-xref-button 1 'help-face-def
!                                           f file-name))))
!                   (terpri)))
              (dolist (a attrs)
                (let ((attr (face-attribute f (car a) frame)))
                  (insert (make-string (- max-width (length (cdr a))) ?\ )

*** help-mode.el.orig   Thu Dec 23 07:01:58 2004
--- help-mode.el        Tue Jan  4 02:16:48 2005
***************
*** 169,174 ****
--- 169,182 ----
                     (goto-char (cdr location))))
    'help-echo (purecopy"mouse-2, RET: find variable's definition"))
  
+ (define-button-type 'help-face-def
+   :supertype 'help-xref
+   'help-function (lambda (face &optional file)
+                    (let ((location (find-face-noselect face file)))
+                    (pop-to-buffer (car location))
+                    (goto-char (cdr location))))
+   'help-echo (purecopy "mouse-2, RET: find face's definition"))
+ 
  
  ;;;###autoload
  (defun help-mode ()





reply via email to

[Prev in Thread] Current Thread [Next in Thread]