unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
@ 2019-03-17 19:41 Emanuel Berg
  2019-03-18  2:59 ` Eric Abrahamsen
       [not found] ` <handler.34898.C.155779671310380.notifdonectrl.0@debbugs.gnu.org>
  0 siblings, 2 replies; 15+ messages in thread
From: Emanuel Berg @ 2019-03-17 19:41 UTC (permalink / raw)
  To: 34898


On gmane.emacs.help, Sun, 17 Mar 2019 15:22:50 +0100,
Damien Collard wrote in Emanuel Berg's thread
"what has the face `message-separator' *really*
done for us?"

    Well, it seems to only be of effect when
    `mail-header-separator' has its default
    value "--text follows this line--".
    I checked, and

    - when it's the default separator, I can
    confirm that changing the face
    `message-separator' does change the
    separator's color.

    - when I changed `mail-header-separator' to
    "---" (or anything different from the
    default), the face `message-separator'
    doesn't apply to it anymore!

    So it's a bug.



In GNU Emacs 24.4.1 (arm-unknown-linux-gnueabihf, GTK+ Version 3.14.5)
 of 2017-09-13 on mb-lxc-01, modified by Debian
System Description:	Raspbian GNU/Linux 8.0 (jessie)

Configured using:
 `configure --build arm-linux-gnueabihf
 --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build arm-linux-gnueabihf --prefix=/usr
 --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3
 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Article

Minor modes in effect:
  show-paren-mode: t
  shell-dirtrack-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  transient-mark-mode: t

Recent input:
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-o e C-n 
C-n C-n C-n C-p C-p C-p C-p C-p C-o e C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-p C-p C-p C-p C-p C-o e C-c C-c ESC x 
t o d o RET a n d r e a s SPC t SPC d a t o r RET ESC 
x d b RET ESC o ESC p ESC x r e p o r t - b u g RET 
ESC o ESC o C-g ESC o ESC x d b RET C-o i C-f C-f C-f 
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f 
C-f C-f C-f C-f C-f C-f C-b C-b C-b C-b C-b C-@ ESC 
f ESC f ESC f ESC f ESC b ESC b ESC f C-f ESC w ESC 
x C-g C-x C-s ESC x ESC o ESC o ESC o r e b o r t C-g 
ESC o ESC x r e b o DEL DEL p o r t - b u g RET

Recent messages:
Sending email 
Sending email done
250 Message received
221 mx.zoho.eu closing connection
Mark set
Sending...done
Added to /home/incal/DO_THIS
Mark set [2 times]
Saving file /home/incal/ooa/doodle.el...
Wrote /home/incal/ooa/doodle.el

Load-path shadows:
/usr/share/emacs/24.4/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.4/lisp/md4
/usr/share/emacs24/site-lisp/flim/hex-util hides /usr/share/emacs/24.4/lisp/hex-util
~/.emacs.d/lisp/abbrev hides /usr/share/emacs/24.4/lisp/abbrev
~/.emacs.d/emacs-init/gnus/server hides /usr/share/emacs/24.4/lisp/server
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.4/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.4/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/24.4/lisp/net/sasl-ntlm
/usr/share/emacs24/site-lisp/flim/sasl-cram hides /usr/share/emacs/24.4/lisp/net/sasl-cram
/usr/share/emacs24/site-lisp/flim/ntlm hides /usr/share/emacs/24.4/lisp/net/ntlm
/usr/share/emacs24/site-lisp/flim/sasl hides /usr/share/emacs/24.4/lisp/net/sasl
/usr/share/emacs24/site-lisp/flim/hmac-def hides /usr/share/emacs/24.4/lisp/net/hmac-def
/usr/share/emacs24/site-lisp/flim/hmac-md5 hides /usr/share/emacs/24.4/lisp/net/hmac-md5
/usr/share/emacs24/site-lisp/flim/sasl-digest hides /usr/share/emacs/24.4/lisp/net/sasl-digest

Features:
(shadow emacsbug url-http url-gw url-cache
url-auth mailalias canlock eieio-opt speedbar
sb-image ezimage dframe find-func mail-extr
gnus-async gnus-bcklg nnir qp gnus-ml sh-script
smie executable tabify w3m-cookie pop3 nndraft
nnmh nnml gnutls network-stream starttls tls
gnus-agent nnvirtual nntp gnus-cache mule-util
cl-macs gv w3m-filter ffap paren xsel w3m-form
google-translate-core-ui ido
google-translate-core google-translate-tk url
url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util
url-parse url-vars json time-my lpr parse-time
tramp-sh netrc term disp-table ehelp my-faces
bibtex t-mouse man tex-mode iterate-files
seq-24 isbn slime-presentations slime-repl
slime-parse bridge nroff-mode sgml-mode
cobol-mode ada-mode which-func imenu align
find-file checkdoc cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs guile summary message-my moggle
mail-to-many mail smtpmail sendmail global-keys
yank-my wrap-search w3m-unisearch w3m-search
spell-new ispell sort-my sort slime etags
arc-mode archive-mode noutline outline
easy-mmode hyperspec shell-cli revert-buffer-my
lisp-new ielm linux-shell kill keys help-new
debug apropos help-mode dired-x compile-my
mode-line compile article gnus-cite dl
bookmarks w3m-bookmark file-write-to erc-my
fill-new quit gnus-my group group-summary
gnus-srvr gnus-score score-mode gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime
dig mailcap gnus-sum nnoo gnus-group gnus-undo
nnmail mail-source gnus-start gnus-spec
gnus-int gnus-range gnus-win message rfc822 mml
mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev gmm-utils mailheader gnus gnus-ems
nnheader mail-utils info slime-autoloads
package epg-config edit tabs dired-my w3m-my
w3m-tabs cus-edit cus-start cus-load
w3m-session w3m browse-url doc-view jka-compr
image-mode timezone w3m-hist w3m-fb
bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon
w3m-image w3m-proc w3m-util files-my tramp
tramp-compat tramp-loaddefs trampver shell
advice sudo-user-path find-command window-new
count get-search-string caps-back buffer-menu
switch-to-buffer super scroll error dired close
buc switch-to-buffer-regexp subr-x align-new
erc-list erc-menu easymenu erc-join erc-ring
erc-networks erc-pcomplete pcomplete comint
ansi-color ring erc-track erc-match erc-button
wid-edit erc-fill erc-stamp erc-netsplit
erc-goodies erc erc-backend erc-compat
format-spec auth-source eieio byte-opt bytecomp
byte-compile cconv eieio-core gnus-util
time-date mm-util help-fns mail-prsvr
password-cache thingatpt pp my-string
search-regexp-in-files cl-loaddefs cl-lib
w3m-load tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer
nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget
hashtable-print-readable backquote
make-network-process dbusbind gfilenotify
dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit
x multi-tty emacs)

Memory information:
((conses 8 782922 127778)
 (symbols 24 51426 0)
 (miscs 20 472 2870)
 (strings 16 153409 15368)
 (string-bytes 1 4288915)
 (vectors 8 53465)
 (vector-slots 4 1639637 64486)
 (floats 8 427 1073)
 (intervals 28 8397 842)
 (buffers 512 76)
 (heap 1024 60216 7085))

-- 
underground experts united
http://user.it.uu.se/~embe8573






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-17 19:41 bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator' Emanuel Berg
@ 2019-03-18  2:59 ` Eric Abrahamsen
  2019-03-18  3:14   ` Emanuel Berg
                     ` (2 more replies)
       [not found] ` <handler.34898.C.155779671310380.notifdonectrl.0@debbugs.gnu.org>
  1 sibling, 3 replies; 15+ messages in thread
From: Eric Abrahamsen @ 2019-03-18  2:59 UTC (permalink / raw)
  To: 34898

Emanuel Berg <moasenwood@zoho.eu> writes:

> On gmane.emacs.help, Sun, 17 Mar 2019 15:22:50 +0100,
> Damien Collard wrote in Emanuel Berg's thread
> "what has the face `message-separator' *really*
> done for us?"
>
>     Well, it seems to only be of effect when
>     `mail-header-separator' has its default
>     value "--text follows this line--".
>     I checked, and
>
>     - when it's the default separator, I can
>     confirm that changing the face
>     `message-separator' does change the
>     separator's color.
>
>     - when I changed `mail-header-separator' to
>     "---" (or anything different from the
>     default), the face `message-separator'
>     doesn't apply to it anymore!
>
>     So it's a bug.

