unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Property list key names
Date: Sat, 09 Aug 2008 20:54:55 +0200	[thread overview]
Message-ID: <489DE7FF.4080905@gmail.com> (raw)
In-Reply-To: <489DE77A.5080006@gmail.com>

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

Lennart Borgman (gmail) wrote:
> Lennart Borgman (gmail) wrote:
>> Johan Bockgård wrote:
>>> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>>>
>>>> Johan Bockgård wrote:
>>>>> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> 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.

[-- Attachment #2: cl-macs-definition-name.diff --]
[-- Type: text/plain, Size: 1745 bytes --]

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	other threads:[~2008-08-09 18:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-09 13:56 Property list key names Lennart Borgman (gmail)
2008-08-09 14:52 ` Juanma Barranquero
2008-08-09 15:02   ` Lennart Borgman (gmail)
2008-08-09 15:07     ` Juanma Barranquero
2008-08-09 15:11       ` Lennart Borgman (gmail)
2008-08-09 15:16         ` Juanma Barranquero
2008-08-09 16:17           ` Lennart Borgman (gmail)
2008-08-09 16:58             ` Johan Bockgård
2008-08-09 17:18               ` Lennart Borgman (gmail)
2008-08-09 17:20                 ` Lennart Borgman (gmail)
2008-08-09 17:33                 ` Johan Bockgård
2008-08-09 18:18                   ` Lennart Borgman (gmail)
2008-08-09 18:52                     ` Lennart Borgman (gmail)
2008-08-09 18:54                       ` Lennart Borgman (gmail) [this message]
2008-08-09 15:08   ` Johan Bockgård
2008-08-09 15:15     ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=489DE7FF.4080905@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).