Where can I find my .emacs file for Emacs running on Windows?

Copy and pasted from the Emacs FAQ, http://www.gnu.org/software/emacs/windows/: Where do I put my init file? On Windows, the .emacs file may be called _emacs for backward compatibility with DOS and FAT filesystems where filenames could not start with a dot. Some users prefer to continue using such a name, because Windows Explorer cannot create a file … Read more

How do I change read/write mode for a file using Emacs?

M-x read-only-mode in very old versions of Emacs, the command was: M-x toggle-read-only On my Windows box, that amounts to Alt-x to bring up the meta prompt and typing “read-only-mode” to call the correct elisp function. If you are using the default keyboard bindings, C-x C-q (which you read aloud as “Control-X Control-Q”) will have … Read more

Emacs Ruby autocomplete almost working

Here’s a thought: The macro binds a flet function (rails-project:root) one time to the value that (rails-project:root) has just before the body executes. (That’s how it claims a performance increase: Apparently the outer (rails-project:root) is expensive, so calling once and caching the value seems like a good idea.) Unfortunately, if there is code inside the … Read more

How to automatically install Emacs packages by specifying a list of package names?

; list the packages you want (setq package-list ‘(package1 package2)) ; list the repositories containing them (setq package-archives ‘((“elpa” . “http://tromey.com/elpa/”) (“gnu” . “http://elpa.gnu.org/packages/”) (“marmalade” . “http://marmalade-repo.org/packages/”))) ; activate all the packages (in particular autoloads) (package-initialize) ; fetch the list of packages available (unless package-archive-contents (package-refresh-contents)) ; install the missing packages (dolist (package package-list) (unless … Read more

How can I delete the current line in Emacs?

C-a # Go to beginning of line C-k # Kill line from current point There is also C-S-backspace # Ctrl-Shift-Backspace which invokes M-x kill-whole-line. If you’d like to set a different global key binding, you’d put this in ~/.emacs: (global-set-key “\C-cd” ‘kill-whole-line) # Sets `C-c d` to `M-x kill-whole-line` If you want to delete a … Read more

Emacs bulk indent for Python

If you are programming Python using Emacs, then you should probably be using python-mode. With python-mode, after marking the block of code, C-c > or C-c C-l shifts the region 4 spaces to the right C-c < or C-c C-r shifts the region 4 spaces to the left If you need to shift code by … Read more

How to open Emacs inside Bash

Emacs takes many launch options. The one that you are looking for is emacs -nw. This will open Emacs inside the terminal disregarding the DISPLAY environment variable even if it is set. The long form of this flag is emacs –no-window-system. More information about Emacs launch options can be found in the manual.

How do I create a directory from within Emacs?

to create the directory dir/to/create, type: M-x make-directory RET dir/to/create RET to create directories dir/parent1/node and dir/parent2/node, type: M-! mkdir -p dir/parent{1,2}/node RET It assumes that Emacs’s inferior shell is bash/zsh or other compatible shell. or in a Dired mode + It doesn’t create nonexistent parent directories. Example: C-x d *.py RET ; shows python … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)