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

与世无争的帅哥 提交于 2019-12-11 08:28:42

问题


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 hex and octal on the first C-x C-e?


回答1:


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


来源:https://stackoverflow.com/questions/3112893/how-to-get-c-x-c-e-to-display-the-result-in-octal-and-hexadecimal-by-default

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!