[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 3e14bda: Document new features of Prettify Mode
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-25 3e14bda: Document new features of Prettify Mode |
Date: |
Sat, 12 Dec 2015 11:52:02 +0000 |
branch: emacs-25
commit 3e14bdab52d648afb32f7453740de43179a5157c
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Document new features of Prettify Mode
* doc/emacs/programs.texi (Misc for Programs): Document
'prettify-symbols-compose-predicate' and
'prettify-symbols-unprettify-at-point'.
* lisp/progmodes/prog-mode.el (prettify-symbols-alist)
(prettify-symbols-default-compose-p)
(prettify-symbols-compose-predicate)
(prettify-symbols--compose-symbol): Doc fixes.
---
doc/emacs/programs.texi | 23 +++++++++++++++--------
etc/NEWS | 4 +++-
lisp/progmodes/prog-mode.el | 12 ++++++------
3 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index f9d9a27..bfc991b 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -1498,14 +1498,21 @@ with the Foldout package (@pxref{Foldout}).
@findex prettify-symbols-mode
Prettify Symbols mode is a buffer-local minor mode that replaces
-certain strings with more attractive versions for display
-purposes. For example, in Emacs Lisp mode, it replaces the string
address@hidden with the Greek lambda character @samp{λ}. You may wish
-to use this
-in non-programming modes as well. You can customize the mode by
-adding more entries to @code{prettify-symbols-alist}. There is also a
-global version, @code{global-prettify-symbols-mode}, which enables the
-mode in all buffers that support it.
+certain strings with more attractive versions for display purposes.
+For example, in Emacs Lisp mode, it replaces the string @samp{lambda}
+with the Greek lambda character @samp{λ}. You may wish to use this in
+non-programming modes as well. You can customize the mode by adding
+more entries to @code{prettify-symbols-alist}. More elaborate
+customization is available via customizing
address@hidden if its default value
address@hidden is not appropriate. There
+is also a global version, @code{global-prettify-symbols-mode}, which
+enables the mode in all buffers that support it.
+
+ The symbol at point can be shown in its original form. This is
+controlled by the variable @code{prettify-symbols-unprettify-at-point}:
+if address@hidden, the original form of symbol at point will be
+restored for as long as point is at it.
@node C Modes
diff --git a/etc/NEWS b/etc/NEWS
index 246ee37..84a63f8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -335,13 +335,15 @@ provide indentation should use `prog-widen' instead of
`widen' and
** Prettify Symbols mode
++++
*** Prettify Symbols mode supports custom composition predicates. By
overriding the default `prettify-symbols-compose-predicate', modes can
-specify in which contexts a symbol map be composed to some unicode
+specify in which contexts a symbol may be displayed as some Unicode
character. `prettify-symbols-default-compose-p' is the default which
is suitable for most programming languages such as C or Lisp (but not
(La)TeX).
++++
*** Symbols can be unprettified while point is inside them.
New variable `prettify-symbols-unprettify-at-point' configures this.
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index d05e636..9702880 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -136,15 +136,15 @@ Each element looks like (SYMBOL . CHARACTER), where the
symbol
matching SYMBOL (a string, not a regexp) will be shown as
CHARACTER instead.
-CHARACTER can be a character or it can be a list or vector, in
+CHARACTER can be a character, or it can be a list or vector, in
which case it will be used to compose the new symbol as per the
third argument of `compose-region'.")
(defun prettify-symbols-default-compose-p (start end _match)
"Return true iff the symbol MATCH should be composed.
The symbol starts at position START and ends at position END.
-This is default `prettify-symbols-compose-predicate' which is
-suitable for most programming languages such as C or Lisp."
+This is the default for `prettify-symbols-compose-predicate'
+which is suitable for most programming languages such as C or Lisp."
;; Check that the chars should really be composed into a symbol.
(let* ((syntaxes-beg (if (memq (char-syntax (char-after start)) '(?w ?_))
'(?w ?_) '(?. ?\\)))
@@ -156,14 +156,14 @@ suitable for most programming languages such as C or
Lisp."
(defvar-local prettify-symbols-compose-predicate
#'prettify-symbols-default-compose-p
- "A predicate deciding if the currently matched symbol is to be composed.
+ "A predicate for deciding if the currently matched symbol is to be composed.
The matched symbol is the car of one entry in `prettify-symbols-alist'.
-The predicate receives the match's start and end position as well
+The predicate receives the match's start and end positions as well
as the match-string as arguments.")
(defun prettify-symbols--compose-symbol (alist)
"Compose a sequence of characters into a symbol.
-Regexp match data 0 points to the chars."
+Regexp match data 0 specifies the characters to be composed."
;; Check that the chars should really be composed into a symbol.
(let ((start (match-beginning 0))
(end (match-end 0))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 3e14bda: Document new features of Prettify Mode,
Eli Zaretskii <=