The value of `mail-header-separator' gets added to
`message-font-lock-keywords', which does the actual fontification. Using
setq to change the value of `mail-header-separator' did not change the
font lock keyword, despite setting the variable before message.el is
loaded (or is it pre-loaded?). Using the customize interface to set
`mail-header-separator' *does* work as expected.

Dunno if it's supposed to work this way or not.

Eric






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18  2:59 ` Eric Abrahamsen
@ 2019-03-18  3:14   ` Emanuel Berg
  2019-03-18 17:21     ` Basil L. Contovounesios
  2019-03-18 16:46   ` Eli Zaretskii
  2019-03-18 17:14   ` Basil L. Contovounesios
  2 siblings, 1 reply; 15+ messages in thread
From: Emanuel Berg @ 2019-03-18  3:14 UTC (permalink / raw)
  To: 34898

Eric Abrahamsen wrote:

> The value of `mail-header-separator' gets
> added to `message-font-lock-keywords', which
> does the actual fontification. Using setq to
> change the value of `mail-header-separator'
> did not change the font lock keyword, despite
> setting the variable before message.el is
> loaded (or is it pre-loaded?). Using the
> customize interface to set
> `mail-header-separator' *does* work
> as expected.
>
> Dunno if it's supposed to work this way
> or not.

All the other message faces don't behave like
that but can be set as expected.

Also the wierd behavior that it works with the
default value for the `mail-header-separator'
but not if one changes it.

