开发者

How to get C-x C-e to display the result in octal and hexadecimal by default?

开发者 https://www.devze.com 2023-01-04 20:41 出处:网络
When I hit C-x C-e on a numeric expression a second time, the mini-buffer displays the result in octal and hexadecimal.This is documented here

When I hit C-x C-e on a numeric expression a second time, the mini-buffer displays the result in octal and hexadecimal. This is documented here

Is there a way to get the result in开发者_JS百科 hex and octal on the first C-x C-e?


You can get that behavior with this advice. Note, I made it also work for eval-print-last-sexp (aka C-j). Just remove that from the list if you don't want that behavior.

(defadvice eval-expression-print-format (around eepf-tweak-output activate)
  "tweak output when this-command is eval-last-sexp or eval-print-last-sexp"
  (let ((last-command (if (memq this-command '(eval-last-sexp eval-print-last-sexp))
                          this-command
                        last-command)))
    ad-do-it))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号