emacs-devel
[Top][All Lists]
Advanced

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

Re: Property list key names


From: Lennart Borgman (gmail)
Subject: Re: Property list key names
Date: Sat, 09 Aug 2008 20:54:55 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Lennart Borgman (gmail) wrote:
Lennart Borgman (gmail) wrote:
Johan Bockgård wrote:
"Lennart Borgman (gmail)" <address@hidden> writes:

Johan Bockgård wrote:
"Lennart Borgman (gmail)" <address@hidden> writes:

If there for example is something like this

 (defstruct ert-stats
   (selector (assert nil)))

then a defstruct selector function `ert-stats-selector' is defined. It
would be nice to go to that function directly from the link in
describe-function', but currently the position in the file is not
found.
Indeed, defstruct should put a `definition-name' property on the names
it constructs. Like

(put 'ert-stats-selector 'definition-name 'ert-stats)
Yes, something like that. Is 'definition-name special in some way or
could/should it be something else?

Try C-h f again after adding the property above.

Hey, that is the black box game again ... ;-)

Yes, you are right, but I do not understand how it works. I guess C-h f searches the buffer for the "definition-name".

So this looks like more or less a bug.

I tried to look at defstruct to see where to add 'definition-name. There seems to be 4 uses of `defun' and `defsubst*'. Should not all this 4 be adding 'definition-name?


Here is a patch for that. Should be wrapped a bit, but it is easier seeing what I have done if it is like this. Should the (put ... 'definition-name ...) be before or after the defmacro* and defun in the code?


Sorry, attached the patch.
Index: cl-macs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/cl-macs.el,v
retrieving revision 1.76
diff -u -r1.76 cl-macs.el
--- cl-macs.el  16 Jul 2008 02:50:00 -0000      1.76
+++ cl-macs.el  9 Aug 2008 18:44:42 -0000
@@ -2328,6 +2328,7 @@
                         (list (if (eq type 'vector) (list 'aref 'cl-x pos)
                                 (if (= pos 0) '(car cl-x)
                                   (list 'nth pos 'cl-x)))))) forms)
+              (push (list 'put (list 'quote accessor) (list 'quote 
'definition-name) (list 'quote struct)) forms)
              (push (cons accessor t) side-eff)
              (push (list 'define-setf-method accessor '(cl-x)
                             (if (cadr (memq :read-only (cddr desc)))
@@ -2355,9 +2356,11 @@
                               (if (eq (car pred-form) 'and)
                                   (append pred-form '(t))
                                 (list 'and pred-form t))) forms)
+                (push (list 'put (list 'quote predicate) (list 'quote 
'definition-name) (list 'quote struct)) forms)
                (push (cons predicate 'error-free) side-eff)))
     (and copier
         (progn (push (list 'defun copier '(x) '(copy-sequence x)) forms)
+                (push (list 'put (list 'quote copier) (list 'quote 
'definition-name) (list 'quote struct)) forms)
                (push (cons copier t) side-eff)))
     (if constructor
        (push (list constructor
@@ -2372,6 +2375,7 @@
        (push (list 'defsubst* name
                       (list* '&cl-defs (list 'quote (cons nil descs)) args)
                       (cons type make)) forms)
+        (push (list 'put (list 'quote name) (list 'quote 'definition-name) 
(list 'quote struct)) forms)
        (if (cl-safe-expr-p (cons 'progn (mapcar 'second descs)))
            (push (cons name t) side-eff))))
     (if print-auto (nconc print-func (list '(princ ")" cl-s) t)))

reply via email to

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