-- 
underground experts united
http://user.it.uu.se/~embe8573






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18  2:59 ` Eric Abrahamsen
  2019-03-18  3:14   ` Emanuel Berg
@ 2019-03-18 16:46   ` Eli Zaretskii
  2019-03-18 16:55     ` Emanuel Berg
  2019-03-18 17:01     ` Basil L. Contovounesios
  2019-03-18 17:14   ` Basil L. Contovounesios
  2 siblings, 2 replies; 15+ messages in thread
From: Eli Zaretskii @ 2019-03-18 16:46 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 34898

> From: Eric Abrahamsen <eric@ericabrahamsen.net>
> Date: Sun, 17 Mar 2019 19:59:41 -0700
> 
> >     So it's a bug.
> 
> The value of `mail-header-separator' gets added to
> `message-font-lock-keywords', which does the actual fontification. Using
> setq to change the value of `mail-header-separator' did not change the
> font lock keyword, despite setting the variable before message.el is
> loaded (or is it pre-loaded?). Using the customize interface to set
> `mail-header-separator' *does* work as expected.

Right.  So I don't think there's a bug here.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18 16:46   ` Eli Zaretskii
@ 2019-03-18 16:55     ` Emanuel Berg
  2019-03-18 17:01     ` Basil L. Contovounesios
  1 sibling, 0 replies; 15+ messages in thread
From: Emanuel Berg @ 2019-03-18 16:55 UTC (permalink / raw)
  To: 34898

Eli Zaretskii wrote:

>> The value of `mail-header-separator' gets
>> added to `message-font-lock-keywords', which
>> does the actual fontification. Using setq to
>> change the value of `mail-header-separator'
>> did not change the font lock keyword,
>> despite setting the variable before
>> message.el is loaded (or is it pre-loaded?).
>> Using the customize interface to set
>> `mail-header-separator' *does* work
>> as expected.
>
> Right. So I don't think there's a bug here.

Then why do all the other Message mode faces
work as expected, but this doesn't?

And why does it work to change the face when
`mail-header-separator' is at its original
"--text follows this line--", but not when
changed to "---" or any other value for
that matter?

If it isn't a bug, perhaps we should have a new
list/newsgroup called
gmane.emacs.wierd-behavior where we can report
this kind of things in good order?

-- 
underground experts united
http://user.it.uu.se/~embe8573






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18 16:46   ` Eli Zaretskii
  2019-03-18 16:55     ` Emanuel Berg
