From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Lucien Pullen <drurowin@gmail.com>
Subject: Re: [ELPA] Update package: psgml
Date: Mon, 17 Apr 2017 12:34:18 -0400 [thread overview]
Message-ID: <jwva87fxaey.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: m0inm4ger8.fsf@gmail.com
> Update how PSGML uses `sgml-set-face' to include a list of major modes.
> If the current major mode isn't in the list, treat as nil, otherwise t.
> This allows PSGML's parser to be used in other major modes without
> clobbering font locking in the process.
Hmm.. I like the goal, but I don't like lists of major-modes.
Could you give some further details about the context where you bumped
into the problem?
Any reason why you couldn't set sgml-set-face to nil buffer-locally instead?
Stefan
> From c3cf6728d7f4bb1836aefaa78c8eb3e74f722085 Mon Sep 17 00:00:00 2001
> From: Lucien Pullen <drurowin@gmail.com>
> Date: Sun, 16 Apr 2017 16:00:23 -0600
> Subject: [PATCH] psgml: conditionally set face from major mode
> * psgml-parse.el (sgml-set-face): In addition to never (nil) and
> always (t), can be a list of major mode functions to only set face in
> those modes.
> ---
> psgml-parse.el | 12 +++++++-----
> psgml.el | 4 +++-
> 2 files changed, 10 insertions(+), 6 deletions(-)
> diff --git a/psgml-parse.el b/psgml-parse.el
> index 5609767..eb9828e 100644
> --- a/psgml-parse.el
> +++ b/psgml-parse.el
> @@ -1317,8 +1317,9 @@ was successful or nil if failed."
> "Set the type of the markup parsed to TYPE.
> The markup starts at position given by variable `sgml-markup-start' and
> ends at point."
> - (when (and sgml-set-face
> - (null sgml-current-eref))
> + (when (and (or (eq sgml-set-face t)
> + (find major-mode sgml-set-face))
> + (null sgml-current-eref))
> (sgml-set-face-for sgml-markup-start (point) type))
> (setq sgml-markup-type type))
> @@ -2821,7 +2822,7 @@ overrides the entity type in entity look up."
> (when (and (not executing-macro)
> (or (and (boundp 'which-function-mode)
> which-function-mode )
> - sgml-set-face)
> + (or (eq sgml-set-face t) (find major-mode sgml-set-face))
> sgml-buffer-parse-state
> (sit-for 0))
> (let ((deactivate-mark nil))
> @@ -2833,7 +2834,8 @@ overrides the entity type in entity look up."
> (sgml-element-gi sgml-last-element)))
> (let ((eol-pos (save-excursion (end-of-line 1) (point))))
> ;; Set face on current line
> - (when (and sgml-set-face (not (input-pending-p)))
> + (when (and (or (eq sgml-set-face t) (find major-mode sgml-set-face))
> + (not (input-pending-p)))
> (save-excursion
> (condition-case nil
> (sgml-parse-to
> @@ -2846,7 +2848,7 @@ overrides the entity type in entity look up."
> (defun sgml-fontify-buffer (delay)
> (and
> - sgml-set-face
> + (or (eq sgml-set-face t) (find major-mode sgml-set-face))
> (null (sgml-tree-etag-epos
> (sgml-pstate-top-tree sgml-buffer-parse-state)))
> (sit-for delay)
> diff --git a/psgml.el b/psgml.el
> index 142079a..b0ff140 100644
> --- a/psgml.el
> +++ b/psgml.el
> @@ -849,7 +849,9 @@ sgml-normalize-trims If non-nil, sgml-normalize will trim off white space
> from end of element when adding end tag.
> sgml-indent-step How much to increment indent for every element level.
> sgml-indent-data If non-nil, indent in data/mixed context also.
> -sgml-set-face If non-nil, psgml will set the face of parsed markup.
> +sgml-set-face If non-nil, psgml will set the face of parsed markup,
> + either always (when t) or when the buffer's major mode matches
> + one of the listed function names.
> sgml-markup-faces The faces used when the above variable is non-nil.
> sgml-public-map Mapping from public identifiers to file names.
> sgml-offer-save If non-nil, ask about saving modified buffers before
> --
> 2.3.4
next prev parent reply other threads:[~2017-04-17 16:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-16 22:38 [ELPA] Update package: psgml Lucien Pullen
2017-04-17 16:34 ` Stefan Monnier [this message]
2017-04-19 7:39 ` Lucien Pullen
2017-04-19 12:35 ` Stefan Monnier
2017-04-21 8:06 ` [ELPA] Update package: psgml (discard patch) Lucien Pullen
2017-04-21 14:00 ` Stefan Monnier
2017-04-26 10:50 ` Lucien Pullen
2017-04-26 12:34 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwva87fxaey.fsf-monnier+gmane.emacs.devel@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=drurowin@gmail.com \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.