major-mode

Can't turn on plantuml-mode in Emacs

旧巷老猫 提交于 2021-02-05 20:34:17
问题 I am on Emacs 24.3.1. I installed the MELPA version of plantuml-mode via M-x package-install RET plantuml-mode RET . When I try to turn on plantuml-mode for a buffer, I get the following error: Wrong type argument: stringp, nil Trying to find additional installation instructions I looked at the "Commentary" section in the plantuml-mode.el source, but there it only says to require the package, and I am doing that. How can I fix this problem? 回答1: After a bit more digging I found the solution

A 'hello world' example for a major mode in Emacs?

独自空忆成欢 提交于 2019-12-29 04:19:19
问题 Can anyone provide me with a hello world example for a major mode in emacs? I guess it's a beginner question, still I really like to write a major mode, both to learn emacs and elisp, as to be able to use customization to the fullest. What I have done so far (and is working) : wrote a file sample-mode.el and put it in a lisp dir called in .emacs (require 'sample-mode) wrote some defuns in it, and provided it at the end (provide 'sample-mode) But still it doesn't seem to be activated , I

How to turn off electric-indent-mode for specific Major mode?

青春壹個敷衍的年華 提交于 2019-12-12 10:32:33
问题 I have few Major modes (like: Yaml and NXML) that I don't want electric-indent-mode (I want it for C like languages) but I'm unable to turn if off. To enable I have: (electric-indent-mode 1) from documentation (for variable electric-indent-mode) Non-nil if Electric-Indent mode is enabled. See the command electric-indent-mode' for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node Easy Customization') or call the

Highlighting correctly in an emacs major mode

微笑、不失礼 提交于 2019-12-04 20:01:35
问题 I am developing an emacs major mode for a language (aka mydsl ). However, using the techniques on xahlee's site doesn't seem to be working for some reason (possibly older emacs dialect..) The key issues I am fighting with are (1) highlighting comments is not working and (2), the use of regexp-opt lines is not working. I've reviewed the GNU manual and looked over cc-mode and elisp mode... those are significantly more complicated than I need. ;;;Standard # to newline comment ;;;Eventually

Emacs name of current local keymap?

余生颓废 提交于 2019-11-30 13:53:18
I am writing an elisp function that permanently binds a given key to a given command in the current major mode's keymap. For example, (define-key python-mode-map [C-f1] 'python-describe-symbol) The command and the key sequence are gathered interactively from the user. However, I am having trouble producing the name of the KEYMAP (e.g. 'python-mode-map') that corresponds to the current major mode. I have tried the function (current-local-map), but this function returns the keymap object itself, rather than its name. I understand that many major mode keymaps are named according to the convention

Emacs name of current local keymap?

梦想的初衷 提交于 2019-11-29 20:59:58
问题 I am writing an elisp function that permanently binds a given key to a given command in the current major mode's keymap. For example, (define-key python-mode-map [C-f1] 'python-describe-symbol) The command and the key sequence are gathered interactively from the user. However, I am having trouble producing the name of the KEYMAP (e.g. 'python-mode-map') that corresponds to the current major mode. I have tried the function (current-local-map), but this function returns the keymap object itself

emacs lisp, how to get buffer major mode?

久未见 提交于 2019-11-28 04:04:39
I have tried to search Google and look in the manual, but still cannot find how to get major mode of a buffer object. Can you help me with an example or a reference. Thanks only solution I could find was to query major-mode after changing the buffer and then changing back to original buffer. Is there a better way to do it? Aidan Cully Is there a problem with that? (defun buffer-mode (buffer-or-string) "Returns the major mode associated with a buffer." (with-current-buffer buffer-or-string major-mode)) with-current-buffer will restore your buffer when it returns. For current buffer: (message "

emacs lisp, how to get buffer major mode?

拥有回忆 提交于 2019-11-27 05:18:07
问题 I have tried to search Google and look in the manual, but still cannot find how to get major mode of a buffer object. Can you help me with an example or a reference. Thanks only solution I could find was to query major-mode after changing the buffer and then changing back to original buffer. Is there a better way to do it? 回答1: Is there a problem with that? (defun buffer-mode (buffer-or-string) "Returns the major mode associated with a buffer." (with-current-buffer buffer-or-string major-mode

Emacs: How to use a major mode for non-standard file extension

心已入冬 提交于 2019-11-26 18:35:55
问题 I'd like to use R major mode for another file extension in emacs (for an unsupported language with syntax similar to R). How do I force emacs to change the major mode for a buffer I'm editing? How do I change my .emacs to permanently associate a major mode with a particular file extension? 回答1: This should work: (add-to-list 'auto-mode-alist '("\\.rr" . R-mode)) 来源: https://stackoverflow.com/questions/21661413/emacs-how-to-use-a-major-mode-for-non-standard-file-extension