dot-emacs

Emacs: default-frame-alist setting is ignored

萝らか妹 提交于 2020-01-31 18:22:20
问题 I would like all frames to overlap at (1,1) . Yet with a .emacs containing (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) (setq default-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) calling C-x 5 2 results in frames in a cascade, as you see in the figure. How can I force all frames to be anchored at the same place? I am running Emacs 23.3.1 on OS X (Mountain Lion). 回答1: The settings are not being ignored. The reason you see the above behaviour

Emacs: default-frame-alist setting is ignored

心已入冬 提交于 2020-01-31 18:20:44
问题 I would like all frames to overlap at (1,1) . Yet with a .emacs containing (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) (setq default-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) calling C-x 5 2 results in frames in a cascade, as you see in the figure. How can I force all frames to be anchored at the same place? I am running Emacs 23.3.1 on OS X (Mountain Lion). 回答1: The settings are not being ignored. The reason you see the above behaviour

Emacs Setting which-function-mode

守給你的承諾、 提交于 2020-01-24 10:30:12
问题 I would like to have which-function-mode on by default when I open up Emacs. I've added the following lines to my .emacs file. (setq which-func-mode t) (setq which-function-mode t) When I open up a .cpp file and navigate to the body of a function, I'm not seeing the function name in the status bar at the bottom like I should. If I then run M-x which-function-mode, the message is "Which-Function mode disabled" so it looks like the line in my .emacs file takes but is not quite working. Am I

Setting tab size in Emacs

你。 提交于 2020-01-01 06:13:29
问题 I'm using Emacs as an editor. I want to set the tab size to four spaces. In my .emacs file I have the following: (setq default-tab-width 4) I've also tried: (set-default tab-width 4) Either way, when I open emacs and try to tab, it inserts two spaces. Am I doing something wrong? It almost seems like its not seeing my .emacs file. Any suggestions would be great! Thanks! 回答1: The tab-width variable doesn't determine the amount of indenting per level, and the TAB key doesn't insert a tab: it

how to get focus-follows-mouse over buffers in emacs?

我怕爱的太早我们不能终老 提交于 2020-01-01 02:05:48
问题 Suppose I have a source file open and I launch a shell. I can hit C-x o to switch between the two buffers. But how can I get it so that when I move the mouse the buffer under the mouse gets focus, just like the "focus follows mouse" option common in window managers? 回答1: Set: (setq mouse-autoselect-window t) 回答2: Answering the shift+arrow comment, do in your .emacs: (windmove-default-keybindings) 来源: https://stackoverflow.com/questions/898401/how-to-get-focus-follows-mouse-over-buffers-in

How can I emulate Vim's * search in GNU Emacs?

孤人 提交于 2019-12-29 11:46:17
问题 In Vim the * key in normal mode searches for the word under the cursor. In GNU Emacs the closest native equivalent would be: C-s C-w But that isn't quite the same. It opens up the incremental search mini buffer and copies from the cursor in the current buffer to the end of the word. In Vim you'd search for the whole word, even if you are in the middle of the word when you press *. I've cooked up a bit of elisp to do something similar: (defun find-word-under-cursor (arg) (interactive "p") (if

Emacs 24 Package System Initialization Problems

自闭症网瘾萝莉.ら 提交于 2019-12-27 10:38:31
问题 It seems to me that the new Package system that is built-in on Emacs 24 has some flaws when it comes to properly loading and initializing the installed packages. Recently, I upgraded to Emacs 24.1.1 which was realeased on 6/10/2012 and I have been trying to use the built-in package system and have installed several packages using it, but they all have a similar problem related to autoload and initialization. For example, I use a package called smex which provides enhancements for using the M

Emacs/elisp: global-set-key bindings not taking effect for Meta-<down> or -<up>?

匆匆过客 提交于 2019-12-24 07:00:31
问题 I am trying to bind M-<up> and M-<down> to scroll-down-line and scroll-up-line respectively as indicated here: https://stackoverflow.com/a/16229080/562139. This is what I have in my .emacs : ;; Key bindings (global-set-key (kbd "M-g") 'goto-line) ;; Scroll line by line (global-set-key (kbd "M-<down>") 'scroll-up-line) (global-set-key (kbd "M-<up>") 'scroll-down-line) Problem: The scroll key bindings are not taking effect, while the one for goto-line does. When I run M-x scroll-down-line

Define key when buffer is read-only

孤者浪人 提交于 2019-12-23 12:35:01
问题 I'm trying to use the keys "n" and "p" the same way as "C-n" and "C-p" when my buffer is read-only (yes, I'm lazy). I use this code in my .emacs file : (when buffer-read-only (local-set-key "n" 'next-line)) (when buffer-read-only (local-set-key "p" 'previous-line)) which is working when the buffer is automatically set as read-only (i.e. like within w3m) but it seems it doesn't work when I run C-x C-q (toggle-read-only). It keeps saying Buffer is read-only: #<buffer buffername> and I have no

What is a simple way to combine two Emacs major modes, or to change an existing mode?

孤者浪人 提交于 2019-12-23 08:50:08
问题 In Emacs, I'm working with a file that is a hybrid of two languages. Question 1: Is there a simple way to write a major mode file that combines two major modes? Details: The language is called "brew" (not the "BREW" of "Binary Runtime Environment for Wireless"). brew is made up of the languages R and Latex, whose modes are R-mode and latex-mode. The R code appears between the tags <% and %>. Everything else is Latex. How can I write a brew-mode.el file? (Or is one already available?) One idea