* Customisation for Comments
@ 2022-02-09 22:59 goncholden via Users list for the GNU Emacs text editor
2022-02-10 23:37 ` fatiparty--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: goncholden via Users list for the GNU Emacs text editor @ 2022-02-09 22:59 UTC (permalink / raw)
To: goncholden via Users list for the GNU Emacs text editor
Am using modus-vivendi theme to which I add a bold font for everything.
I want a special customisation for comments, using normal weight, and having a keybinding that changes the
contrast ratio between the comment colour and the background.
Had started writing a minor mode, but this seems to be a non-standard implementation. What would be the
appropriate way to customise comments as described. Any examples I can use?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-09 22:59 Customisation for Comments goncholden via Users list for the GNU Emacs text editor
@ 2022-02-10 23:37 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-02-11 17:26 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-02-10 23:37 UTC (permalink / raw)
To: goncholden; +Cc: goncholden via Users list for the GNU Emacs text editor
Feb 10, 2022, 10:59 by help-gnu-emacs@gnu.org:
> Am using modus-vivendi theme to which I add a bold font for everything.
>
> I want a special customisation for comments, using normal weight, and having a keybinding that changes the
> contrast ratio between the comment colour and the background.
>
> Had started writing a minor mode, but this seems to be a non-standard implementation. What would be the
> appropriate way to customise comments as described. Any examples I can use?
>
In the elisp manual you can find how the recommended way is to derive a mode from anexisting one using define-derived-mode. If there is no closelyrelated mode, you should inherit from either text-mode,special-mode, or prog-mode. Ifnone of these are suitable, you can inherit from fundamental-mode.
Although I have not done this myself, and so unaware of the details.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-10 23:37 ` fatiparty--- via Users list for the GNU Emacs text editor
@ 2022-02-11 17:26 ` goncholden
2022-02-11 19:00 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: goncholden @ 2022-02-11 17:26 UTC (permalink / raw)
To: fatiparty; +Cc: goncholden via Users list for the GNU Emacs text editor
------- Original Message -------
On Thursday, February 10th, 2022 at 11:37 PM, fatiparty--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Feb 10, 2022, 10:59 by help-gnu-emacs@gnu.org:
>
> > Am using modus-vivendi theme to which I add a bold font for everything.
> >
> > I want a special customisation for comments, using normal weight, and having a keybinding that changes the
> >
> > contrast ratio between the comment colour and the background.
> >
> > Had started writing a minor mode, but this seems to be a non-standard implementation. What would be the
> >
> > appropriate way to customise comments as described. Any examples I can use?
>
> In the elisp manual you can find how the recommended way is to derive a mode from anexisting one using define-derived-mode. If there is no closelyrelated mode, you should inherit from either text-mode,special-mode, or prog-mode. Ifnone of these are suitable, you can inherit from fundamental-mode.
>
> Although I have not done this myself, and so unaware of the details.
Have had a look at that. But I need some examples if I am going to have a successful
implementation. There is not much information except for listings of functions.
Would be most helpful to have a section about implementing derived-modes and minor-modes.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 17:26 ` goncholden
@ 2022-02-11 19:00 ` goncholden
2022-02-11 19:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: goncholden @ 2022-02-11 19:00 UTC (permalink / raw)
To: goncholden
Cc: fatiparty,
goncholden via Users list for the GNU Emacs text editor
------- Original Message -------
On Friday, February 11th, 2022 at 5:26 PM, goncholden <goncholden@protonmail.com> wrote:
> ------- Original Message -------
> On Thursday, February 10th, 2022 at 11:37 PM, fatiparty--- via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org wrote:
> > Feb 10, 2022, 10:59 by help-gnu-emacs@gnu.org:
> > > Am using modus-vivendi theme to which I add a bold font for everything.
> > > I want a special customisation for comments, using normal weight, and having a keybinding that changes the
> > > contrast ratio between the comment colour and the background.
> > > Had started writing a minor mode, but this seems to be a non-standard implementation. What would be the
> > > appropriate way to customise comments as described. Any examples I can use?
> >
> > In the elisp manual you can find how the recommended way is to derive a mode from an existing one using
> > define-derived-mode. If there is no closely related mode, you should inherit from either text-mode,special-mode,
> > or prog-mode. Ifnone of these are suitable, you can inherit from fundamental-mode.
> >
> > Although I have not done this myself, and so unaware of the details.
> Have had a look at that. But I need some examples if I am going to have a successful
> implementation. There is not much information except for listings of functions.
> Would be most helpful to have a section about implementing derived-modes and minor-modes.
Have completed the code needed, but now I have got to finish the task of putting everything in a derived mode,
which I am finding problematic to say the least.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 19:00 ` goncholden
@ 2022-02-11 19:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 19:25 ` fatiparty--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-11 19:19 UTC (permalink / raw)
To: help-gnu-emacs
goncholden wrote:
> Have completed the code needed, but now I have got to finish
> the task of putting everything in a derived mode, which I am
> finding problematic to say the least.
Are you even allowed to do that?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 19:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-11 19:25 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-02-11 19:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-02-11 19:25 UTC (permalink / raw)
To: Emanuel Berg; +Cc: Help Gnu Emacs
Feb 12, 2022, 07:19 by help-gnu-emacs@gnu.org:
> goncholden wrote:
>
>> Have completed the code needed, but now I have got to finish
>> the task of putting everything in a derived mode, which I am
>> finding problematic to say the least.
>>
>
> Are you even allowed to do that?
>
I think it is possible.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 19:25 ` fatiparty--- via Users list for the GNU Emacs text editor
@ 2022-02-11 19:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 19:51 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-11 19:41 UTC (permalink / raw)
To: help-gnu-emacs
fatiparty--- via Users list for the GNU Emacs text editor wrote:
>>> Have completed the code needed, but now I have got to
>>> finish the task of putting everything in a derived mode,
>>> which I am finding problematic to say the least.
>>
>> Are you even allowed to do that?
>
> I think it is possible.
AT&T rethink possible.
Are we talking a major or minor mode?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 19:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-11 19:51 ` goncholden
2022-02-11 20:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: goncholden @ 2022-02-11 19:51 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
------- Original Message -------
On Friday, February 11th, 2022 at 7:41 PM, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> fatiparty--- via Users list for the GNU Emacs text editor wrote:
>
> > > > Have completed the code needed, but now I have got to
> > > > finish the task of putting everything in a derived mode,
> > > > which I am finding problematic to say the least.
> > > Are you even allowed to do that?
> > I think it is possible.
> AT&T rethink possible.
> Are we talking a major or minor mode?
Stefan mentioned that a minor-mode would not be the appropriate thing to do. The idea is
to derive a mode from a major mode and introduce the comment functionality in it. One could
have a go at introducing the functionality in the theme, but that would be too restrictive
for others to use.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 19:51 ` goncholden
@ 2022-02-11 20:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 20:14 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-11 20:05 UTC (permalink / raw)
To: help-gnu-emacs
goncholden wrote:
> Stefan mentioned that a minor-mode would not be the
> appropriate thing to do. The idea is to derive a mode from
> a major mode and introduce the comment functionality in it.
> One could have a go at introducing the functionality in the
> theme, but that would be too restrictive for others to use.
If this is the goal
I want a special customisation for comments, using normal
weight, and having a keybinding that changes the contrast
ratio between the comment colour and the background.
then start with a function that increases the contrast by CON.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 20:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-11 20:14 ` goncholden
2022-02-11 20:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: goncholden @ 2022-02-11 20:14 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
------- Original Message -------
On Friday, February 11th, 2022 at 8:05 PM, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> goncholden wrote:
>
> > Stefan mentioned that a minor-mode would not be the
> > appropriate thing to do. The idea is to derive a mode from
> > a major mode and introduce the comment functionality in it.
> > One could have a go at introducing the functionality in the
> > theme, but that would be too restrictive for others to use.
> If this is the goal
> I want a special customisation for comments, using normal
> weight, and having a keybinding that changes the contrast
> ratio between the comment colour and the background.
> then start with a function that increases the contrast by CON.
I have done all that and introduced them into a minor-mode. There are a
number of minor-modes out there that do provide font-lock customization.
Extending a major-mode is not simple, eg. a derived mode from prog-mode
is used to make a major-mode, like emacs-lisp-mode (which actually derives
from lisp-data-mode which derives from prog-mode). This means that if I
derive from prog-mode, I would need to setup the syntax for the major-mode
before I can change the comment font-locking.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 20:14 ` goncholden
@ 2022-02-11 20:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 21:04 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-11 20:19 UTC (permalink / raw)
To: help-gnu-emacs
goncholden wrote:
>> then start with a function that increases the contrast by CON.
>
> I have done all that and introduced them into a minor-mode.
> There are a number of minor-modes out there that do provide
> font-lock customization. Extending a major-mode is not
> simple, eg. a derived mode from prog-mode is used to make
> a major-mode, like emacs-lisp-mode (which actually derives
> from lisp-data-mode which derives from prog-mode).
> This means that if I derive from prog-mode, I would need to
> setup the syntax for the major-mode before I can change the
> comment font-locking.
Why do you need modes at all for that?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 20:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-11 21:04 ` goncholden
2022-02-11 22:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: goncholden @ 2022-02-11 21:04 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
------- Original Message -------
On Friday, February 11th, 2022 at 8:19 PM, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> goncholden wrote:
>
> > > then start with a function that increases the contrast by CON.
> >
> > I have done all that and introduced them into a minor-mode.
> > There are a number of minor-modes out there that do provide
> > font-lock customization. Extending a major-mode is not
> > simple, eg. a derived mode from prog-mode is used to make
> > a major-mode, like emacs-lisp-mode (which actually derives
> > from lisp-data-mode which derives from prog-mode).
> > This means that if I derive from prog-mode, I would need to
> > setup the syntax for the major-mode before I can change the
> > comment font-locking.
> Why do you need modes at all for that?
I am relatively new to elisp planning and could do with suggestions.
The plan is to make this available to users, and though minor-modes
are the way to do things.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 21:04 ` goncholden
@ 2022-02-11 22:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 22:59 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-11 22:23 UTC (permalink / raw)
To: help-gnu-emacs
goncholden wrote:
> I am relatively new to elisp planning and could do with
> suggestions. The plan is to make this available to users,
> and though minor-modes are the way to do things.
Sounds to me like you just need one function to increase the
contrast. Then maybe another function the decrease it, by
sending a negative value, and perhaps a couple of more
functions that are all just helper functions around the
first one.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 22:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-11 22:59 ` goncholden
2022-02-11 23:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 17+ messages in thread
From: goncholden @ 2022-02-11 22:59 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
------- Original Message -------
On Friday, February 11th, 2022 at 10:23 PM, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> goncholden wrote:
>
> > I am relatively new to elisp planning and could do with
> > suggestions. The plan is to make this available to users,
> > and though minor-modes are the way to do things.
> Sounds to me like you just need one function to increase the
> contrast. Then maybe another function the decrease it, by
> sending a negative value, and perhaps a couple of more
> functions that are all just helper functions around the
> first one.
Eman, I have done all that and put things in a minor-mode. What
I have a problem with is about whether or not to use a minor-mode,
major-mode, or a derived mode (derived from a major-mode).
To change comments to normal weight, I utilise set-face-attribute.
(set-face-attribute 'font-lock-comment-face nil :weight 'normal))
Perhaps using face-remap-add-relative has advantages. What would you recommend?
(face-remap-add-relative 'font-lock-comment-face :weight 'normal))
I think that face-remap gives buffer-local changes. Would this be appropriate?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 22:59 ` goncholden
@ 2022-02-11 23:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 23:21 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-11 23:16 UTC (permalink / raw)
To: help-gnu-emacs
goncholden wrote:
>> Sounds to me like you just need one function to increase
>> the contrast. Then maybe another function the decrease it,
>> by sending a negative value, and perhaps a couple of more
>> functions that are all just helper functions around the
>> first one.
>
> Eman, I have done all that and put things in a minor-mode.
> What I have a problem with is about whether or not to use
> a minor-mode, major-mode, or a derived mode (derived from
> a major-mode).
Gonch, it depends what problem you try to solve?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 23:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-11 23:21 ` goncholden
2022-02-12 18:04 ` goncholden
0 siblings, 1 reply; 17+ messages in thread
From: goncholden @ 2022-02-11 23:21 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
------- Original Message -------
On Friday, February 11th, 2022 at 11:16 PM, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> goncholden wrote:
>
> > > Sounds to me like you just need one function to increase
> > > the contrast. Then maybe another function the decrease it,
> > > by sending a negative value, and perhaps a couple of more
> > > functions that are all just helper functions around the
> > > first one.
> > Eman, I have done all that and put things in a minor-mode.
> > What I have a problem with is about whether or not to use
> > a minor-mode, major-mode, or a derived mode (derived from
> > a major-mode).
> Gonch, it depends what problem you try to solve?
It is a customisation for comments, for programming languages and others
which allow comment type lines (e.g. org-mode, texi-mode).
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Customisation for Comments
2022-02-11 23:21 ` goncholden
@ 2022-02-12 18:04 ` goncholden
0 siblings, 0 replies; 17+ messages in thread
From: goncholden @ 2022-02-12 18:04 UTC (permalink / raw)
To: goncholden; +Cc: Emanuel Berg, help-gnu-emacs
------- Original Message -------
On Friday, February 11th, 2022 at 11:21 PM, goncholden <goncholden@protonmail.com> wrote:
> ------- Original Message -------
>
> On Friday, February 11th, 2022 at 11:16 PM, Emanuel Berg via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org wrote:
>
> > goncholden wrote:
> >
> > > > Sounds to me like you just need one function to increase
> > > > the contrast. Then maybe another function the decrease it,
> > > > by sending a negative value, and perhaps a couple of more
> > > > functions that are all just helper functions around the
> > > > first one.
>
> > > Eman, I have done all that and put things in a minor-mode.
> > >
> > > What I have a problem with is about whether or not to use
> > > a minor-mode, major-mode, or a derived mode (derived from
> > > a major-mode).
>
> > Gonch, it depends what problem you try to solve?
>
> It is a customisation for comments, for programming languages and others
> which allow comment type lines (e.g. org-mode, texi-mode).
I am still stuck with this Stefan
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-02-12 18:04 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09 22:59 Customisation for Comments goncholden via Users list for the GNU Emacs text editor
2022-02-10 23:37 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-02-11 17:26 ` goncholden
2022-02-11 19:00 ` goncholden
2022-02-11 19:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 19:25 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-02-11 19:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 19:51 ` goncholden
2022-02-11 20:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 20:14 ` goncholden
2022-02-11 20:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 21:04 ` goncholden
2022-02-11 22:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 22:59 ` goncholden
2022-02-11 23:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-11 23:21 ` goncholden
2022-02-12 18:04 ` goncholden
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).