unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Josh <josh@foxtail.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Sebastien Vauban <sva-news@mygooglest.com>, 15298@debbugs.gnu.org
Subject: bug#15298: 24.3.50; Background color lost when highlighting a string
Date: Fri, 13 Dec 2013 12:21:02 -0800	[thread overview]
Message-ID: <CANdFEAHi+915qjEDq=bQZLAHO4kKpwsQpxx6U7EaM0Azk7xacQ@mail.gmail.com> (raw)
In-Reply-To: <83wqj84mji.fsf@gnu.org>

On Fri, Dec 13, 2013 at 10:45 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Josh <josh@foxtail.org>
>> Date: Fri, 13 Dec 2013 08:14:38 -0800
>> Cc: Sebastien Vauban <sva-news@mygooglest.com>, 15298@debbugs.gnu.org
>>
>> On Fri, Dec 13, 2013 at 6:11 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> >> From: "Sebastien Vauban" <sva-news@mygooglest.com>
>> >> Date: Fri, 13 Dec 2013 13:50:26 +0100
>> >> Cc: 15298@debbugs.gnu.org
>> >>
>> >> Side question: when we observe such a word which is not highlighted as
>> >> we expect it, is there a way to see the list of all applied faces in the
>> >> order they are applied?  That'd help debugging such a problem...
>> >
>> > The problem in this case (and other similar ones) is that the face you
>> > expected was removed, and then another one applied to the same text.
>> > Removed faces are not recorded anywhere, as you might expect.
>>
>> Would (faces-at-position nil :include-all) reveal the absence of the
>> face Sebastien was expecting to have been in effect?
>
> I have no idea, as there's no such function in my Emacs.  But
> describe-text-properties will do the job.

Indeed, I've been using this function for long enough that I had
forgotten that it resides in my init file instead of Emacs proper.
It extends face-at-point to accept an optional position argument
and to optionally return all of the faces at point instead of only
the first when multiple faces are present.  Here it is, in case
anyone is interested:

(defun faces-at-position (&optional position include-all)
  "Return the face of the character after POSITION.
If no position is specified, (point) is used.  If the character has
more than one face, return only the first one unless INCLUDE-ALL is
non-nil.  Return nil if it has no specified face."
  (setq position (or position (point)))
  (let* ((faceprop (or (get-char-property position 'read-face-name)
                       (get-char-property position 'face)
                       'default))
         (face (cond ((symbolp faceprop) faceprop)
                     ;; List of faces (don't treat an attribute spec).
                     ;; Just use the first face.
                     ((and (consp faceprop) (not (keywordp (car faceprop)))
                           (not (memq (car faceprop)
                      '(foreground-color background-color))))
                      ;;(message "include-all: %s, faceprop: %s"
include-all faceprop)
                      (if include-all faceprop (car faceprop)))
                     (t nil))))         ; Invalid face value.
    (cond ((facep face) (list face))
          ((listp face) face)
          (t nil))))





  reply	other threads:[~2013-12-13 20:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-07 10:45 bug#15298: 24.3.50; Background color lost when highlighting a string Sebastien Vauban
2013-11-14  4:01 ` Glenn Morris
     [not found] ` <mailman.6032.1384401725.10748.bug-gnu-emacs@gnu.org>
     [not found]   ` <mailman.6032.1384401725.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-12-13 12:50     ` Sebastien Vauban
2013-12-13 14:11       ` Eli Zaretskii
2013-12-13 16:14         ` Josh
2013-12-13 18:45           ` Eli Zaretskii
2013-12-13 20:21             ` Josh [this message]
     [not found]       ` <mailman.9107.1386943937.10748.bug-gnu-emacs@gnu.org>
     [not found]         ` <mailman.9107.1386943937.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-12-13 15:41           ` Sebastien Vauban
2013-12-13 16:08             ` Eli Zaretskii
2013-12-13 16:41             ` Stefan Monnier
     [not found]               ` <jwvk3f83dsp.fsf-monnier+emacsbugs-mXXj517/zsQ@public.gmane.org>
2013-12-13 19:02                 ` Sebastien Vauban
2013-12-14  2:17                   ` 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='CANdFEAHi+915qjEDq=bQZLAHO4kKpwsQpxx6U7EaM0Azk7xacQ@mail.gmail.com' \
    --to=josh@foxtail.org \
    --cc=15298@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=sva-news@mygooglest.com \
    /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).