GNU bug report logs - #39624
26.3; Inserting text in a specified face

Previous Next

Package: emacs;

Reported by: Greg Hill <gregoryohill <at> gmail.com>

Date: Sat, 15 Feb 2020 21:47:01 UTC

Severity: wishlist

Found in version 26.3

Done: Stephen Berman <stephen.berman <at> gmx.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39624 in the body.
You can then email your comments to 39624 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39624; Package emacs. (Sat, 15 Feb 2020 21:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Greg Hill <gregoryohill <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 15 Feb 2020 21:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Greg Hill <gregoryohill <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; Inserting text in a specified face
Date: Sat, 15 Feb 2020 13:20:01 -0800

I'm just trying to figure out how to use the 'insert' function to insert
one string in the currently active buffer in a specific face like
'custom-comment'). I'm sure it's easy to do, but I have spent
several hours searching through all the Info documentation and haven't
found a single clue. If I could figure out how to do it, I would write
my own function like '(insert-using-face STRING FACE)' if no existing
function does that.


In GNU Emacs 26.3 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511))
of 2019-09-02 built on builder10-10.porkrind.org
Windowing system distributor 'Apple', version 10.3.1561
Recent messages:
Starting new Ispell process ispell with default dictionary...
apply: Searching for program: No such file or directory, ispell
Quit [2 times]
Starting new Ispell process ispell with default dictionary...
apply: Searching for program: No such file or directory, ispell
Quit
"Blue1"
Auto-saving...done
Mark saved where search started
Mark set
mwheel-scroll: Beginning of buffer [46 times]
Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS

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

Major mode: Info

Minor modes in effect:
  save-place-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(ispell ibuf-ext ibuffer ibuffer-loaddefs pp shadow sort mail-extr
emacsbug message rmc puny seq format-spec rfc822 mml mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils view tildify table rst rng-valid rng-loc rng-uri rng-parse
nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-util
nxml-enc xmltok refer refer-to-bibtex refbib printing picture noutline
outline easy-mmode nroff-mode disp-table enriched ebnf2ps ps-print
ps-print-loaddefs ps-def lpr delim-col bib-mode cus-edit wid-edit color
two-column iso-transl rect delsel kmacro cl-print byte-opt gv bytecomp
byte-compile cconv debug completion dos-w32 find-cmd grep compile comint
ansi-color ring find-dired dired dired-loaddefs misearch multi-isearch
mode-local find-func thingatpt help-fns radix-tree apropos warnings
saveplace cus-start cus-load cl-seq cl-extra help-mode elec-pair
jka-compr info easymenu desktop frameset cl-loaddefs cl-lib time-date
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded 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 threads kqueue cocoa ns
multi-tty make-network-process emacs)

Memory information:
((conses 16 449106 71432)
(symbols 48 29014 3)
(miscs 40 944 1252)
(strings 32 67655 2467)
(string-bytes 1 5282950)
(vectors 16 45812)
(vector-slots 8 840469 39428)
(floats 8 559 529)
(intervals 56 38870 11)
(buffers 992 35))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39624; Package emacs. (Sat, 15 Feb 2020 23:26:01 GMT) Full text and rfc822 format available.

Message #8 received at 39624 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Greg Hill <gregoryohill <at> gmail.com>
Cc: 39624 <at> debbugs.gnu.org
Subject: Re: bug#39624: 26.3; Inserting text in a specified face
Date: Sun, 16 Feb 2020 00:24:49 +0100
On Sat, 15 Feb 2020 13:20:01 -0800 Greg Hill <gregoryohill <at> gmail.com> wrote:

> I'm just trying to figure out how to use the 'insert' function to insert
> one string in the currently active buffer in a specific face like
> 'custom-comment'). I'm sure it's easy to do, but I have spent
> several hours searching through all the Info documentation and haven't
> found a single clue.

Here's one way:

(insert (propertize "Test" 'face 'custom-comment))

And here's how you might have found that in the documentation: If you
look in the Elisp manual at the node Faces, it says: "One way to
represent a face is as a property list of attributes", and if you look
at the node Insertion, it says that most of the insertion functions
"copy text characters from strings and buffers along with their
properties".  So properties are a point of intersection between faces
and insertion.  In the Elisp node Text Properties there is a menu that
contains the entry Changing Properties with the description "Setting the
properties of a range of text", which seems to be what you're looking
for.  And indeed, the node Changing Properties describes the function
propertize, saying it is "the easiest way to make a string with text
properties".

Steve Berman




Reply sent to Stephen Berman <stephen.berman <at> gmx.net>:
You have taken responsibility. (Thu, 20 Feb 2020 17:53:02 GMT) Full text and rfc822 format available.

Notification sent to Greg Hill <gregoryohill <at> gmail.com>:
bug acknowledged by developer. (Thu, 20 Feb 2020 17:53:03 GMT) Full text and rfc822 format available.

Message #13 received at 39624-done <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Greg Hill <gregoryohill <at> gmail.com>
Cc: 39624-done <at> debbugs.gnu.org
Subject: Re: bug#39624: 26.3; Inserting text in a specified face
Date: Thu, 20 Feb 2020 18:52:07 +0100
The OP confirmed to me off-list that this bug can be closed, so I'm
doing so.

On Sun, 16 Feb 2020 00:24:49 +0100 Stephen Berman <stephen.berman <at> gmx.net> wrote:

> On Sat, 15 Feb 2020 13:20:01 -0800 Greg Hill <gregoryohill <at> gmail.com> wrote:
>
>> I'm just trying to figure out how to use the 'insert' function to insert
>> one string in the currently active buffer in a specific face like
>> 'custom-comment'). I'm sure it's easy to do, but I have spent
>> several hours searching through all the Info documentation and haven't
>> found a single clue.
>
> Here's one way:
>
> (insert (propertize "Test" 'face 'custom-comment))
>
> And here's how you might have found that in the documentation: If you
> look in the Elisp manual at the node Faces, it says: "One way to
> represent a face is as a property list of attributes", and if you look
> at the node Insertion, it says that most of the insertion functions
> "copy text characters from strings and buffers along with their
> properties".  So properties are a point of intersection between faces
> and insertion.  In the Elisp node Text Properties there is a menu that
> contains the entry Changing Properties with the description "Setting the
> properties of a range of text", which seems to be what you're looking
> for.  And indeed, the node Changing Properties describes the function
> propertize, saying it is "the easiest way to make a string with text
> properties".
>
> Steve Berman




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 20 Mar 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.