elisp

Where should I add autoload cookies in my Emacs Lisp package? Is there a definitive guide?

ぃ、小莉子 提交于 2019-12-14 01:25:23
问题 I maintain a somewhat popular Emacs package (ido-ubiquitous), and I would like to add the ;;;###autoload comments to my package so that it does not need to be loaded until its mode is activated. I attempted this a while ago with the same package, and it resulted in a number of cryptic errors that only occurred when the package was autoloaded, so I removed all the autoload stuff and the problems went away. I'd like to try again, but only if I can find definitive documentation on how to do it

emacs ow can I helm-find with default directory pre-specified?

核能气质少年 提交于 2019-12-13 18:29:38
问题 I use emacs for notes mainly. All my notes are in: ~/Dropbox/Uni/Notes I want to tie a keyboard shortcut (e.g C-f12) to do a helm-find that always starts in the above dir irrelevant of the source buffer. I have tried: (global-set-key (kbd "C-<f2>") (lambda () (interactive) (helm-find "~/Dropbox/Uni/Notes/"))) But when I run it, it still prompts me for 'DefaultDirectory' which is usually the same as the current buffer. ? [edit] I made a hack-around: (global-set-key (kbd "<C-f2>") (lambda ()

If I open doc.foo file, I want emacs to look for and open doc.bar file in the same folder

一个人想着一个人 提交于 2019-12-13 15:21:37
问题 Specifically this problem arises when working in LaTeX (auctex) for me, but I think it must have a general emacs solution. To every doc.tex file, I have an associated and oft-edited doc.sty file in the same folder. Is there a way that whenever I open the doc.tex file I can have emacs open the doc.sty file in that folder? I'm not proficient at all in elisp, so something very simple---it doesn't need to be robust code: it can work on the assumption that both files are named doc.* and that both

How to advise primitives in Emacs

和自甴很熟 提交于 2019-12-13 13:22:19
问题 I was trying to answer another SO question when I hit upon some very odd behavior. Here's my little test case: (make-variable-buffer-local (defvar my-override-mode-on-save nil "Can be set to automatically ignore read-only mode of a file when saving.")) (defadvice file-writable-p (around my-overide-file-writeable-p act) "override file-writable-p if `my-override-mode-on-save' is set." (or my-override-mode-on-save ad-do-it)) (defun my-override-toggle-read-only () "Toggle buffer's read-only

How to kill a quoted string at point in emacs?

谁说我不能喝 提交于 2019-12-13 13:01:08
问题 I would like to kill a quoted string in a source file without having to mark the beginning of the string and kill-region, but just by placing the point anywhere inside the quoted string and pressing a shortcut. I tried to write a function in elisp for this, but I figured out that the file would need to be parsed from the beginning up to point to determine whether the point is inside quoted string, and to find the bounds of the quoted string(also handle the \")... But the file is already

Best way to add per-line information visually in emacs?

浪尽此生 提交于 2019-12-13 12:29:13
问题 I'm writing a minor mode for emacs which, at the very least, will calculate a numeric value for each line in a buffer. I want to display this visually, preferable neatly before each line. I know some minor modes draw to the fringe, and I know overlays are an option too (are these related?), but I can't find a good example of what I want anywhere. Basically, I want to have something like the line numbers from linum-mode, but they will need to change every time the buffer is modified (actually,

How to use “hide-region” package in elisp

雨燕双飞 提交于 2019-12-13 07:39:08
问题 There is this well-known package hide-region Link to the package (hide-region.el) I want to apply hide-region-hide from a certain "point a" to "point b" [a region] in my file. How can I do this? What I need to define? It works when I highlight manually some text, but I need to do it in my code and give it the beg. of a region and end of region and apply it to the resulted region. 回答1: The package is somewhat poorly written, and does not allow you to pass it a region as arguments to the

Customizing gnus summary buffer

≯℡__Kan透↙ 提交于 2019-12-13 04:54:54
问题 I want my theme to look like similar to below (code got from: http://emacswiki.org/emacs/TomRauchenwald) (source: modprobe.de) However I get this, i.e my threads dont join each other. I suspect this is due to text padding or something? 回答1: It looks like a font problem. The code you found is using a special character named BOX DRAWINGS HEAVY VERTICAL . It looks like a pipe ( | ) but is slightly longer and bolder. When your font does not have that character it has a substitution rule telling

defadvice error for isearch-search-fun-default

心已入冬 提交于 2019-12-13 04:29:04
问题 This is a continue of my previous post (is it possible to preprocess the input string before isearch-forward in Emacs). I am trying to implement jpkotta 's answer using the variable isearch-search-fun-function . Instead of writing my own function, I just advise the isearch-search-fun-default to include my own functions ( isearch-str-forward and isearch-str-backward , just for the purpose of demo) so that everytime I type "abc", isearch will highlight and search the regexp a[ ]*b[ ]*c[ ]* .

How to use a cons cell to define and later remove overlays with `dolist`

南楼画角 提交于 2019-12-13 01:27:37
问题 I am looking for some guidance, please, to reduce the time needed to perform my custom overlay removal function. The delay of up to 0.1 seconds is caused because a plethora of variables all have values, however, not every variable is necessarily used. My goal is to attach a second variable that can be set to non- nil whenever the first variable is used, but I am unsure how to set this up and how to incorporate that into the overlay removal function. Perhaps something that looks like this