Hot answers tagged

7

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.


5

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


3

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 '...


3

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


2

Elisp displays strings in a readable format, where characters have to be escaped, and in this case it displays \ as \\, because it has to be escaped. Try inserting the return value like this to see that it's doing what you want it to: (insert (replace-regexp-in-string "'" "\\'" "a'b'c" nil t))


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

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

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


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