elisp

emacs multi-keystroke binding [duplicate]

▼魔方 西西 提交于 2019-12-07 14:39:23
问题 This question already has answers here : How to write a key bindings in emacs for easy repeat? (5 answers) Closed 5 years ago . I'm still very new to EMACS, but are getting familiar when i'm going through the emacs and elisp manual. But right now i'm stuck on this: Is there a simple way to bind input sequences in regexp style? eg: the default binding for function enlarge-window-horizontally is "C-x {", is it possible to rebind it to something like "C-x ({)+" so that enlarge-window

Emacs — dired-mode test to determine remote server name / address

末鹿安然 提交于 2019-12-07 12:35:33
问题 Is there a test to obtain the remote server name (e.g., localhost ) or address (e.g., 12.34.56.789 ) in the current-buffer with dired-mode active? I suppose I could use string-match or split-string and then equal , but I thought there might be a handy function like get server name. iphone -- dired-directory /ssh:root@localhost#2222:/var/mobile/Applications/F30B1574-5979-4764-8742-7F9DB2863094/Documents/.0.data: shared server -- dired-directory /ssh:lawlist@12.34.56.789:/home/lawlist/public

Why does re-search-backward give different result in python-mode?

心已入冬 提交于 2019-12-07 11:54:52
问题 I have been using python-mode for a long time. And I always use subword-mode. But subword-mode behave strangely in python-mode. For example, the M-b movement. If there is a variable named test_varialbe and I put the cursor at the end of this variable, in python-mode M-b will make the cursor point to t while in other modes it will go to v . So I looked into the source of subword-mode and found the following function: (defun subword-backward-internal () (if (save-excursion (let ((case-fold

Is it possible to make emacs interpet an fn key as a modifier key?

泄露秘密 提交于 2019-12-07 11:45:07
问题 Is it possible to make emacs interpet an fn key as a modifier key? Can I bind f6, f.ex. to hyper? I had this: (setq ns-function-modifier 'hyper) ; set Mac's Fn key to type Hype And tried to do this: (setq <f6> 'hyper) But the latter did not work. I'd prefer not making the OS as a whole see f9 as some sort of modifier key (making it possible to more easily use the function keys for different purposes in other apps). Edit: It seems like one possible solution is to bind f9 to C-x @ h but when I

How can I locate the defadvice for an advised function in Emacs?

大兔子大兔子 提交于 2019-12-07 11:05:12
问题 When I view documentation for beginning-of-defun , there is a note: This function is advised. Around-advice `senator': Move backward to the beginning of a defun. If semantic tags are available, use them to navigate. However I can't find in which .el file the defadvice is called. Is there any way to navigate to the original file, where the advice is defined? Edit: While i marked correct Phils' suggestion to rgrep the .el files, i still hope, that there is some more elegant way to trace back to

Emacs insert centered comment block

痴心易碎 提交于 2019-12-07 11:00:52
问题 I would like to create a macro for emacs that will insert a latex comment block with some centerd text like: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Comment 1 %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Comment 2 Commenttext 3 %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Is this possible in emacs-lisp ? 回答1: Emacs comes with the command comment-box for this purpose. It produces centered comment

Emacs ESS Mode TAB stops indenting

旧街凉风 提交于 2019-12-07 10:14:12
问题 I'm using Emacs 24 on Windows to write some R code. Up until about 30 minutes ago, whenever I would write a new function, ESS would automatically indent the lines following the function declaration and pressing the tab key on a new blank line would jump me to the appropriately indented starting position inside the declaration. EG: foo <- function() { first line started here second line here. .etc } Now, it is hard wrapping everything to the left, and not responding by automatically indenting

Gist (gist.el / Emacs) — Set the `description` at the time of creation

心已入冬 提交于 2019-12-07 09:30:54
问题 The default behavior of gist-region is to leave the description blank. To set the description, it is necessary to switch to the gist-list buffer and then use the function gist-edit-current-description to set the description . I would like to be able to set the description at the same time that the gist is created, without switching to the gist-list buffer. A mini-buffer prompt that defaults to the buffer-name would be the preferred method of handling this. How can this be accomplished

.emacs.d and site-lisp directory

大憨熊 提交于 2019-12-07 08:56:48
问题 I have the following two questions about emacs In my .emacs.d directory there is an empty directory called auto-save-list. What is that for ? I have create a elisp directory in my home directory on my linux machine where i place .el files. In my .emacs i have (add-to-list 'load-path "~/elisp") Now,I have heard of .emacs.d/site-lisp directory. Im confused about the difference between site-lisp and my own elisp directory. Can someone please explain. Thank You 回答1: You can read about auto-save

How to process a series of files with elisp?

回眸只為那壹抹淺笑 提交于 2019-12-07 08:40:53
问题 I'm a newbie to programming, so please bear with me here... I have a directory full of files called "foo01.txt", "foo02.txt", etc. and a function called MyFunction . I want to open each file as a buffer, run MyFunction on it, write the buffer to its file, kill the buffer and move on to the next file in the series until all the files are done. I think all the pieces I need to do this are described in the Cookbook (http://emacswiki.org/emacs/ElispCookbook) but I'm not really understanding how