elisp

define a new function for keyboard-quit and highlight clearup

巧了我就是萌 提交于 2020-01-05 10:18:10
问题 I am pretty new to elisp, and i was trying to define a function to set highlight behavior while searching. The goal is: after i-search , I want to be able to clear the highlight with C-g , but I want the highlight to remain if I press enter. So i defined a function in my init.el as: (defun keyboard-quit-cleanup () "clean up highligh after keyboard quit" (keyboard-quit) (lazy-highlight-cleanup)) (global-set-key (kbd "C-g") '(keyboard-quit-cleanup)) how-ever, it doesn't work. What's wrong here?

Strange behavior in occur-mode hook in Emacs

瘦欲@ 提交于 2020-01-04 05:17:16
问题 I am trying to resize the occur-mode buffer window to fit the contents of its buffer. See Resize occur window in Emacs for more information. I have added the following hook: (add-hook 'occur-mode-hook (lambda () (save-selected-window (pop-to-buffer "*Occur*") (message-box "ok") (fit-window-to-buffer nil 10)))) Then I have the following buffer window: and I now execute (occur "test") which gives me first and after pressing the "ok" button I get Notice that the occur window has shrunk to a

How to make Emacs sql-mode recognize MySQL #-style comments?

元气小坏坏 提交于 2020-01-04 04:35:07
问题 I'm reading a bunch of MySQL files that use # (to end-of-line) comments, but my sql-mode doesn't support them. I found the syntax-table part of sql.el that defines /**/ and -- comments, but according to this, Emacs syntax tables support only 2 comment styles. Is there a way to add support for # comments in sql.el easily? 回答1: Emacs-24 sql.el has this built-in! Simply run M-x sql-set-product MySQL RET and the syntax table is set up automatically, as are the font-lock-keywords for all the

How do I fix a “Wrong Type Argument: listp,” error when trying to access remote file using tramp?

醉酒当歌 提交于 2020-01-04 03:02:00
问题 I am unable to access remote files in my usual way: C-x C-f [server]:[path][file] and am thrown this error: Wrong Type Argument: listp, [[server]:[path][file] I'm not even sure how to debug this further. any help is appreciated. edit: output when trying to debug: Debugger entered: nil (progn (debug) (ido-mode t) (progn (ad-add-advice (quote completing-read) (quote (foo nil t (advice lambda nil (if (boundp ...) ad-do-it (setq ad-return-value ...))))) (quote around) (quote nil)) (ad-activate

How do I fix a “Wrong Type Argument: listp,” error when trying to access remote file using tramp?

穿精又带淫゛_ 提交于 2020-01-04 03:01:14
问题 I am unable to access remote files in my usual way: C-x C-f [server]:[path][file] and am thrown this error: Wrong Type Argument: listp, [[server]:[path][file] I'm not even sure how to debug this further. any help is appreciated. edit: output when trying to debug: Debugger entered: nil (progn (debug) (ido-mode t) (progn (ad-add-advice (quote completing-read) (quote (foo nil t (advice lambda nil (if (boundp ...) ad-do-it (setq ad-return-value ...))))) (quote around) (quote nil)) (ad-activate

Boolean values: t vs. nil vs 1 vs -1

最后都变了- 提交于 2020-01-03 17:47:49
问题 In Elisp, I've encountered different APIs for modeling boolean values. I was under the impression that t and nil were the idiomatic ways of representing true and false respectively. However, I've also seen 1 and -1 used to model the same thing. What confuses me is that I have come across APIs that won't work if nil is supplied but will work if -1 is used. Can someone help me understand which is in fact the preferred way. And if the answer is t and nil , I welcome any theories on why some

Emacs: define target window for command output

蹲街弑〆低调 提交于 2020-01-03 10:46:25
问题 I'm tired of emacs clobbering my windows with its output, and unpredictably at that. I'd like to have several windows in emacs frame and have each window dedicated for a certain purpose only. For example, ECB panels | Editor 1 | Editor 2 | Bookmarks+ ------------------------------------------------ "Messages" (output buffer) So, when I run M-x compile , I want the output to always go into Messages. Similarily, when I run M-x magit-status , I want results in Messages, as well. Clicking on a

Default regular expression for etags

房东的猫 提交于 2020-01-02 13:32:54
问题 I'd like to create additional regular expressions for use with etags, but I'd like them to be based upon what's already there (in particular, I'd like to add [ \t]* to the current set of regular expressions that etags uses). What are the default set of regular expressions that etags uses for .lisp files? 回答1: etags doesn't generally use regular expressions to implement the languages that are built-in. Instead, it has custom parser code for each built-in language. That said, it seems for Lisp

Default regular expression for etags

一个人想着一个人 提交于 2020-01-02 13:31:16
问题 I'd like to create additional regular expressions for use with etags, but I'd like them to be based upon what's already there (in particular, I'd like to add [ \t]* to the current set of regular expressions that etags uses). What are the default set of regular expressions that etags uses for .lisp files? 回答1: etags doesn't generally use regular expressions to implement the languages that are built-in. Instead, it has custom parser code for each built-in language. That said, it seems for Lisp

Set Emacs to smart auto-line after a parentheses pair?

依然范特西╮ 提交于 2020-01-02 05:00:47
问题 I have electric-pair-mode on (which isn't really particularly relevant, as this could apply to any auto-pairing mode or even manual parens), but in a nutshell, I'd like it so that in the case I have: function foo() {|} (where | is the mark) If I press enter, I would like to have it automatically go to function foo() { | } It would also mean that function foo(|) {} would become function foo( | ){} I already have things to take care of the indentation, but I'm not sure how to say "if I'm inside