8
edit: With Emacs 26.1 or later, it's a (setq display-raw-bytes-as-hex t) away.
No, you can't. The display of unprintables above the printable ASCII range is hardcoded in xdisp.c:
if (CHAR_BYTE8_P (c))
/* Display \200 instead of \17777600. */
c = CHAR_TO_BYTE8 (c);
len = sprintf (str, "%03o", c + 0u);
I sent a patch fixing this to debbugs.
6
I figured it out thanks to the answer by Gilles and the 2010/2011 thread on gnu.emacs.help called “How switch from escaped octal character code to escaped HEX?” (Google Groups, Nabble).
The details of how Emacs displays characters are in the section Display > Text Display (“How Text Is Displayed”) of the Emacs manual (C-h r), and section Display > Character ...
4
You can do it with display tables. This may be a little clumsy and I haven't investigated how this might interfere with packages that use display tables for their own purposes, but the basic use case works.
(require 'cl-lib)
(setq standard-display-table (make-display-table))
(cl-loop
for x from 128 to 255
do (aset standard-display-table x
(cl-map '...
answered May 29 '17 at 1:07
Gilles 'SO- stop being evil'
17.3k44 gold badges4444 silver badges8080 bronze badges
4
You should be able to press C-q to run quoted-insert to insert any key chord you want. So pressing C-q C-] will insert ^] into the buffer instead of running the command bound to C-]
2
M is given the ESC keycode by default. See meta-prefix-char.
In general, don't bind ESC--surprising things will happen.
2
It's not a prefix key because it is not bound to a keymap. See (elisp) Prefix Keys.
Try this:
(define-prefix-command 'foo)
(global-set-key (kbd "M-ESC") 'foo)
(global-set-key (kbd "M-ESC M-ESC") 'forward-char)
2
Instead of:
(message (format "test %s" dc-str-addresses))
You want:
(message "test %s" dc-str-addresses)
message accepts the same arguments as format:
(message FORMAT-STRING &rest ARGS)
The first argument is a format control string, and the rest are data
to be formatted under control of the string. See `format' for details.
Note: Use (...
2
This binding is in the global keymap. Generally key bindings that work in most or all buffers are in the global keymap. If in doubt, see How can I find out in which keymap a key is bound? to check.
So you can simply call
(global-set-key (kbd "<ESC> <ESC>") 'keyboard-escape-quit)
This overrides the previous binding of ESC ESC as a prefix. Note ...
answered Nov 3 '17 at 9:48
Gilles 'SO- stop being evil'
17.3k44 gold badges4444 silver badges8080 bronze badges
1
I found a workaround, inspired by the comment by Håkon Hægland in Leave evil insert mode with control key
First make a keycode for VoidSymbol with xmodmap (xcape can only work on keysyms that have assigned keycodes), then let xcape map Control_L to that instead of Escape:
xmodmap -e 'keycode 255 = VoidSymbol'
xcape -t 175 -e 'Control_L=VoidSymbol'
Then ...
1
You say: "But in the global-map there is no entry for M-x, there are only entries for execute and menu."
That's not true. If you are just using C-h v global-map then it's difficult to tell, unless you're good at reading the Lisp representation of a keymap.
Instead, load library help-fns+.el (Help+) and use C-h M-k global-map, to see a human-...
1
You could simply say:
(replace-regexp-in-string "\\\\\\(.\\|\n\\)" "\\1" STRING)
Or equivalently:
(replace-regexp-in-string (rx "\\" (group anything)) "\\1" STRING)
1
I was able to do this with (ansi-color-apply-on-region (point-min) (point-max)):
However, my file is really big and that command is really slow.
That function uses overlays by default, which will quickly become very slow when you have many of them. Try
(let ((ansi-color-apply-face-function
(lambda (beg end face)
(when face
(...
1
If you set up your shell buffer to convert the escape codes to color automatically, it works much faster. I have the following config:
(add-to-list 'comint-output-filter-functions 'ansi-color-process-output)
(ansi-color-for-comint-mode-on)
With this set, when I run a shell in emacs (i.e., M-x shell), the output is colored automatically each time it is ...
1
The fix is simple, run applications emitting escape codes intended for terminal emulators in a terminal emulator, like M-x term. You might still run into yet to be supported escape codes, but those can be implemented by looking them up on http://invisible-island.net/xterm/ctlseqs/ctlseqs.html and adding the corresponding sequence to term-handle-ansi-escape.
1
Emacs' hexl mode should do what you want - it's a major mode which provides support for viewing and editing binary files. Use M-x hexl-find-file instead of C-x C-f to visit the file to get started. More details can be found in the Emacs info manual, or at https://www.gnu.org/software/emacs/manual/html_node/emacs/Editing-Binary-Files.html.
1
To the best of my knowledge, you cannot search for special characters like [ in mu/mu4e/Xapian (the underlying database mu-find queries). The best I know of is to use the subject (s) flag, with a query that starts like so:s:spam (mu searches are always case-insensitive).
This is, admittedly, a little less precise than you might like, but is a side-effect ...
1
Characters represented with ^ followed by another character (an uppercase letter or one of @[\]^_?), with both characters in a different color (depending on the color scheme), are control characters. ^[ is the escape character. You can get more information by pressing C-x = (what-cursor-position) while the cursor is on the character and even more information ...
answered Jun 27 '16 at 22:52
Gilles 'SO- stop being evil'
17.3k44 gold badges4444 silver badges8080 bronze badges
1
^[ is the ASCII escape character, aka ESC. It is:
octal: \033
hexadecimal: \x1B or ^[
decimal: 27
The color codes (and other control codes) you mention each begin with the ASCII escape character.
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
escape × 21key-bindings × 10
prefix-keys × 3
shell × 2
display × 2
characters × 2
org-mode × 1
evil × 1
debugging × 1
regular-expressions × 1
osx × 1
search × 1
font-lock × 1
major-mode × 1
company-mode × 1
keymap × 1
terminal-emacs × 1
mu4e × 1
replace × 1
highlighting × 1
window-splitting × 1
string × 1
formatting × 1
pdf-tools × 1
terminal × 1