* Re: defface location in describe-face
@ 2005-01-04 2:22 drkm
2005-01-04 14:26 ` Stefan
0 siblings, 1 reply; 9+ messages in thread
From: drkm @ 2005-01-04 2:22 UTC (permalink / raw)
[ Gmane seems to have problems. So I use my web mail
interface. I'm sorry if this mail is posted twice, and
for broken Reference:. ]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Why `describe-face' does not show a "Defined in `_file_'." button
?
> Oversight. `defface' doesn't record the definition in load-history.
> Patches welcome.
I tried to follow the same way `describe-variable' do this,
and adapt it to `describe-face'.
The difficult point is that `find-func' library doesn't handle
symbols but functions and variables. So I defined there a new
variable, `find-face-regexp', and a new function,
`find-face-noselect'.
`find-face-noselect' is a copy of `find-variable-noselect', with:
(let ((library (or file (symbol-file variable 'defvar))))
(find-function-search-for-symbol variable 'variable library)))
replaced by (locally binding `find-variable-regexp'):
(let ((library (or file (symbol-file face 'defface)))
(find-variable-regexp find-face-regexp))
(find-function-search-for-symbol face 'variable library)))
But I think `find-func' library should be fixed to handle arbitrary
kind of symbol (or at least other standard things than functions and
variables).
Follow the patches, generated individualy by "diff -c". It's
important to point out that I didn't test it so much, because I can't
install a more recent CVS version than :
(emacs-version)
==> "GNU Emacs 21.3.50.1 (i386-mingw-windows98.3000)
of 2004-12-23 on FARIBA"
To resume the changes:
- cus-face.el: `custom-declare-face' adds face to
`current-load-list'
- faces.el: `describe-face' adds the string "Defined in ...", with
the ad-hoc button to go to the face definition
- help-mode.el: define the button type `help-face-def'
- emacs-lisp/find-func.el: new variable `find-face-regexp', new
function `find-face-noselect', and a minor docstring fix in
`find-variable-noselect'
--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 Tue Jan 4 02:38:50 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,1279 ----
(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 (cons 'defface f))))
! (when (equal file-name "loaddefs.el")
! ;; Find the real def site of the preloaded face.
! (let ((location
! (condition-case nil
! (find-face-noselect f file-name)
! (error nil))))
! (when location
! (with-current-buffer (car location)
! (goto-char (cdr location))
! (when (re-search-backward
! "^;;; Generated autoloads from
\\(.*\\)" nil t)
! (setq file-name (match-string 1)))))))
! (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))))
! (trepri)))
(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"))
+
\f
;;;###autoload
(defun help-mode ()
*** emacs-lisp/find-func.el.orig Tue Jan 4 02:31:44 2005
--- emacs-lisp/find-func.el Tue Jan 4 02:14:22 2005
***************
*** 86,91 ****
--- 86,102 ----
:group 'find-function
:version "21.1")
+ (defcustom find-face-regexp
+ (concat"^\\s-*(defface" find-function-space-re "%s\\(\\s-\\|$\\)")
+ "The regexp used by `find-face' to search for a face definition.
+ It should match right up to the face name. The default value
+ matches `defface'.
+
+ Please send improvements and fixes to the maintainer."
+ :type 'regexp
+ :group 'find-function
+ :version "21.3")
+
(defcustom find-function-source-path nil
"The default list of directories where `find-function' searches.
***************
*** 337,345 ****
;;;###autoload
(defun find-variable-noselect (variable &optional file)
! "Return a pair `(BUFFER . POINT)' pointing to the definition of
SYMBOL.
! Finds the Emacs Lisp library containing the definition of SYMBOL
in a buffer and the point of the definition. The buffer is
not selected.
--- 348,356 ----
;;;###autoload
(defun find-variable-noselect (variable &optional file)
! "Return a pair `(BUFFER . POINT)' pointing to the definition of
VARIABLE.
! Finds the Emacs Lisp library containing the definition of VARIABLE
in a buffer and the point of the definition. The buffer is
not selected.
***************
*** 382,387 ****
--- 393,414 ----
(find-function-do-it variable t 'switch-to-buffer-other-frame))
;;;###autoload
+ (defun find-face-noselect (face &optional file)
+ "Return a pair `(BUFFER . POINT)' pointing to the definition of
FACE.
+
+ Finds the Emacs Lisp library containing the definition of FACE
+ in a buffer and the point of the definition. The buffer is
+ not selected.
+
+ The library where FACE is defined is searched for in FILE or
+ `find-function-source-path', if non nil, otherwise in `load-path'."
+ (if (not face)
+ (error "You didn't specify a face"))
+ (let ((library (or file (symbol-file face 'defface)))
+ (find-variable-regexp find-face-regexp))
+ (find-function-search-for-symbol face 'variable library)))
+
+ ;;;###autoload
(defun find-function-on-key (key)
"Find the function that KEY invokes. KEY is a string.
Point is saved if FUNCTION is in the current buffer."
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: defface location in describe-face
2005-01-04 2:22 defface location in describe-face drkm
@ 2005-01-04 14:26 ` Stefan
2005-01-04 16:42 ` drkm
0 siblings, 1 reply; 9+ messages in thread
From: Stefan @ 2005-01-04 14:26 UTC (permalink / raw)
Cc: emacs-devel
> replaced by (locally binding `find-variable-regexp'):
> (let ((library (or file (symbol-file face 'defface)))
> (find-variable-regexp find-face-regexp))
> (find-function-search-for-symbol face 'variable library)))
That's ugly.
> But I think `find-func' library should be fixed to handle arbitrary
> kind of symbol (or at least other standard things than functions and
> variables).
Yes, that's what needs to be done.
The rest of the patch looks OK, except that the "loaddefs.el" thingy should
be removed (it's only done for variables, not for functions, and shouldn't
be done for faces either).
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: defface location in describe-face
2005-01-04 14:26 ` Stefan
@ 2005-01-04 16:42 ` drkm
0 siblings, 0 replies; 9+ messages in thread
From: drkm @ 2005-01-04 16:42 UTC (permalink / raw)
Stefan <monnier@iro.umontreal.ca> writes:
>> replaced by (locally binding `find-variable-regexp'):
>> (let ((library (or file (symbol-file face 'defface)))
>> (find-variable-regexp find-face-regexp))
>> (find-function-search-for-symbol face 'variable library)))
> That's ugly.
Yes. That's why I pointed it out. And why I added
`find-face-noselect' in find-func.el. Initially, I did that trick
enclosing the calls to `find-variable-noselect' (ahem).
>> But I think `find-func' library should be fixed to handle arbitrary
>> kind of symbol (or at least other standard things than functions and
>> variables).
> Yes, that's what needs to be done.
> The rest of the patch looks OK, except that the "loaddefs.el" thingy should
> be removed (it's only done for variables, not for functions, and shouldn't
> be done for faces either).
Ok. I suppose I let you do it (just remove the `when' form).
--drkm
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: defface location in describe-face
@ 2005-01-04 2:15 drkm
0 siblings, 0 replies; 9+ messages in thread
From: drkm @ 2005-01-04 2:15 UTC (permalink / raw)
[ Gmane seems to have problems. So I post with my web mail
interface. I'm sorry if this mail is posted twice, and for
broken Reference:. ]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Why `describe-face' does not show a "Defined in `_file_'." button
?
> Oversight. `defface' doesn't record the definition in load-history.
> Patches welcome.
I tried to follow the same way `describe-variable' do this,
and adapt it to `describe-face'.
The difficult point is that `find-func' library doesn't handle
symbols but functions and variables. So I defined there a new
variable, `find-face-regexp', and a new function,
`find-face-noselect'.
`find-face-noselect' is a copy of `find-variable-noselect', with:
(let ((library (or file (symbol-file variable 'defvar))))
(find-function-search-for-symbol variable 'variable library)))
replaced by (locally binding `find-variable-regexp'):
(let ((library (or file (symbol-file face 'defface)))
(find-variable-regexp find-face-regexp))
(find-function-search-for-symbol face 'variable library)))
But I think `find-func' library should be fixed to handle arbitrary
kind of symbol (or at least other standard things than functions and
variables).
Follow the patches, generated individualy by "diff -c". It's
important to point out that I didn't test it so much, because I can't
install a more recent CVS version than :
(emacs-version)
==> "GNU Emacs 21.3.50.1 (i386-mingw-windows98.3000)
of 2004-12-23 on FARIBA"
To resume the changes:
- cus-face.el: `custom-declare-face' adds face to
`current-load-list'
- faces.el: `describe-face' adds the string "Defined in ...", with
the ad-hoc button to go to the face definition
- help-mode.el: define the button type `help-face-def'
- emacs-lisp/find-func.el: new variable `find-face-regexp', new
function `find-face-noselect', and a minor docstring fix in
`find-variable-noselect'
--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 Tue Jan 4 02:38:50 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,1279 ----
(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 (cons 'defface f))))
! (when (equal file-name "loaddefs.el")
! ;; Find the real def site of the preloaded face.
! (let ((location
! (condition-case nil
! (find-face-noselect f file-name)
! (error nil))))
! (when location
! (with-current-buffer (car location)
! (goto-char (cdr location))
! (when (re-search-backward
! "^;;; Generated autoloads from
\\(.*\\)" nil t)
! (setq file-name (match-string 1)))))))
! (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))))
! (trepri)))
(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"))
+
\f
;;;###autoload
(defun help-mode ()
*** emacs-lisp/find-func.el.orig Tue Jan 4 02:31:44 2005
--- emacs-lisp/find-func.el Tue Jan 4 02:14:22 2005
***************
*** 86,91 ****
--- 86,102 ----
:group 'find-function
:version "21.1")
+ (defcustom find-face-regexp
+ (concat"^\\s-*(defface" find-function-space-re "%s\\(\\s-\\|$\\)")
+ "The regexp used by `find-face' to search for a face definition.
+ It should match right up to the face name. The default value
+ matches `defface'.
+
+ Please send improvements and fixes to the maintainer."
+ :type 'regexp
+ :group 'find-function
+ :version "21.3")
+
(defcustom find-function-source-path nil
"The default list of directories where `find-function' searches.
***************
*** 337,345 ****
;;;###autoload
(defun find-variable-noselect (variable &optional file)
! "Return a pair `(BUFFER . POINT)' pointing to the definition of
SYMBOL.
! Finds the Emacs Lisp library containing the definition of SYMBOL
in a buffer and the point of the definition. The buffer is
not selected.
--- 348,356 ----
;;;###autoload
(defun find-variable-noselect (variable &optional file)
! "Return a pair `(BUFFER . POINT)' pointing to the definition of
VARIABLE.
! Finds the Emacs Lisp library containing the definition of VARIABLE
in a buffer and the point of the definition. The buffer is
not selected.
***************
*** 382,387 ****
--- 393,414 ----
(find-function-do-it variable t 'switch-to-buffer-other-frame))
;;;###autoload
+ (defun find-face-noselect (face &optional file)
+ "Return a pair `(BUFFER . POINT)' pointing to the definition of
FACE.
+
+ Finds the Emacs Lisp library containing the definition of FACE
+ in a buffer and the point of the definition. The buffer is
+ not selected.
+
+ The library where FACE is defined is searched for in FILE or
+ `find-function-source-path', if non nil, otherwise in `load-path'."
+ (if (not face)
+ (error "You didn't specify a face"))
+ (let ((library (or file (symbol-file face 'defface)))
+ (find-variable-regexp find-face-regexp))
+ (find-function-search-for-symbol face 'variable library)))
+
+ ;;;###autoload
(defun find-function-on-key (key)
"Find the function that KEY invokes. KEY is a string.
Point is saved if FUNCTION is in the current buffer."
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: defface location in describe-face
@ 2005-01-04 2:06 drkm
2005-01-05 3:31 ` Richard Stallman
0 siblings, 1 reply; 9+ messages in thread
From: drkm @ 2005-01-04 2:06 UTC (permalink / raw)
[ It seems that Gmane have problem at this time. So I post
with my web mail interface. I'm sorry if this email was
posted twice, and for broken Reference:. ]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Why `describe-face' does not show a "Defined in `_file_'." button
?
> Oversight. `defface' doesn't record the definition in load-history.
> Patches welcome.
I tried to follow the same way `describe-variable' do this,
and adapt it to `describe-face'.
The difficult point is that `find-func' library doesn't handle
symbols but functions and variables. So I defined there a new
variable, `find-face-regexp', and a new function,
`find-face-noselect'.
`find-face-noselect' is a copy of `find-variable-noselect', with:
(let ((library (or file (symbol-file variable 'defvar))))
(find-function-search-for-symbol variable 'variable library)))
replaced by (locally binding `find-variable-regexp'):
(let ((library (or file (symbol-file face 'defface)))
(find-variable-regexp find-face-regexp))
(find-function-search-for-symbol face 'variable library)))
But I think `find-func' library should be fixed to handle arbitrary
kind of symbol (or at least other standard things than functions and
variables).
Follow the patches, generated individualy by "diff -c". It's
important to point out that I didn't test it so much, because I can't
install a more recent CVS version than :
(emacs-version)
==> "GNU Emacs 21.3.50.1 (i386-mingw-windows98.3000)
of 2004-12-23 on FARIBA"
To resume the changes:
- cus-face.el: `custom-declare-face' adds face to
`current-load-list'
- faces.el: `describe-face' adds the string "Defined in ...", with
the ad-hoc button to go to the face definition
- help-mode.el: define the button type `help-face-def'
- emacs-lisp/find-func.el: new variable `find-face-regexp', new
function `find-face-noselect', and a minor docstring fix in
`find-variable-noselect'
--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 Tue Jan 4 02:38:50 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,1279 ----
(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 (cons 'defface f))))
! (when (equal file-name "loaddefs.el")
! ;; Find the real def site of the preloaded face.
! (let ((location
! (condition-case nil
! (find-face-noselect f file-name)
! (error nil))))
! (when location
! (with-current-buffer (car location)
! (goto-char (cdr location))
! (when (re-search-backward
! "^;;; Generated autoloads from
\\(.*\\)" nil t)
! (setq file-name (match-string 1)))))))
! (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))))
! (trepri)))
(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"))
+
\f
;;;###autoload
(defun help-mode ()
*** emacs-lisp/find-func.el.orig Tue Jan 4 02:31:44 2005
--- emacs-lisp/find-func.el Tue Jan 4 02:14:22 2005
***************
*** 86,91 ****
--- 86,102 ----
:group 'find-function
:version "21.1")
+ (defcustom find-face-regexp
+ (concat"^\\s-*(defface" find-function-space-re "%s\\(\\s-\\|$\\)")
+ "The regexp used by `find-face' to search for a face definition.
+ It should match right up to the face name. The default value
+ matches `defface'.
+
+ Please send improvements and fixes to the maintainer."
+ :type 'regexp
+ :group 'find-function
+ :version "21.3")
+
(defcustom find-function-source-path nil
"The default list of directories where `find-function' searches.
***************
*** 337,345 ****
;;;###autoload
(defun find-variable-noselect (variable &optional file)
! "Return a pair `(BUFFER . POINT)' pointing to the definition of
SYMBOL.
! Finds the Emacs Lisp library containing the definition of SYMBOL
in a buffer and the point of the definition. The buffer is
not selected.
--- 348,356 ----
;;;###autoload
(defun find-variable-noselect (variable &optional file)
! "Return a pair `(BUFFER . POINT)' pointing to the definition of
VARIABLE.
! Finds the Emacs Lisp library containing the definition of VARIABLE
in a buffer and the point of the definition. The buffer is
not selected.
***************
*** 382,387 ****
--- 393,414 ----
(find-function-do-it variable t 'switch-to-buffer-other-frame))
;;;###autoload
+ (defun find-face-noselect (face &optional file)
+ "Return a pair `(BUFFER . POINT)' pointing to the definition of
FACE.
+
+ Finds the Emacs Lisp library containing the definition of FACE
+ in a buffer and the point of the definition. The buffer is
+ not selected.
+
+ The library where FACE is defined is searched for in FILE or
+ `find-function-source-path', if non nil, otherwise in `load-path'."
+ (if (not face)
+ (error "You didn't specify a face"))
+ (let ((library (or file (symbol-file face 'defface)))
+ (find-variable-regexp find-face-regexp))
+ (find-function-search-for-symbol face 'variable library)))
+
+ ;;;###autoload
(defun find-function-on-key (key)
"Find the function that KEY invokes. KEY is a string.
Point is saved if FUNCTION is in the current buffer."
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: defface location in describe-face
2005-01-04 2:06 drkm
@ 2005-01-05 3:31 ` Richard Stallman
2005-01-05 4:34 ` drkm
0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2005-01-05 3:31 UTC (permalink / raw)
Cc: emacs-devel
I generalized find-func.el to handle faces in a cleaner way.
I did not do anything about describe-face, though.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: defface location in describe-face
2005-01-05 3:31 ` Richard Stallman
@ 2005-01-05 4:34 ` drkm
0 siblings, 0 replies; 9+ messages in thread
From: drkm @ 2005-01-05 4:34 UTC (permalink / raw)
Richard Stallman <rms@gnu.org> 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"))
+
\f
;;;###autoload
(defun help-mode ()
^ permalink raw reply [flat|nested] 9+ messages in thread
* defface location in describe-face
@ 2005-01-03 21:13 drkm
2005-01-03 22:08 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: drkm @ 2005-01-03 21:13 UTC (permalink / raw)
Hello
Why `describe-face' does not show a "Defined in `_file_'." button ?
BTW, when I have this code :
(defface my-face
'(...)
"...")
(defvar my-face 'my-face
"...")
If I do `C-h v m y - f a c e <RET>' and try to follow the link
"Defined in ..." in the `*Help*' buffer, the point goes on the
`defface', not on the `defvar'. Is this the normal behaviour ?
--drkm
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: defface location in describe-face
2005-01-03 21:13 drkm
@ 2005-01-03 22:08 ` Stefan Monnier
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2005-01-03 22:08 UTC (permalink / raw)
Cc: emacs-devel
> Why `describe-face' does not show a "Defined in `_file_'." button ?
Oversight. `defface' doesn't record the definition in load-history.
Patches welcome.
> BTW, when I have this code :
> (defface my-face
> '(...)
> "...")
> (defvar my-face 'my-face
> "...")
> If I do `C-h v m y - f a c e <RET>' and try to follow the link
> "Defined in ..." in the `*Help*' buffer, the point goes on the
> `defface', not on the `defvar'. Is this the normal behaviour ?
It was a bug. Should be fixed now,
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-01-05 4:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-04 2:22 defface location in describe-face drkm
2005-01-04 14:26 ` Stefan
2005-01-04 16:42 ` drkm
-- strict thread matches above, loose matches on Subject: below --
2005-01-04 2:15 drkm
2005-01-04 2:06 drkm
2005-01-05 3:31 ` Richard Stallman
2005-01-05 4:34 ` drkm
2005-01-03 21:13 drkm
2005-01-03 22:08 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).