dot-emacs

Alias to make emacs open a file in a new buffer (NOT frame) and be activated/come to front?

有些话、适合烂在心里 提交于 2019-12-22 08:18:02
问题 What I have so far is alias em="open -a /Applications/Emacs.app "$@" && osascript -e 'tell application "Emacs.app" to activate'" But I am stumped. With that code, em file.txt will activate, but won't open the file . And I get '22:23: syntax error: Expected end of line but found unknown token. (-2741)' Doing alias em=open -a /Applications/Emacs.app "$@" Works fine and then it will open the file, but obviously not bring emacs to the front. And for some strange reason osascript -e 'tell

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

How can I show the Org-mode agenda on Emacs start-up?

自古美人都是妖i 提交于 2019-12-20 09:47:52
问题 I would like the Org-mode agenda to automatically show what I have to do today when I open Emacs. The org-agenda command is interactive, so it doesn't seem to work well for this purpose. Is there a way to show the Org-mode agenda on Emacs start-up? Thanks, Conor 回答1: You can use after-init-hook to run a piece of code after initialization has finished. To run (org-agenda-list) after init, use: (add-hook 'after-init-hook 'org-agenda-list) 回答2: This works for me (in .emacs ): (setq inhibit

change emacs ruby-mode indent to 4 spaces

不羁岁月 提交于 2019-12-19 15:58:40
问题 From a previous post I got Ruby mode working in emacs. This is working great. Setting up .emacs file for mac ruby development Our company uses 4 spaces for indents though instead of the default 2. I am having difficulty getting this to work. Here is my .emacs file (add-to-list 'load-path "~/rdoc-mode.el") (require 'ruby-mode) (setq indent-tabs-mode nil) ; always replace tabs with spaces (setq-default tab-width 4) ; set tab width to 4 for all buffers Does anyone see what I am doing wrong?

Delete a word without adding it to the kill-ring in Emacs

那年仲夏 提交于 2019-12-18 13:01:44
问题 When switching files using the minibuffer (C-x C-f), I often use M-Backspace to delete words in the path. Emacs automatically places what I delete into the kill ring. This can be annoying, as sometime I am moving to another file to paste something, and I end up pasting part of the file path. I know there are workarounds, and the other code is still in the kill ring, etc, but I would just like to disable this functionality. 回答1: Emacs doesn't have a backward-delete-word function, but it's easy

OSX Emacs: unbind just the right alt?

两盒软妹~` 提交于 2019-12-18 12:15:47
问题 I'm using emacsformacosx.com and would like to stop the Meta_R (right meta, or right option key) on my Apple keyboard from being an Emacs meta key. The reason is that I want to be able to continue using the right option key as a character modifier so that I can enter UTF-8 chars when writing in emacs. I know I can do a C-x 8 RET and type em dash , for example, but that's a lot more work than Alt_R - ! Is there some way of passing the keycode to global-unset-key ? Or something else I'm

Reload .emacs for all active buffers

和自甴很熟 提交于 2019-12-18 11:52:50
问题 A question already has been asked how to reload a .emacs file after changing it. The proposed solutions were to use M-x load-file or M-x eval-region RET on the changed region. Neither of these solutions affect other open buffers for me. Is there a way to reload the .emacs file for all open buffers? I should also note that the M-x load-file does not have the desired effect for reasons outlined in the comments to that answer. 回答1: Your .emacs file is a global configuration that gets evaluated

Programmatically setting Emacs frame size

送分小仙女□ 提交于 2019-12-17 23:36:10
问题 My emacs (on Windows) always launches with a set size, which is rather small, and if I resize it, it's not "remembered" at next start-up. I've been playing with the following: (set-frame-position (selected-frame) 200 2) ; pixels x y from upper left (set-frame-size (selected-frame) 110 58) ; rows and columns w h which totally works when I execute it in the scratch buffer. I put it in my .emacs, and although now when I start the program, I can see the frame temporarily set to that size, by the

Saving Window Configurations in Emacs

孤人 提交于 2019-12-17 15:42:25
问题 I'm wondering if there's a way to save window configurations across emacs sessions. I know desktop-save is fantastic for preserving buffers and whatnot and the emacs manual demonstrates storing a window configuration into a register but this doesn't persist across sessions. Of course this doesn't seem like it would be too hard to implement myself... 回答1: EmacsWiki is a great resource: EmacsWiki: Session Management Looks like Windows Mode, or more specifically revive.el, is what you want. 回答2:

How can I access directory-local variables in my major mode hooks?

≯℡__Kan透↙ 提交于 2019-12-17 10:55:38
问题 I have defined a .dir-locals.el file with the following content: ((python-mode . ((cr/virtualenv-name . "saas")))) In my .emacs I have the following function to retrieve this value and provide a virtualenv path: (defun cr/virtualenv () (cond (cr/virtualenv-name (format "%s/%s" virtualenv-base cr/virtualenv-name)) ((getenv "EMACS_VIRTUAL_ENV") (getenv "EMACS_VIRTUAL_ENV")) (t "~/.emacs.d/python"))) Finally, in my python-mode-hook list, I have this hook function: (add-hook 'python-mode-hook 'cr