all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* font-lock for comments
@ 2022-02-15  9:33 goncholden via Users list for the GNU Emacs text editor
  2022-02-15 10:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-02-15 19:09 ` fatiparty--- via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 4+ messages in thread
From: goncholden via Users list for the GNU Emacs text editor @ 2022-02-15  9:33 UTC (permalink / raw)
  To: goncholden via Users list for the GNU Emacs text editor

I want to change font for comments to bold. Should I change both
font-lock-comment-delimiter-face and font-lock-comment-delimiter-face ?

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

* Re: font-lock for comments
  2022-02-15  9:33 font-lock for comments goncholden via Users list for the GNU Emacs text editor
@ 2022-02-15 10:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-02-15 11:32   ` goncholden
  2022-02-15 19:09 ` fatiparty--- via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-15 10:59 UTC (permalink / raw)
  To: help-gnu-emacs

goncholden via Users list for the GNU Emacs text editor wrote:

> I want to change font for comments to bold. Should I change
> both font-lock-comment-delimiter-face and
> font-lock-comment-delimiter-face ?

Test this:

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   http://user.it.uu.se/~embe8573/emacs-init/test-face.el
;;;   https://dataswamp.org/~incal/emacs-init/test-face.el

(defun insert-colored-text (str color bright)
  "Insert STR at point, in COLOR, and sometimes BRIGHT."
  (interactive (list (read-string "string: ")
                     (read-string "color: ")
                     (y-or-n-p    "bright? ") ))
  (insert (propertize str 'font-lock-face
          `(:weight ,(if bright 'bold 'normal) :foreground ,color) )))

(defun test-all-faces ()
  "Print a test string in every color, normal and bright."
  (interactive)
  (forward-line)
  (let ((str "this is what it looks like"))
    (dolist (bold '(nil t))
      (dolist (color '("black" "red" "green" "yellow" "blue"
                       "magenta" "cyan" "white") )
        (insert-colored-text
         (format "%s in %s (that is %sbold)\n" str color
                 (if bold "" "not "))
         color bold) ))))
;; (test-all-faces)

(when nil
  (progn
    (goto-char (point-max))
    (insert "The French flag is ")
    (insert-colored-text "blue, "   "blue"  t)
    (insert-colored-text "white, "  "white" t)
    (insert "and" )
    (insert-colored-text " red."    "red"   nil) ))
                                                ;^ eval me

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: font-lock for comments
  2022-02-15 10:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-15 11:32   ` goncholden
  0 siblings, 0 replies; 4+ messages in thread
From: goncholden @ 2022-02-15 11:32 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

------- Original Message -------
On Tuesday, February 15th, 2022 at 10:59 AM, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> goncholden via Users list for the GNU Emacs text editor wrote:

> > I want to change font for comments to bold. Should I change
> > both font-lock-comment-delimiter-face and
> > font-lock-comment-delimiter-face ?
>
> Test this:
>
> ;;; -- lexical-binding: t --
> ;;; this file:
> ;;; http://user.it.uu.se/~embe8573/emacs-init/test-face.el
> ;;; https://dataswamp.org/~incal/emacs-init/test-face.el
>
> (defun insert-colored-text (str color bright)
> "Insert STR at point, in COLOR, and sometimes BRIGHT."
> (interactive (list (read-string "string: ")
> (read-string "color: ")
> (y-or-n-p "bright? ") ))
> (insert (propertize str 'font-lock-face
> `(:weight ,(if bright 'bold 'normal) :foreground ,color) )))
>
> (defun test-all-faces ()
> "Print a test string in every color, normal and bright."
> (interactive)
> (forward-line)
> (let ((str "this is what it looks like"))
> (dolist (bold '(nil t))
> (dolist (color '("black" "red" "green" "yellow" "blue"
> "magenta" "cyan" "white") )
> (insert-colored-text
> (format "%s in %s (that is %sbold)\n" str color
> (if bold "" "not "))
> color bold) ))))
> ;; (test-all-faces)
>
> (when nil
> (progn
> (goto-char (point-max))
> (insert "The French flag is ")
> (insert-colored-text "blue, " "blue" t)
> (insert-colored-text "white, " "white" t)
> (insert "and" )
> (insert-colored-text " red." "red" nil) ))

I failed to understand how the code helps me.




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

* Re: font-lock for comments
  2022-02-15  9:33 font-lock for comments goncholden via Users list for the GNU Emacs text editor
  2022-02-15 10:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-15 19:09 ` fatiparty--- via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 4+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-02-15 19:09 UTC (permalink / raw)
  To: goncholden; +Cc: goncholden via Users list for the GNU Emacs text editor


Feb 15, 2022, 21:33 by help-gnu-emacs@gnu.org:

> I want to change font for comments to bold. Should I change both
> font-lock-comment-delimiter-face and font-lock-comment-delimiter-face ?
>

Have never thought about this.  Have always been changing font-lock-comment-face 
and things seem fine.



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

end of thread, other threads:[~2022-02-15 19:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15  9:33 font-lock for comments goncholden via Users list for the GNU Emacs text editor
2022-02-15 10:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-15 11:32   ` goncholden
2022-02-15 19:09 ` fatiparty--- via Users list for the GNU Emacs text editor

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.