From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: marginalia Date: Tue, 01 Jun 2021 23:54:45 +0300 Organization: LINKOV.NET Message-ID: <874kehcnl6.fsf@mail.linkov.net> References: <5146817f-4b3f-8a7e-edce-f34a9a10f805@daniel-mendler.de> <871r9qk9el.fsf@mail.linkov.net> <92c218f7-1168-a7f4-3861-04f64a37eec9@daniel-mendler.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29449"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Omar =?iso-8859-1?Q?Antol=EDn?= Camarena , Stefan Monnier , "emacs-devel@gnu.org" To: Daniel Mendler Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 01 22:59:36 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1loBU8-0007Zx-8J for ged-emacs-devel@m.gmane-mx.org; Tue, 01 Jun 2021 22:59:36 +0200 Original-Received: from localhost ([::1]:50988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loBU7-0000cj-7H for ged-emacs-devel@m.gmane-mx.org; Tue, 01 Jun 2021 16:59:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loBTP-0007JJ-S7 for emacs-devel@gnu.org; Tue, 01 Jun 2021 16:58:52 -0400 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:33909) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loBTO-000653-39 for emacs-devel@gnu.org; Tue, 01 Jun 2021 16:58:51 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id A3791240006; Tue, 1 Jun 2021 20:58:45 +0000 (UTC) In-Reply-To: <92c218f7-1168-a7f4-3861-04f64a37eec9@daniel-mendler.de> (Daniel Mendler's message of "Sat, 29 May 2021 10:06:03 +0200") Received-SPF: pass client-ip=217.70.178.230; envelope-from=juri@linkov.net; helo=relay10.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270250 Archived-At: --=-=-= Content-Type: text/plain >>> 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=help--symbol-class.patch diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 5a805a2302..133763add1 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -126,29 +126,35 @@ help-enable-completion-autoload :group 'help :version "26.3") +(defun help--symbol-class (s) + "Return symbol class characters for symbol S." + (when (stringp s) + (setq s (intern-soft s))) + (cond ((commandp s) + "c") ; command + ((eq (car-safe (symbol-function s)) 'macro) + "m") ; macro + ((fboundp s) + "f") ; function + ((custom-variable-p s) + "u") ; user option + ((boundp s) + "v") ; variable + ((facep s) + "a") ; fAce + ((and (fboundp 'cl-find-class) + (cl-find-class s)) + "t") ; CL type + (" ") ; something else + )) + (defun help--symbol-completion-table-affixation (completions) (mapcar (lambda (c) (let* ((s (intern c)) (doc (condition-case nil (documentation s) (error nil))) (doc (and doc (substring doc 0 (string-match "\n" doc))))) (list c (propertize - (concat (cond ((commandp s) - "c") ; command - ((eq (car-safe (symbol-function s)) 'macro) - "m") ; macro - ((fboundp s) - "f") ; function - ((custom-variable-p s) - "u") ; user option - ((boundp s) - "v") ; variable - ((facep s) - "a") ; fAce - ((and (fboundp 'cl-find-class) - (cl-find-class s)) - "t") ; CL type - (" ")) ; something else - " ") ; prefix separator + (concat (help--symbol-class s) " ") ; prefix separator 'face 'completions-annotations) (if doc (propertize (format " -- %s" doc) 'face 'completions-annotations) --=-=-= Content-Type: text/plain Then you could use it, and prepend/append more characters such as: o for obsolete, ! for advised, * for modified. --=-=-=--