all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#39624: 26.3; Inserting text in a specified face
@ 2020-02-15 21:20 Greg Hill
  2020-02-15 23:24 ` Stephen Berman
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Hill @ 2020-02-15 21:20 UTC (permalink / raw)
  To: 39624



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





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

* bug#39624: 26.3; Inserting text in a specified face
  2020-02-15 21:20 bug#39624: 26.3; Inserting text in a specified face Greg Hill
@ 2020-02-15 23:24 ` Stephen Berman
  2020-02-20 17:52   ` Stephen Berman
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Berman @ 2020-02-15 23:24 UTC (permalink / raw)
  To: Greg Hill; +Cc: 39624

On Sat, 15 Feb 2020 13:20:01 -0800 Greg Hill <gregoryohill@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





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

* bug#39624: 26.3; Inserting text in a specified face
  2020-02-15 23:24 ` Stephen Berman
@ 2020-02-20 17:52   ` Stephen Berman
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Berman @ 2020-02-20 17:52 UTC (permalink / raw)
  To: Greg Hill; +Cc: 39624-done

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@gmx.net> wrote:

> On Sat, 15 Feb 2020 13:20:01 -0800 Greg Hill <gregoryohill@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





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

end of thread, other threads:[~2020-02-20 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-15 21:20 bug#39624: 26.3; Inserting text in a specified face Greg Hill
2020-02-15 23:24 ` Stephen Berman
2020-02-20 17:52   ` Stephen Berman

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.