elisp

Emacs Lisp: difference between (function (lambda …)) and (lambda …)?

余生颓废 提交于 2019-11-30 09:34:52
What is the difference between (function (lambda ...)) and (lambda ...) and '(lambda ...) ? It seems three are interchangeable in a lot of cases. They are pretty interchangeable. The answer is that function enables the lambda to be byte compiled, whereas the other two do not (and are equivalent). Note: this does not mean that function actually byte compile the lambda. How might one figure that out? A little Emacs lisp introspection provides some clues. To start: C-h f function RET : function is a special form in 'C source code'. (function arg) Like 'quote', but preferred for objects which are

How to get auto indent (not smart indent) in emacs in all modes

◇◆丶佛笑我妖孽 提交于 2019-11-30 09:22:42
I'm new to emacs, and its indenting is driving me up the walls. It's too smart for its own good; it (incorrectly) thinks it knows how I want to format my source, but I don't have time to chase down every setting for every mode for every different language that I write code for; and many of those languages don't have any mode enabled at all. Here's the behaviour I'd like: TAB inserts indent RET inserts a new line then copies the blank characters from the start of the previous line to the first non-blank character, or end of line, whichever comes sooner DEL (backspace key) in the blank text

Relationship between Emacs functions and commands

十年热恋 提交于 2019-11-30 08:45:51
From what I understand, in Emacs I can run commands such as M-x (which by the way I believe stands for execute-extended-command ). This command M-x itself is used to run things like customize_face e.g. by typing M-x customize-face in the minibuffer. My questions are: Q.1. Is customize-face a command ? or is it a function ? And do we say that customize-face is passed to the command M-x as an argument ? Q.2 Do all Emacs commands have an associated Emacs function ? (i.e. when I enter M-x customize-face I presume a defined function is called). If so, how can I look up the function name from the

Emacs: why shell-command “git log” works, but “git shortlog” doesn't?

女生的网名这么多〃 提交于 2019-11-30 08:24:06
问题 I can't figure this out. Why do these behave differently: (shell-command "git log") (shell-command "git shortlog") First one works as expected: returns 0 and prints stuff to shell output buffer. Second one returns 0 but prints nothing. Why is that? Also both git log and git shortlog work perfectly in ansi-term both git log and git shortlog give a warning but still work in shell 回答1: man git-shortlog If no revisions are passed on the command line and either standard input is not a terminal or

CGI Programming in Elisp?

我怕爱的太早我们不能终老 提交于 2019-11-30 07:31:59
Has anyone written any libraries for elisp to do CGI programming? I threw together a quick first script. However, I'm only a long-time emacs user and I've never really programmed it. When I saw that I could write scripts (--script) in emacs instead of bash, I thought that I would give it a shot. #!/usr/bin/emacs --script (princ "Content-type: text/html; charset=utf-8\n\n") (progn (princ "<html>\n") (princ "<body>\n") (princ "<h1 style='text-align: center'>Elisp CGI Programming</h1>")) (progn (princ "<table style='border:1px solid'>") (princ "<tr><th>One</th><th>Two</th></tr>") (princ "<tr><th

In elisp, how do I put a function in a variable?

扶醉桌前 提交于 2019-11-30 07:24:36
问题 I want to allow the user to choose their own command in the "customize" emacs backend (and generally be able to store an executable form name in a variable) but this does not work : (defun dumb-f () (message "I'm a function")) (defvar my-function "dumb-f") (my-function) ==> Debugger entered--Lisp error: (invalid-function "dumb-f") (setq my-function 'dumb-f) (my-function) ==> Debugger entered--Lisp error: (invalid-function "dumb-f") I tried various forms, but still no luck, and I'm having a

In Lisp (Clojure, Emacs Lisp), what is the difference between list and quote?

喜夏-厌秋 提交于 2019-11-30 06:14:38
From reading introductory material on Lisp, I now consider the following to be identical: (list 1 2 3) '(1 2 3) However, judging from problems I face when using the quoted form in both Clojure and Emacs Lisp, they are not the same. Can you tell me what the difference is? The primary difference is that quote prevents evaluation of the elements, whereas list does not: user=> '(1 2 (+ 1 2)) (1 2 (+ 1 2)) user=> (list 1 2 (+ 1 2)) (1 2 3) For this reason (among others), it is idiomatic clojure to use a vector when describing a literal collection: user=> [1 2 (+ 1 2)] [1 2 3] Trey Jackson Quoted

Emacs — calculating new window-start/end without redisplay

谁说胖子不能爱 提交于 2019-11-30 05:30:13
问题 Is it possible to calculate a new window-start/end without a redisplay occurring? If so, then an example would be greatly appreciated. If not, then what is the best way to approximate it? Example : We want to move to a new area of the buffer somewhere off screen, and place overlays when we get there. We might be using page-down or scroll-down or paragraph-down or end-of-buffer. When we get to that new point, we want to calculate the new window-start and the new window-end . However, we want

Help writing emacs lisp for emacs etags search

浪子不回头ぞ 提交于 2019-11-30 05:09:53
问题 I'm looking for some help developing what I think should be an easy program. I want something similar to Emacs tags-search command, but I want to collect all search results into a buffer. (I want to see all results of M-,) I'm thinking this python style pseudo code should work, but I have no idea how to do this in emacs lisp? Any help would be greatly appreciated. def myTagsGrep(searchValue): for aFile in the tag list: result = grep aFile seachValue if len(result) > 0: print aFile # to the

Emacs: same buffer, two windows, one narrowed, one not

倾然丶 夕夏残阳落幕 提交于 2019-11-30 04:43:55
I find the narrow-to-region command useful, however it applies to the buffer and not to the current window. I'd like to have one window display a narrowed version of the buffer, while the buffer is displayed widened if it occurs in any other window. Is this possible? Try M-x clone-indirect-buffer or C-x 4 c . For details, see Indirect Buffers . 来源: https://stackoverflow.com/questions/2387287/emacs-same-buffer-two-windows-one-narrowed-one-not