unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] lisp-mode: fix defstruct docstring identification for Common Lisp
@ 2023-01-31  0:54 Nicolas Martyanoff
  2023-02-02 10:46 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Martyanoff @ 2023-01-31  0:54 UTC (permalink / raw)
  To: emacs-devel; +Cc: Nicolas Martyanoff

In Common Lisp, defstruct accepts a docstring in second position. Having the
docstring identified as such allows correct highlighting.
---
 lisp/emacs-lisp/lisp-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index bacc105a214..367f59e8785 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -182,6 +182,7 @@ lisp-mode-autoload-regexp
 ;; CL
 (put 'defconstant 'doc-string-elt 3)
 (put 'defparameter 'doc-string-elt 3)
+(put 'defstruct 'doc-string-elt 2)
 
 (defvar lisp-doc-string-elt-property 'doc-string-elt
   "The symbol property that holds the docstring position info.")
-- 
2.38.1




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

* Re: [PATCH] lisp-mode: fix defstruct docstring identification for Common Lisp
  2023-01-31  0:54 [PATCH] lisp-mode: fix defstruct docstring identification for Common Lisp Nicolas Martyanoff
@ 2023-02-02 10:46 ` Eli Zaretskii
  2023-02-02 11:27   ` Nicolas Martyanoff
       [not found]   ` <87y1pgpau5.fsf@valhala.localdomain>
  0 siblings, 2 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-02-02 10:46 UTC (permalink / raw)
  To: Nicolas Martyanoff; +Cc: emacs-devel

> From: Nicolas Martyanoff <nicolas@n16f.net>
> Cc: Nicolas Martyanoff <nicolas@n16f.net>
> Date: Tue, 31 Jan 2023 01:54:57 +0100
> 
> In Common Lisp, defstruct accepts a docstring in second position. Having the
> docstring identified as such allows correct highlighting.

Do you mean cl-defstruct?  If not, what do you mean?

Can you show a small Lisp recipe to demonstrate the differences in
highlighting before and after the change?

Thanks.



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

* Re: [PATCH] lisp-mode: fix defstruct docstring identification for Common Lisp
  2023-02-02 10:46 ` Eli Zaretskii
@ 2023-02-02 11:27   ` Nicolas Martyanoff
       [not found]   ` <87y1pgpau5.fsf@valhala.localdomain>
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Martyanoff @ 2023-02-02 11:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Nicolas Martyanoff, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Nicolas Martyanoff <nicolas@n16f.net>
>> Cc: Nicolas Martyanoff <nicolas@n16f.net>
>> Date: Tue, 31 Jan 2023 01:54:57 +0100
>> 
>> In Common Lisp, defstruct accepts a docstring in second position. Having the
>> docstring identified as such allows correct highlighting.
>
> Do you mean cl-defstruct?  If not, what do you mean?
>
> Can you show a small Lisp recipe to demonstrate the differences in
> highlighting before and after the change?

I do mean in Common Lisp.

To reproduce the issue (tested on Emacs 28.2 with "emacs -q"):

- Create a test.lisp buffer. It will use `lisp-mode' (the Common Lisp
  "variant", not sure about the right terminology).

- Declare a structure:
  (defstruct point "A 2d point." x y)

- Check that the face used for the docstring is (incorrectly)
  `font-lock-string-face'.

- Update the doc-string-elt property for 'defstruct to indicate that the
  second argument is the docstring, and reset highlighting
  M-: (put 'defstruct 'doc-string-elt 2)
  M-x common-lisp-mode

- Check that the face used for the docstring is now `font-lock-doc-face'
  as it should be.

Regards,

-- 
Nicolas Martyanoff
https://n16f.net
nicolas@n16f.net



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

* Re: [PATCH] lisp-mode: fix defstruct docstring identification for Common Lisp
       [not found]   ` <87y1pgpau5.fsf@valhala.localdomain>
@ 2023-02-02 18:13     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-02-02 18:13 UTC (permalink / raw)
  To: Nicolas Martyanoff; +Cc: emacs-devel

> From: Nicolas Martyanoff <nicolas@n16f.net>
> Date: Thu, 02 Feb 2023 12:26:26 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Nicolas Martyanoff <nicolas@n16f.net>
> >> Cc: Nicolas Martyanoff <nicolas@n16f.net>
> >> Date: Tue, 31 Jan 2023 01:54:57 +0100
> >> 
> >> In Common Lisp, defstruct accepts a docstring in second position. Having the
> >> docstring identified as such allows correct highlighting.
> >
> > Do you mean cl-defstruct?  If not, what do you mean?
> >
> > Can you show a small Lisp recipe to demonstrate the differences in
> > highlighting before and after the change?
> 
> I do mean in Common Lisp.
> 
> To reproduce the issue (tested on Emacs 28.2 with "emacs -q"):
> 
> - Create a test.lisp buffer. It will use `lisp-mode' (the Common Lisp
>   "variant", not sure about the right terminology).
> 
> - Declare a structure:
>   (defstruct point "A 2d point." x y)
> 
> - Check that the face used for the docstring is (incorrectly)
>   `font-lock-string-face'.
> 
> - Update the doc-string-elt property for 'defstruct to indicate that the
>   second argument is the docstring, and reset highlighting
>   M-: (put 'defstruct 'doc-string-elt 2)
>   M-x common-lisp-mode
> 
> - Check that the face used for the docstring is now `font-lock-doc-face'
>   as it should be.

Thanks, installed on the emacs-29 branch.



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

end of thread, other threads:[~2023-02-02 18:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-31  0:54 [PATCH] lisp-mode: fix defstruct docstring identification for Common Lisp Nicolas Martyanoff
2023-02-02 10:46 ` Eli Zaretskii
2023-02-02 11:27   ` Nicolas Martyanoff
     [not found]   ` <87y1pgpau5.fsf@valhala.localdomain>
2023-02-02 18:13     ` Eli Zaretskii

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).