From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to get the actual face attribute?
Date: Mon, 22 Jun 2020 23:27:17 +0200 [thread overview]
Message-ID: <87pn9qbxl6.fsf@ebih.ebihd> (raw)
In-Reply-To: 41A32155-634A-4D5A-A878-2F92E6761917@gmail.com
Yuan Fu wrote:
> (let* ((p (or point (point))))
> (if (eq (char-after point) ?\t)
> (valign--tab-width (font-at p))
> ;; (font-at 0 nil (buffer-substring p (1+ p))) doesn’t work, the
> ;; font is sometimes wrong. (font-at p) doesn’t work, because
> ;; it requires the buffer to be visible.
> (aref (aref (font-get-glyphs (font-at p) p (1+ p)) 0) 4)))
Hello Yuan Fu, you have a cool name :)
re: code, the byte compiler is always your friend:
geh.el:
In do-something:
geh.el:10:17:Warning: reference to free variable ‘point’
In end of data:
geh.el:110:1:Warning: the function ‘valign--tab-width’ is not known to be
defined.
Also style point #1:
(aref (aref (font-get-glyphs (font-at p) p (1+ p)) 0) 4)))
Suggestion, break it up, do more `let*'.
ditto #2:
(or point (point))
Straight long-ear [1] use of `or' :) However the
particular
point (point)
is confusing IMO.
ditto #3:
... 0) 4)))
hard-coded data can also be put into `let*' to
increase clarity, however if they only appear once
one is allowed... heh :) one is allowed to have them
hard-coded. if they ever appear twice names,
variables/bindings are compulsory, with the possible
exceptions of -1, 0, 1, nil and t :)
Keep 'em coming...
[1] https://en.wikipedia.org/wiki/Hanau_epe
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
next prev parent reply other threads:[~2020-06-22 21:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-21 4:01 How to get the actual face attribute? Yuan Fu
2020-06-21 14:52 ` Eli Zaretskii
2020-06-21 14:55 ` Yuan Fu
2020-06-21 15:03 ` Eli Zaretskii
2020-06-21 15:54 ` Stefan Monnier
2020-06-22 17:00 ` Yuan Fu
2020-06-22 17:15 ` Perry Smith
2020-06-22 17:21 ` Yuan Fu
2020-06-22 18:47 ` Eli Zaretskii
2020-06-22 19:07 ` Yuan Fu
2020-06-22 18:56 ` Stefan Monnier
2020-06-22 19:10 ` Yuan Fu
2020-06-22 19:49 ` Stefan Monnier
2020-06-22 19:54 ` Yuan Fu
2020-06-22 21:05 ` Stefan Monnier
2020-06-22 21:14 ` Emacs hackers all around the world (was: Re: How to get the actual face attribute?) Emanuel Berg via Users list for the GNU Emacs text editor
2020-06-24 4:13 ` How to get the actual face attribute? Yuan Fu
2020-06-22 21:27 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2020-06-24 4:12 ` Yuan Fu
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=87pn9qbxl6.fsf@ebih.ebihd \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/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.
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).