Function: whitespace-interactive-char
whitespace-interactive-char is a byte-compiled function defined in
whitespace.el.gz.
Signature
(whitespace-interactive-char LOCAL-P)
Documentation
Interactive function to read a char and return a symbol.
If LOCAL-P is non-nil, it uses a local context; otherwise, it uses a global context.
It accepts one of the following chars:
CHAR MEANING
(VIA FACES)
f toggle face visualization
t toggle TAB visualization
s toggle SPACE and HARD SPACE visualization
r toggle trailing blanks visualization
l toggle "long lines" visualization
L toggle "long lines" tail visualization
C-l toggle "long lines" one character visualization
n toggle NEWLINE visualization
e toggle empty line at bob and/or eob visualization
C-i toggle indentation SPACEs visualization (via indent-tabs-mode)
I toggle indentation SPACEs visualization
i toggle indentation TABs visualization
C-a toggle SPACEs after TAB visualization (via indent-tabs-mode)
A toggle SPACEs after TAB: SPACEs visualization
a toggle SPACEs after TAB: TABs visualization
C-b toggle SPACEs before TAB visualization (via indent-tabs-mode)
B toggle SPACEs before TAB: SPACEs visualization
b toggle SPACEs before TAB: TABs visualization
(VIA DISPLAY TABLE)
T toggle TAB visualization
S toggle SPACE and HARD SPACE visualization
N toggle NEWLINE visualization
x restore whitespace-style value
? display brief help
See also whitespace-toggle-option-alist.
Source Code
;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
(defun whitespace-interactive-char (local-p)
"Interactive function to read a char and return a symbol.
If LOCAL-P is non-nil, it uses a local context; otherwise, it
uses a global context.
It accepts one of the following chars:
CHAR MEANING
(VIA FACES)
f toggle face visualization
t toggle TAB visualization
s toggle SPACE and HARD SPACE visualization
r toggle trailing blanks visualization
l toggle \"long lines\" visualization
L toggle \"long lines\" tail visualization
C-l toggle \"long lines\" one character visualization
n toggle NEWLINE visualization
e toggle empty line at bob and/or eob visualization
C-i toggle indentation SPACEs visualization (via `indent-tabs-mode')
I toggle indentation SPACEs visualization
i toggle indentation TABs visualization
C-a toggle SPACEs after TAB visualization (via `indent-tabs-mode')
A toggle SPACEs after TAB: SPACEs visualization
a toggle SPACEs after TAB: TABs visualization
C-b toggle SPACEs before TAB visualization (via `indent-tabs-mode')
B toggle SPACEs before TAB: SPACEs visualization
b toggle SPACEs before TAB: TABs visualization
(VIA DISPLAY TABLE)
T toggle TAB visualization
S toggle SPACE and HARD SPACE visualization
N toggle NEWLINE visualization
x restore `whitespace-style' value
? display brief help
See also `whitespace-toggle-option-alist'."
(let* ((is-off (not (if local-p
whitespace-mode
global-whitespace-mode)))
(style (cond (is-off whitespace-style) ; use default value
(local-p whitespace-active-style)
(t whitespace-toggle-style)))
(prompt
(format "Whitespace Toggle %s (type ? for further options)-"
(if local-p "Local" "Global")))
ch sym)
;; read a valid option and get the corresponding symbol
(save-window-excursion
(condition-case data
(progn
(while
;; while condition
(progn
(setq ch (read-char prompt))
(not
(setq sym
(cdr
(assq ch whitespace-toggle-option-alist)))))
;; while body
(cond
((eq ch ?\?) (whitespace-help-on style))
((eq ch ?\ ) (whitespace-help-scroll t))
((eq ch ?\M- ) (whitespace-help-scroll))
((eq ch ?>) (whitespace-help-scroll t))
((eq ch ?<) (whitespace-help-scroll))
(t (ding))))
(whitespace-help-off)
(message " ")) ; clean echo area
;; handler
((quit error)
(whitespace-help-off)
(error (error-message-string data)))))
(list sym))) ; return the appropriate symbol