@ 2019-03-18 17:01     ` Basil L. Contovounesios
  2019-03-18 18:23       ` Basil L. Contovounesios
  2019-04-22 23:43       ` Basil L. Contovounesios
  1 sibling, 2 replies; 15+ messages in thread
From: Basil L. Contovounesios @ 2019-03-18 17:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Eric Abrahamsen, 34898

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> Date: Sun, 17 Mar 2019 19:59:41 -0700
>> 
>> >     So it's a bug.
>> 
>> The value of `mail-header-separator' gets added to
>> `message-font-lock-keywords', which does the actual fontification. Using
>> setq to change the value of `mail-header-separator' did not change the
>> font lock keyword, despite setting the variable before message.el is
>> loaded (or is it pre-loaded?). Using the customize interface to set
>> `mail-header-separator' *does* work as expected.
>
> Right.  So I don't think there's a bug here.

Actually, I think message-font-lock-keywords can do better:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-mail-header-separator-font-lock-in-message.el.patch --]
[-- Type: text/x-diff, Size: 1997 bytes --]

From 0aa67e4ac6cd2ac93c05c7b7bec486c5fefd12dd Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Mon, 18 Mar 2019 15:09:45 +0000
Subject: [PATCH] Fix mail-header-separator font lock in message.el

* lisp/gnus/message.el (message-font-lock-keywords): Dynamically
font lock mail-header-separator, in case it changes. (bug#34898)
---
 lisp/gnus/message.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c491f16dd8..079a13c706 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1599,19 +1599,21 @@ message-font-lock-keywords
 	(progn (goto-char (match-beginning 0)) (match-end 0)) nil
         (1 'message-header-name)
         (2 'message-header-other nil t)))
-      ,@(if (and mail-header-separator
-		 (not (equal mail-header-separator "")))
-	    `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
-	       1 'message-separator))
-	  nil)
-      ((lambda (limit)
-	 (re-search-forward (concat "^\\("
-				    message-cite-prefix-regexp
-				    "\\).*")
-			    limit t))
-       (0 'message-cited-text))
-      ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
-       (0 'message-mml))))
+      (,(lambda (limit)
+          (and mail-header-separator
+               (not (equal mail-header-separator ""))
+               (re-search-forward
+                (concat "^" (regexp-quote mail-header-separator) "$")
+                limit t)))
+       1 'message-separator)
+      (,(lambda (limit)
+          (re-search-forward (concat "^\\(?:"
+                                     message-cite-prefix-regexp
+                                     "\\).*")
+                             limit t))
+       0 'message-cited-text)
+      ("<#/?\\(?:multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
+       0 'message-mml)))
   "Additional expressions to highlight in Message mode.")
 
 (defvar message-face-alist
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 171 bytes --]


This is similar to what mail-font-lock-keywords does in
lisp/mail/sendmail.el, namely adapt the font lock keywords to changes in
mail-header-separator.

WDYT?

-- 
Basil

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18  2:59 ` Eric Abrahamsen
  2019-03-18  3:14   ` Emanuel Berg
  2019-03-18 16:46   ` Eli Zaretskii
@ 2019-03-18 17:14   ` Basil L. Contovounesios
  2019-03-18 18:46     ` Eric Abrahamsen
  2 siblings, 1 reply; 15+ messages in thread
From: Basil L. Contovounesios @ 2019-03-18 17:14 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 34898

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> The value of `mail-header-separator' gets added to
> `message-font-lock-keywords', which does the actual fontification. Using
> setq to change the value of `mail-header-separator' did not change the
> font lock keyword, despite setting the variable before message.el is
> loaded (or is it pre-loaded?). Using the customize interface to set
> `mail-header-separator' *does* work as expected.

0. emacs -Q
1. (setq mail-header-separator "--") C-j
2. C-x m

Note that setting mail-header-separator before loading message.el works
as expected.

3. M-x customize-variable RET mail-header-separator RET
4. Change value from "--" to "--foo--"
5. C-c C-c
6. C-x m

Note that "--foo--" gets inserted, but message-font-lock-keywords still
holds the value that mail-header-separator had at the time message.el
was loaded.

Since mail-header-separator lacks a custom setter, it makes no
difference whether you use setq or Customize, so long as its value is
changed before message.el is loaded.  Otherwise, you have to reevaluate
and reapply message-font-lock-keywords.

-- 
Basil





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18  3:14   ` Emanuel Berg
@ 2019-03-18 17:21     ` Basil L. Contovounesios
  2019-03-18 22:55       ` Emanuel Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Basil L. Contovounesios @ 2019-03-18 17:21 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: 34898

[Sorry for the duplicate message Emanuel, I think your Mail-Followup-To
 and Mail-Copies-To headers caused my reply to be sent to the wrong
 place.]

Emanuel Berg <moasenwood@zoho.eu> writes:

> Eric Abrahamsen wrote:
>
>> The value of `mail-header-separator' gets
>> added to `message-font-lock-keywords', which
>> does the actual fontification. Using setq to
>> change the value of `mail-header-separator'
>> did not change the font lock keyword, despite
>> setting the variable before message.el is
>> loaded (or is it pre-loaded?). Using the
>> customize interface to set
>> `mail-header-separator' *does* work
>> as expected.
>>
>> Dunno if it's supposed to work this way
>> or not.
>
> All the other message faces don't behave like
> that but can be set as expected.
>
> Also the wierd behavior that it works with the
> default value for the `mail-header-separator'
> but not if one changes it.

The issue doesn't lie with the message-separator face, but with how
message-font-lock-keywords registers which text should be fontified with
that face.

Currently, message-font-lock-keywords registers only whatever non-empty
value mail-header-separator had at the time message.el was loaded.

-- 
Basil





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18 17:01     ` Basil L. Contovounesios
@ 2019-03-18 18:23       ` Basil L. Contovounesios
  2019-04-22 23:43       ` Basil L. Contovounesios
  1 sibling, 0 replies; 15+ messages in thread
From: Basil L. Contovounesios @ 2019-03-18 18:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Eric Abrahamsen, 34898

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Actually, I think message-font-lock-keywords can do better:
>
> From 0aa67e4ac6cd2ac93c05c7b7bec486c5fefd12dd Mon Sep 17 00:00:00 2001
> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Date: Mon, 18 Mar 2019 15:09:45 +0000
> Subject: [PATCH] Fix mail-header-separator font lock in message.el
>
> * lisp/gnus/message.el (message-font-lock-keywords): Dynamically
> font lock mail-header-separator, in case it changes. (bug#34898)
> ---
>  lisp/gnus/message.el | 28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
> index c491f16dd8..079a13c706 100644
> --- a/lisp/gnus/message.el
> +++ b/lisp/gnus/message.el
> @@ -1599,19 +1599,21 @@ message-font-lock-keywords
>  	(progn (goto-char (match-beginning 0)) (match-end 0)) nil
>          (1 'message-header-name)
>          (2 'message-header-other nil t)))
> -      ,@(if (and mail-header-separator
> -		 (not (equal mail-header-separator "")))
> -	    `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
> -	       1 'message-separator))
> -	  nil)
> -      ((lambda (limit)
> -	 (re-search-forward (concat "^\\("
> -				    message-cite-prefix-regexp
> -				    "\\).*")
> -			    limit t))
> -       (0 'message-cited-text))
> -      ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
> -       (0 'message-mml))))
> +      (,(lambda (limit)
> +          (and mail-header-separator
> +               (not (equal mail-header-separator ""))
> +               (re-search-forward
> +                (concat "^" (regexp-quote mail-header-separator) "$")
> +                limit t)))
> +       1 'message-separator)
         ^^^

Sorry, that should be 0.

> +      (,(lambda (limit)
> +          (re-search-forward (concat "^\\(?:"
> +                                     message-cite-prefix-regexp
> +                                     "\\).*")
> +                             limit t))
> +       0 'message-cited-text)
> +      ("<#/?\\(?:multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
> +       0 'message-mml)))
>    "Additional expressions to highlight in Message mode.")
>  
>  (defvar message-face-alist
> -- 
> 2.20.1
>
>
> This is similar to what mail-font-lock-keywords does in
> lisp/mail/sendmail.el, namely adapt the font lock keywords to changes in
> mail-header-separator.
>
> WDYT?

-- 
Basil





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18 17:14   ` Basil L. Contovounesios
@ 2019-03-18 18:46     ` Eric Abrahamsen
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Abrahamsen @ 2019-03-18 18:46 UTC (permalink / raw)
  To: 34898

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> The value of `mail-header-separator' gets added to
>> `message-font-lock-keywords', which does the actual fontification. Using
>> setq to change the value of `mail-header-separator' did not change the
>> font lock keyword, despite setting the variable before message.el is
>> loaded (or is it pre-loaded?). Using the customize interface to set
>> `mail-header-separator' *does* work as expected.
>
> 0. emacs -Q
> 1. (setq mail-header-separator "--") C-j
> 2. C-x m
>
> Note that setting mail-header-separator before loading message.el works
> as expected.
>
> 3. M-x customize-variable RET mail-header-separator RET
> 4. Change value from "--" to "--foo--"
> 5. C-c C-c
> 6. C-x m
>
> Note that "--foo--" gets inserted, but message-font-lock-keywords still
> holds the value that mail-header-separator had at the time message.el
> was loaded.
>
> Since mail-header-separator lacks a custom setter, it makes no
> difference whether you use setq or Customize, so long as its value is
> changed before message.el is loaded.  Otherwise, you have to reevaluate
> and reapply message-font-lock-keywords.

I didn't try with emacs -Q, probably something in my setup ends up
loading message.el at startup.

Thanks,
Eric






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18 17:21     ` Basil L. Contovounesios
@ 2019-03-18 22:55       ` Emanuel Berg
  0 siblings, 0 replies; 15+ messages in thread
From: Emanuel Berg @ 2019-03-18 22:55 UTC (permalink / raw)
  To: 34898

Basil L. Contovounesios wrote:

> [Sorry for the duplicate message Emanuel,
>  I think your Mail-Followup-To and
>  Mail-Copies-To headers caused my reply to be
>  sent to the wrong place.]

Np :)

> The issue doesn't lie with the
> message-separator face, but with how
> message-font-lock-keywords registers which
> text should be fontified with that face.
>
> Currently, message-font-lock-keywords
> registers only whatever non-empty value
> mail-header-separator had at the time
> message.el was loaded.

Well, I don't have any under-the-hood
understanding of this problem, but at least
from above the hood, it sure looks like a bug
all days of the week :)

Glad you made an effort to figure it out :)

-- 
underground experts united
http://user.it.uu.se/~embe8573






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-03-18 17:01     ` Basil L. Contovounesios
  2019-03-18 18:23       ` Basil L. Contovounesios
@ 2019-04-22 23:43       ` Basil L. Contovounesios
  2019-05-13 20:00         ` Lars Ingebrigtsen
  1 sibling, 1 reply; 15+ messages in thread
From: Basil L. Contovounesios @ 2019-04-22 23:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Eric Abrahamsen, 34898

[-- Attachment #1: Type: text/plain, Size: 47 bytes --]

tags 34898 patch
severity 34898 wishlist
quit


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-mail-header-separator-font-lock-in-message.el.patch --]
[-- Type: text/x-diff, Size: 1997 bytes --]

From d7d8b44cc497f2611461693b4c5591b98b8f8c42 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Mon, 18 Mar 2019 18:21:15 +0000
Subject: [PATCH] Fix mail-header-separator font lock in message.el

* lisp/gnus/message.el (message-font-lock-keywords): Dynamically
font lock mail-header-separator, in case it changes. (bug#34898)
---
 lisp/gnus/message.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c8b6f0ee68..461c64b2c3 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1599,19 +1599,21 @@ message-font-lock-keywords
 	(progn (goto-char (match-beginning 0)) (match-end 0)) nil
         (1 'message-header-name)
         (2 'message-header-other nil t)))
-      ,@(if (and mail-header-separator
-		 (not (equal mail-header-separator "")))
-	    `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
-	       1 'message-separator))
-	  nil)
-      ((lambda (limit)
-	 (re-search-forward (concat "^\\("
-				    message-cite-prefix-regexp
-				    "\\).*")
-			    limit t))
-       (0 'message-cited-text))
-      ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
-       (0 'message-mml))))
+      (,(lambda (limit)
+          (and mail-header-separator
+               (not (equal mail-header-separator ""))
+               (re-search-forward
+                (concat "^" (regexp-quote mail-header-separator) "$")
+                limit t)))
+       0 'message-separator)
+      (,(lambda (limit)
+          (re-search-forward (concat "^\\(?:"
+                                     message-cite-prefix-regexp
+                                     "\\).*")
+                             limit t))
+       0 'message-cited-text)
+      ("<#/?\\(?:multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
+       0 'message-mml)))
   "Additional expressions to highlight in Message mode.")
 
 (defvar message-face-alist
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 1160 bytes --]


"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>>> Date: Sun, 17 Mar 2019 19:59:41 -0700
>>> 
>>> >     So it's a bug.
>>> 
>>> The value of `mail-header-separator' gets added to
>>> `message-font-lock-keywords', which does the actual fontification. Using
>>> setq to change the value of `mail-header-separator' did not change the
>>> font lock keyword, despite setting the variable before message.el is
>>> loaded (or is it pre-loaded?). Using the customize interface to set
>>> `mail-header-separator' *does* work as expected.
>>
>> Right.  So I don't think there's a bug here.
>
> Actually, I think message-font-lock-keywords can do better:

[...]

> This is similar to what mail-font-lock-keywords does in
> lisp/mail/sendmail.el, namely adapt the font lock keywords to changes in
> mail-header-separator.

For reasons explained elsewhere in this thread, I think the current
behaviour is a shortcoming, even if it's not considered a bug.  I would
like to push my patch which addresses this, and which I reattach for
convenience.  WDYT?

Thanks,

-- 
Basil

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-04-22 23:43       ` Basil L. Contovounesios
@ 2019-05-13 20:00         ` Lars Ingebrigtsen
  2019-05-14  1:18           ` Basil L. Contovounesios
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-05-13 20:00 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: Eric Abrahamsen, 34898

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> tags 34898 patch
> severity 34898 wishlist
> quit
>
>>From d7d8b44cc497f2611461693b4c5591b98b8f8c42 Mon Sep 17 00:00:00 2001
> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Date: Mon, 18 Mar 2019 18:21:15 +0000
> Subject: [PATCH] Fix mail-header-separator font lock in message.el
>
> * lisp/gnus/message.el (message-font-lock-keywords): Dynamically
> font lock mail-header-separator, in case it changes. (bug#34898)

I think that looks like a good solution...  did you apply it to the
Emacs repo?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
  2019-05-13 20:00         ` Lars Ingebrigtsen
@ 2019-05-14  1:18           ` Basil L. Contovounesios
  0 siblings, 0 replies; 15+ messages in thread
From: Basil L. Contovounesios @ 2019-05-14  1:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eric Abrahamsen, 34898-done

tags 34898 fixed
close 34898 27.1
quit

Lars Ingebrigtsen <larsi@gnus.org> writes:

>>>From d7d8b44cc497f2611461693b4c5591b98b8f8c42 Mon Sep 17 00:00:00 2001
>> From: "Basil L. Contovounesios" <contovob@tcd.ie>
>> Date: Mon, 18 Mar 2019 18:21:15 +0000
>> Subject: [PATCH] Fix mail-header-separator font lock in message.el
>>
>> * lisp/gnus/message.el (message-font-lock-keywords): Dynamically
>> font lock mail-header-separator, in case it changes. (bug#34898)
>
> I think that looks like a good solution...  did you apply it to the
> Emacs repo?

Thanks, I just pushed it to master[1] and am therefore closing this
report.

[1: 2f7e97ef48]: Fix mail-header-separator font lock in message.el
  2019-05-14 02:15:37 +0100
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=2f7e97ef482ddacd0ed21ccd25ca777beb60ab35

-- 
Basil





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#34898: acknowledged by developer (Re: bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator')
       [not found] ` <handler.34898.C.155779671310380.notifdonectrl.0@debbugs.gnu.org>
@ 2019-05-14 11:15   ` Emanuel Berg
  0 siblings, 0 replies; 15+ messages in thread
From: Emanuel Berg @ 2019-05-14 11:15 UTC (permalink / raw)
  To: 34898

> This is an automatic notification regarding
> your bug report #34898: 24.4;
> `message-separator' face only works for
> default value of `mail-header-separator',
> which was filed against the emacs package.
>
> Thank you for your report, which has now been
> closed. You can view the full report at
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34898

When I submitted the bug report, I could never
imagine it would require so much work and
discussion to fix. Even tho you fixed it and
not me, I feel blessed to have played a small
part of it. Great job and dedication guys!

-- 
underground experts united
http://user.it.uu.se/~embe8573






^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-05-14 11:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-17 19:41 bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator' Emanuel Berg
2019-03-18  2:59 ` Eric Abrahamsen
2019-03-18  3:14   ` Emanuel Berg
2019-03-18 17:21     ` Basil L. Contovounesios
2019-03-18 22:55       ` Emanuel Berg
2019-03-18 16:46   ` Eli Zaretskii
2019-03-18 16:55     ` Emanuel Berg
2019-03-18 17:01     ` Basil L. Contovounesios
2019-03-18 18:23       ` Basil L. Contovounesios
2019-04-22 23:43       ` Basil L. Contovounesios
2019-05-13 20:00         ` Lars Ingebrigtsen
2019-05-14  1:18           ` Basil L. Contovounesios
2019-03-18 17:14   ` Basil L. Contovounesios
2019-03-18 18:46     ` Eric Abrahamsen
     [not found] ` <handler.34898.C.155779671310380.notifdonectrl.0@debbugs.gnu.org>
2019-05-14 11:15   ` bug#34898: acknowledged by developer (Re: bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator') Emanuel Berg

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).