elisp

Force emacs recent files using recentf to ignore specified files (.windows and .revive for example)

走远了吗. 提交于 2019-12-04 01:22:13
I have always been bugged by the fact that when exiting with revive.el and windows.el enabled it opens a file and writes to it called .revive and .windows. These are saved so it goes in the recent files list. Is there anyway to make it ignore these files or any other files I desire. Victor Deryagin A way to make recentf ignore some files is to add appropriate regexps to recentf-exclude list: (add-to-list 'recentf-exclude "\\.windows\\'") (add-to-list 'recentf-exclude "\\.revive\\'") This will prevent any future entries of the above from being added to the recentf list. You need to delete the

in elisp's let, how do you reference a variable bound in the same let while binding another variable?

怎甘沉沦 提交于 2019-12-04 00:10:49
(let ((a 1) (b (+ a 1))) (message a)) This throws the error Debugger entered--Lisp error: (void-variable a) What's the canonical way to do this? zev The canonical way is to use let* (also note that I added a %s format string to your message form): (let* ((a 1) (b (+ a 1))) (message "%s" a)) The let* function allows you to reference other variables that have previously been defined. 来源: https://stackoverflow.com/questions/6794691/in-elisps-let-how-do-you-reference-a-variable-bound-in-the-same-let-while-bind

Why use #' before function arguments in emacs-lisp?

寵の児 提交于 2019-12-03 23:17:02
I'm familiar with Emacs Lisp, but not Common (or any other) Lisp. Some Lisp programmers suggest (e.g. A basic function for emacs ) that it's good to use #' in front of function arguments in Lisp code. For example: (mapc #'my-fun '(1 2 3)) In Emacs Lisp, I believe that this is equivalent to (mapc 'my-fun '(1 2 3)) From the elisp manual, section 12.7. The read syntax #' is a short-hand for using function . The following forms are all equivalent: (lambda (x) (* x x)) (function (lambda (x) (* x x))) #'(lambda (x) (* x x)) and the help for function function is a special form in eval.c . (function

How to “URL decode” a string in Emacs Lisp?

只谈情不闲聊 提交于 2019-12-03 22:21:44
I've got a string like "foo%20bar" and I want "foo bar" out of it. I know there's got to be a built-in function to decode a URL-encoded string (query string) in Emacs Lisp, but for the life of me I can't find it today, either in my lisp/ folder or with google. Anybody remember what it's called? org-link-unescape does the job for very simple cases ... w3m-url-decode-string is better, but it isn't built in and the version I have locally isn't working with Emacs 23. url-unhex-string In my case I needed to do this interactively. The previous answers gave me the right functions to call, then it was

Emacs/AUCTeX prefix arguments

强颜欢笑 提交于 2019-12-03 21:47:42
问题 In LaTeX mode C-c C-c is bound to: (TeX-command-master &optional OVERRIDE-CONFIRM) Normally this interactive function runs a command, perhaps a LaTeX compilation, asking for confirmation . In tex-buf.el it reads: If a prefix argument OVERRIDE-CONFIRM is given, confirmation will depend on it being positive instead of the entry in `TeX-command-list'. This is a bit cryptic for me and reading C-h v TeX-command-list didn't help. How can I pass the prefix argument to "TeX-command-master" so that I

How do I set buffer local variable from Eval: in .dir-local.el?

痞子三分冷 提交于 2019-12-03 21:25:31
问题 Why this works ((nil . ((compilation-directory . "/home/vava/code_directory/") (compilation-command . "rake")) )) and this doesn't? ((nil . ((Eval . (setq compilation-directory "/home/vava/code_directory")) (compilation-command . "rake")) )) What I'm doing wrong here? I have set enable-local-eval in .emacs. 回答1: Emacs Lisp is case-sensitive: try lower-case "eval": ((nil . ((eval . (setq compilation-directory "/home/vava/code_directory")) (compilation-command . "rake")))) Also, the name of the

org--agenda-prefix-format %? does not work

戏子无情 提交于 2019-12-03 21:20:02
Currently, I have my global TODO list shown as follows thanks to erikstokes : (org-agenda-prefix-format " %i %?-12(concat \"[ \"(org-format-outline-path (list (nth 1 (org-get-outline-path)))) \" ]\") "))) which outputs: for org layout: However, as you can see, for Task A, even though there is nothing in the project, it still shows up on the list. describe-variable for org-agenda-prefix-format says : If the first character after `%' is a question mark, the entire field will only be included if the corresponding value applies to the current entry. This is useful for fields which should have

How to display the full context of the entries in org-mode agenda tree view

随声附和 提交于 2019-12-03 17:15:10
问题 In org-mode's daily/weekly agenda view, is there a way to display the full context of the entries? My reading of the code is that it finds the first heading above the timestamp and displays that. However, in my case, that heading is often 3-4 levels deep and doesn't make sense without the bullets above it. It also doesn't seem like there are hooks to easily change that. Filtering is trivial, but not changing the fundamental presentation format. 回答1: There is no way to display all the context

How to overcome the lack of local variable for emacs lisp closure

落花浮王杯 提交于 2019-12-03 17:15:05
问题 I'm now studying Emacs Lisp from the reference manual and Common Lisp from a LISP Book. from the Common Lisp book >> (setf power-of-two (let ((previous-power-of-two 1)) #'(lambda () (setf previous-power-of-two (* previous-power-of-two 2))))) >> (funcall power-of-two) 2 >> (funcall power-of-two) 4 >> (funcall power-of-two) 8 The function won't work in Emacs Lisp because of its dynamic binding behavior. I wonder if it is possible to implement the same function in Emacs Lisp without introducing

Opening files with default Windows application from within emacs

和自甴很熟 提交于 2019-12-03 16:48:25
问题 I'm trying to tweak the dired-find-file function in emacs on Windows XP so that when I open (say) a pdf file from dired it fires up a copy of Acrobat Reader and opens that file with it, instead of opening it within emacs. But I can't work out what variant on shell-command/call-process to use. Here's what I have so far: (defadvice dired-find-file (around dired-find-file-external (filename &optional wildcards)) "Open non-text files with an appropriate external program." (if (string= ".pdf"