elisp

Emacs CEDET Semantic tag folding

為{幸葍}努か 提交于 2019-12-12 11:33:26
问题 I would like that every time I open a .cpp file, semantic tag-folding would become activated. I am using the latest version of cedet (loading cedet-devel-load.el). I have (semantic-mode 1) (require 'semantic/ia) (require 'semantic/bovine/gcc) (load-file "path/to/semantic/tag/folding/semantic-tag-folding.el") (require 'semantic-tag-folding) I added a hook (add-hook 'c-mode-common-hook 'setupcpp) and in 'setupcpp I simply have (defun setupcpp () (interactive) (semantic-tag-folding-mode t))

Emacs comment-region in C mode

China☆狼群 提交于 2019-12-12 10:36:10
问题 In GNU Emacs, is there a good way to change the comment-region command in C mode from /* This is a comment which extends */ /* over more than one line in C. */ to /* This is a comment which extends over more than one line in C. */ ? I have tried (setq comment-multi-line t) but this does not help. There is a section on multi-line comments in the Emacs manual, but it does not mention anything. 回答1: Since Emacs 21, there's been a module named 'newcomment, which has different comment styles (see

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

Sync two windows of emacs together

末鹿安然 提交于 2019-12-12 09:13:24
问题 I have a snippet of code in my dotemacs file that would sync two opened buffers side by side (Thanks to Tobias), scrolling in the master buffer will result in moving the slave buffer accordingly matching the same "line" the cursor is at. I have been trying to modify the code and have one buffer act as master when it has the focus and the other act as a slave following lead. Basically, I want then both to sync up no matter which buffer is scrolling. Unfortunately, Applying (Xsync-window) on

Custom shells started automatically from .emacs

点点圈 提交于 2019-12-12 08:59:35
问题 I would like to start a few shells, and set their directories from my .emacs. Opening them is easy: ;; run a few shells. (shell "*shell5*") (shell "*shell6*") (shell "*shell7*") But I would like to specify their directory, too. 回答1: The following works for me (let ((default-directory "/path/to/whereever/")) (shell "*shell1*")) 回答2: (shell "*shell5*") (with-current-buffer "*shell5*" (goto-char (point-max)) (insert "cd dir")) ;;for example (comint-send-input nil t) ;; enter For now I have this,

elisp: capturing variable from inner function

你离开我真会死。 提交于 2019-12-12 08:51:41
问题 My lovely function: (defun f (x) (lambda (y) (+ x y))) Then, I expect this: (funcall (f 2) 2) To return 4. But alas, I got this instead: Debugger entered--Lisp error: (void-variable x) So how can I capture variable from inner function? 回答1: You've been bitten by elisp's dynamic scoping. The x in the lambda refers to the variable x that is in scope when the lambda is called (and since in this case there is no x in scope when you call it, you get an error), not to the x which is in scope when

Do I need to know Emacs Lisp in order to use GNU/Emacs

梦想的初衷 提交于 2019-12-12 08:49:31
问题 Recently, I began studying GNU/Emacs. Was very easy to use program. Studied its structure. Tuned nice color for me. Configure it to class on C programming. Everything seemed normal. But now the question arose of GNU/Emacs lisp. Should I really spend time to study Emacs Lisp if I did not develop itself Emacs and will only use it like ide for C/C++ development, mail, jabber and etc... The fact is that when I edit my .emacs I understand that I write. But I write mostly ready-made scripts or if

How to add a comment style to an emacs mode

倖福魔咒の 提交于 2019-12-12 04:19:58
问题 I am looking to add an additional single line style of comments !* to the Fortran mode on emacs, I'd add this to my init.el file. From what I can see this should be doable using the modify-syntax-entry command, but I am struggling to succeed and there doesn't seem to be a fortran-mode-syntax-table so I can't see how I'd hook it to the mode. My current effort (which causes an error). (modify-syntax-entry ?\!\* "< \n") (modify-syntax-entry ?\n "< \!\*") The error reads An error occurred while

Emacs Elisp Overriding Default Value

一笑奈何 提交于 2019-12-12 03:57:09
问题 I have several abbrev defined that I was accessible everywhere except in latex mode. I defined (setq-default abbrev-mode t) (add-hook 'latex-mode-hook (lambda () (abbrev-mode -1))) But whenever I open a latex file it still has abbrev mode enabled. What's going on? 回答1: Never worked with latex before, but for me the following works fine: (setq auto-mode-alist (cons '("\\.lat\\'" . latex-mode) auto-mode-alist)) (setq-default abbrev-mode t) (add-hook 'latex-mode-hook (lambda () (abbrev-mode -1))

Override (globally override key binding in emacs) temporarily

北慕城南 提交于 2019-12-12 03:18:38
问题 I use the method stated here : globally-override-key-binding-in-emacs (defvar my-keys-minor-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-i") 'some-function) map) "my-keys-minor-mode keymap.") (define-minor-mode my-keys-minor-mode "A minor mode so that my key settings override annoying major modes." ;; Define-minor-mode will use `my-keys-minor-mode-map' for us. :init-value t :lighter " my-keys") (defun my-keys-keep-on-top (&rest _) "Try to ensure that my keybindings