unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler <mail@daniel-mendler.de>
To: Juri Linkov <juri@linkov.net>
Cc: "Omar Antolín Camarena" <omar@matem.unam.mx>,
	"Stefan Monnier" <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: [ELPA] New package: marginalia
Date: Tue, 1 Jun 2021 23:07:39 +0200	[thread overview]
Message-ID: <f83eff0b-998a-9fbd-182e-e776660f0a32@daniel-mendler.de> (raw)
In-Reply-To: <874kehcnl6.fsf@mail.linkov.net>

On 6/1/21 10:54 PM, Juri Linkov wrote:
>>>> BTW, I hope we can merge some of that code directly into Emacs itself.
>>>
>>> For example, marginalia--symbol-class adds new symbol characters to
>>> the replacement of `help--symbol-completion-table-affixation',
>>> but it would be better to add new characters directly to
>>> `help--symbol-completion-table-affixation'...
>>
>> Yes, I would be glad if you merge back the `marginalia--symbol-class` to
>> the Emacs help system! The `marginalia--symbol-class` has been inspired
>> by your `help--symbol-completion-table-affixation`, but I wanted to go a
>> little step further in Marginalia. Maybe it makes sense to add
>> `help--symbol-class` such that the function can be reused potentially at
>> other places?
> 
> Maybe something like...
> Then you could use it, and prepend/append more characters
> such as: o for obsolete, ! for advised, * for modified.

I am not sure if we would benefit much from this in Marginalia, since we
would still have to check the type of the symbol.

What about adding the extended `symbol-class` function from Marginalia
directly to help-fns.el? Note that the Marginalia function returns
multiple characters "fv" if a symbol denotes both a function and a variable.

Do you want to keep the `symbol-class` to be a single character under
all circumstances?

Daniel

~~~
(defun marginalia--symbol-class (s)
  "Return symbol class characters for symbol S.

Function:
f function
c command
m macro
! advised
o obsolete

Variable:
u custom
v variable
l local
* modified
o obsolete

Other:
a face
t cl-type"
  (format
   "%-6s"
   (concat
    (when (fboundp s)
      (concat
       (and (get s 'byte-obsolete-info) "o")
       (cond
        ((commandp s) "c")
        ((eq (car-safe (symbol-function s)) 'macro) "m")
        (t "f"))
       (and (marginalia--advised s) "!")))
    (when (boundp s)
      (concat
       (and (get s 'byte-obsolete-variable) "o")
       (and (local-variable-if-set-p s) "l")
       (if (custom-variable-p s) "u" "v")
       (and (ignore-errors (not (equal (symbol-value s) (default-value
s)))) "*")))
    (and (facep s) "a")
    (and (fboundp 'cl-find-class) (cl-find-class s) "t"))))
~~~



  reply	other threads:[~2021-06-01 21:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  6:35 [ELPA] New package: marginalia Daniel Mendler
2021-05-28 13:47 ` Stefan Monnier
2021-05-28 13:59   ` Daniel Mendler
2021-05-28 14:08     ` Eli Zaretskii
2021-05-28 18:40   ` Juri Linkov
2021-05-29  8:06     ` Daniel Mendler
2021-06-01 20:54       ` Juri Linkov
2021-06-01 21:07         ` Daniel Mendler [this message]
2021-06-02 22:13           ` Juri Linkov
2021-06-11 17:13           ` Juri Linkov
2021-06-17 20:22             ` Juri Linkov
2021-06-02 14:46         ` Jens C. Jensen
2021-06-02 15:07           ` Daniel Mendler
2021-06-03  6:17             ` Jens C. Jensen
2021-06-02 15:10           ` Stefan Monnier

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=f83eff0b-998a-9fbd-182e-e776660f0a32@daniel-mendler.de \
    --to=mail@daniel-mendler.de \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=omar@matem.unam.mx \
    /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).