elisp

Mapping a function over two lists in elisp

我与影子孤独终老i 提交于 2019-12-21 03:38:12
问题 In common lisp I can do this: (mapcar #'cons '(1 2 3) '(a b c)) => ((1 . A) (2 . B) (3 . C)) How do I do the same thing in elisp? When I try, I get an error: (wrong-number-of-arguments mapcar 3) If elisp's mapcar can only work on one list at a time, what is the idomatic way to combine two lists into an alist? 回答1: You want mapcar* , which accepts one or more sequences (not just lists as in Common Lisp), and for one sequence argument works just like the regular mapcar . (mapcar* #'cons '(1 2 3

Emacs auto-minor-mode based on extension

荒凉一梦 提交于 2019-12-21 03:29:12
问题 I found this question somewhat on the topic, but is there a way [in emacs] to set a minor mode (or a list thereof) based on extension ? For example, it's pretty easy to find out that major modes can be manipulated like so (add-to-list 'auto-mode-alist '("\\.notes\\'" . text-mode)) and what I'd ideally like to be able to do is (add-to-list 'auto-minor-mode-alist '("\\.notes\\'" . auto-fill-mode)) The accept answer of the linked question mentions hooks, specifically temp-buffer-setup-hook. To

Refactoring R code using ESS/R

社会主义新天地 提交于 2019-12-21 02:28:33
问题 I would like to know if it is possible to refactor R code in ESS. Using search and replace in Emacs does not seem to be a good alternative to it. 回答1: ESS itself does not provide any facilities for refactoring. Instead you can use emacs functionality. Here is an example of how to replace all words starting with "xxx" and ending with "yyy" with "zzzzzz" in all your open R files in your project directory. C-x d (enter dired) % m r$ (mark all files ending in R or r) Q (enter dired-to-query

Refactoring R code using ESS/R

强颜欢笑 提交于 2019-12-21 02:28:10
问题 I would like to know if it is possible to refactor R code in ESS. Using search and replace in Emacs does not seem to be a good alternative to it. 回答1: ESS itself does not provide any facilities for refactoring. Instead you can use emacs functionality. Here is an example of how to replace all words starting with "xxx" and ending with "yyy" with "zzzzzz" in all your open R files in your project directory. C-x d (enter dired) % m r$ (mark all files ending in R or r) Q (enter dired-to-query

In Emacs, how do I change the minibuffer completion list window?

≡放荡痞女 提交于 2019-12-20 23:26:40
问题 I would like to set a specific window for the minibuffer completion list. Currently, I have 3 windows in this configuration: ______ | | | |____| | |____|_| In this case, I'd like to use the bottom left window for the minibuffer completion list. Currently, it seems to a window at random, and most of the time it likes to use the far right window, which is too thin to show the completion list without me having to scroll horizontally, which is irritating. Also, I'm using a lisp script called

How do I use Emacs's DBUS interface?

心不动则不痛 提交于 2019-12-20 18:33:48
问题 I looked up the dbus package and it seems like all of the functions are built-in to the C source code and there's no documentation for them. How do I use the dbus-call-method function? 回答1: Google to the rescue... Follow the link for the example, it's not my code so I won't put it here. http://emacs-fu.blogspot.com/2009/01/using-d-bus-example.html 回答2: I just had the same problem and found the emacs-fu article that comes up when googling a little too basic for my needs. In particular I wanted

Setup a personal wiki in Emacs Org-mode

孤者浪人 提交于 2019-12-20 12:21:29
问题 I would like to setup a personal wiki in org-mode. So far, I have tried this two ways. My first attempt was using a single "Scientific Notebook.org" file. In this went all my notes - each with its own headline, date and tags (same format as a blog post). I then turned on org-velocity to quickly navigate the file. But this created two problems: first, I use a lot of math in my notes (LaTeX previews are one of the reasons I want to us org). But these take sooooo long to load, I can't images

Setup a personal wiki in Emacs Org-mode

杀马特。学长 韩版系。学妹 提交于 2019-12-20 12:20:23
问题 I would like to setup a personal wiki in org-mode. So far, I have tried this two ways. My first attempt was using a single "Scientific Notebook.org" file. In this went all my notes - each with its own headline, date and tags (same format as a blog post). I then turned on org-velocity to quickly navigate the file. But this created two problems: first, I use a lot of math in my notes (LaTeX previews are one of the reasons I want to us org). But these take sooooo long to load, I can't images

Grab current line in buffer as a string in elisp

孤街浪徒 提交于 2019-12-20 11:28:10
问题 How can i collect the buffer's current line as a string value in elisp? i can do this, (let (p1 p2 myLine) (setq p1 (line-beginning-position) ) (setq p2 (line-end-position) ) (setq myLine (buffer-substring-no-properties p1 p2)) ) but is there anyway i can do it in one line as, (with-current-buffer get-current-line) 回答1: Use thing-at-point: (thing-at-point 'line t) but note that this also returns any newline at the end of the line. 来源: https://stackoverflow.com/questions/27995488/grab-current

Is it possible to tell emacs on Windows to use the IE http proxy settings?

◇◆丶佛笑我妖孽 提交于 2019-12-20 10:55:58
问题 See also: Emacs behind HTTP proxy Is it possible to tell emacs to automatically use whatever proxy settings are in use by IE? The url.el package says I can explicitly specify a proxy like this: (setq url-using-proxy t) (setq url-proxy-services '(("http" . "proxyserver:3128"))) Is it possible for this to happen sort of auto-magically, when I change the IE proxy settings? 回答1: Yes, it's possible. The basic idea is to define before-advice for the URL functions, and set those variables to