elisp

How can I apply a new Emacs C style to reformat all my source files?

半腔热情 提交于 2019-11-29 14:23:24
问题 I'd like to re-format all my source files using the Google formatting function for emacs: google-c-style.el (see here). How can I apply this function to all my source files at once, so that they are all formatted and indented correctly according to the Google style? 回答1: There are several pieces to this: you need to come up with EMACS functions to do all the reformatting you want. indent-region is a start, but you might also want to untabify or some other things. you need to invoke them on

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

天大地大妈咪最大 提交于 2019-11-29 14:05:45
问题 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

Why are fixnums in Emacs only 29 bits?

谁说胖子不能爱 提交于 2019-11-29 13:57:17
And why don't they change it? Edit: The reason ask is because I'm new to emacs and I would like to use Emacs as a "programmer calculator". So, I can manipulate 32-bit & 64-bit integers and have them behave as they would on the native machine. Emacs-Lisp is a dynamically-typed language. This means that you need type tags at runtime. If you wanted to work with numbers, you would therefore normally have to pack them into some kind of tagged container that you can point to (i.e. “box” them), as there is no way of distinguishing a pointer from a machine integer at runtime without some kind of

Can I limit the length of the compilation buffer in Emacs?

给你一囗甜甜゛ 提交于 2019-11-29 13:52:28
Is it possible to limit the number of lines that the Emacs compilation buffer stores? Our build system can produce some 10,000 lines of output on whole product builds, if no errors are encountered. Since my compilation buffer also parses ANSI colors, this can get very, very slow. I would like to have only e.g. 2,000 lines of output buffered. It appears that comint-truncate-buffer works just as well for compilation buffers as it does for shell buffers: (add-hook 'compilation-filter-hook 'comint-truncate-buffer) (setq comint-buffer-maximum-size 2000) I tested this by running compile with the

Emacs: if latexmk finishes okay, then show pdf, else display errors

走远了吗. 提交于 2019-11-29 12:49:14
Could anyone please give me hand with the step between the first start-process and the second start-process . The second start-process that displays the pdf-file should run only if the first start-process finishes without errors . There is probably some type of successful exit code that can be spotted, but I would need some help please in that regard. I'm open to suggestions regarding how best to determine whether the first start-process finished without errors. One method would be to look at the output buffer to determine whether the last line is equal to "Process process finished". Making

How do I fix the cursor to the middle of the screen in Emacs, so that the page moves, not the cursor?

前提是你 提交于 2019-11-29 12:05:13
问题 I'd like to fix the cursor to the centre line of the screen, so that when I press Ctrl-N or Ctrl-P, the page itself moves up or down, and the cursor stays still. Has anyone got any tips on how to achieve this? Thanks Ed 回答1: Try centered-cursor mode: http://www.emacswiki.org/emacs/centered-cursor-mode.el If you're using MELPA, it's available by M-x package-install RET centered-cursor-mode . 回答2: M-x scroll-lock-mode , which could be used to put the Scroll Lock key to good use too: (global-set

How do I apply “or” to a list in elisp

若如初见. 提交于 2019-11-29 11:42:29
问题 In elisp I can evaluate or as a function just like +. (or nil 0 nil) ==> 0 (+ 1 0 1) ==> 2 I can use apply to apply + to a list (apply '+ '(1 0 1)) ==> 2 So, I would think or would work the same way, but it doesn't. (apply 'or '(nil 0 nil)) ==> error: (invalid-function or) I imagine this comes from some internal magic used to implement the short-circuit evaluation. How can I use apply to execute the or operation over a list? P.S. my desired application is to find out whether any elements on

How do you ensure an association list maintains unique keys in Emacs

喜你入骨 提交于 2019-11-29 11:07:06
Given the frequency that keys are added to association lists like auto-mode-alist , I presume there is some idiomatic method for maintaining association lists with unique keys, but have yet to encounter it. Let's say I execute the following: (setq alist '()) (add-to-list 'alist '(a . 1)) (add-to-list 'alist '(a . 2)) (add-to-list 'alist '(b . 3)) After running that, alist contains ((b . 3) (a . 2) (a . 1)) . I see that add-to-list can take an optional compare-fn , so I presume there is some method I could pass to get ((b . 3) (a . 1)) as the result. I'm also aware I could use hash tables for

Emacs — How to push a Git repository to multiple remotes

守給你的承諾、 提交于 2019-11-29 10:38:46
I'm looking for some assistance, please, using Emacs / Magit to push the local repository changes to the remote website and to Github in one fell-swoop. I found a non-Emacs / non-Magit related thread ( https://stackoverflow.com/a/3195446/2112489 ) , with comments stating that it is the definitive answer on pushing to a remote and to Github, and it has a few hundred thumbs-up. I assume (perhaps incorrectly) that is a good starting point for the local .gitconfig file in the $HOME directory on my computer. [remote "GitHub"] url = git@github.com:elliottcable/Paws.o.git fetch = +refs/heads/*:refs

CGI Programming in Elisp?

戏子无情 提交于 2019-11-29 09:53:48
问题 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