unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* disable that the face of a newline character extends to the right
@ 2009-05-17 23:28 Florian Kaufmann
  2009-05-22  4:11 ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Kaufmann @ 2009-05-17 23:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hello

The face of a newline character seems to extend to the right to
infinity.

I have set the background color of font-lock-comment-face, but I find
it ugly if now all comment lines have a colored beam at the right
side.

Is there a way to configure how the background color of a newline
character should be rendered? E.g. not at all, or just the newline
character itself.

Flo


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

* Re: disable that the face of a newline character extends to the right
  2009-05-17 23:28 disable that the face of a newline character extends to the right Florian Kaufmann
@ 2009-05-22  4:11 ` Kevin Rodgers
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2009-05-22  4:11 UTC (permalink / raw)
  To: help-gnu-emacs

Florian Kaufmann wrote:
> The face of a newline character seems to extend to the right to
> infinity.
> 
> I have set the background color of font-lock-comment-face, but I find
> it ugly if now all comment lines have a colored beam at the right
> side.

Exclude the newline from the comment text, by adjusting the regexp or
the syntax table that is responsible for matching comments.

> Is there a way to configure how the background color of a newline
> character should be rendered? E.g. not at all, or just the newline
> character itself.

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: disable that the face of a newline character extends to the right
@ 2009-05-22  8:00 martin rudalics
  0 siblings, 0 replies; 3+ messages in thread
From: martin rudalics @ 2009-05-22  8:00 UTC (permalink / raw)
  To: sensorflo; +Cc: help-gnu-emacs

 > The face of a newline character seems to extend to the right to
 > infinity.
 >
 > I have set the background color of font-lock-comment-face, but I find
 > it ugly if now all comment lines have a colored beam at the right
 > side.
 >
 > Is there a way to configure how the background color of a newline
 > character should be rendered? E.g. not at all, or just the newline
 > character itself.

Try to add the function below to your .emacs.  It's likely suboptimal
and I didn't look into it for quite a while but it still does the job.

martin



(defun font-lock-fontify-syntactically-region (start end &optional loudly ppss)
   "Put proper face on each string and comment between START and END.
START should be at the beginning of a line."
   (let (state face from to lep)
     (goto-char start)
     (setq state (or ppss (syntax-ppss start)))
     (while
         (progn
           (when (or (nth 3 state) (nth 4 state))
             (setq face (funcall font-lock-syntactic-face-function state))
             (setq from (max (nth 8 state) start))
             (setq state
                   (parse-partial-sexp (point) end nil nil state 'syntax-table))
             (setq to (point))
             (save-excursion
               (goto-char from)
               (while (< from to)
                 (setq lep (line-end-position))
                 (if (< lep to)
                     (progn
                       (put-text-property from lep 'face face)
                       (remove-text-properties
		       lep (1+ lep) '(face nil)) ; rear-nonsticky t))
                       (goto-char (setq from (1+ lep))))
                   (put-text-property from to 'face face)
                   (setq from to)))))
           (< (point) end))
       (setq state
         (parse-partial-sexp (point) end nil nil state 'syntax-table)))))




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

end of thread, other threads:[~2009-05-22  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-17 23:28 disable that the face of a newline character extends to the right Florian Kaufmann
2009-05-22  4:11 ` Kevin Rodgers
  -- strict thread matches above, loose matches on Subject: below --
2009-05-22  8:00 martin rudalics

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