How can I select or highlight a block in Emacs?

If I understand the question correctly, it is not about rectangular regions originally. C-Spc puts a mark at the current position. Wherever your cursor is afterwards, the text between the last mark and the current position is “selected” (you can highlight this by activating transient-mark-mode, but this will also mean that marks have to be … Read more

How do I configure emacs for editing HTML files that contain Javascript?

Another solution is multi-web-mode: https://github.com/fgallina/multi-web-mode which may be more easily configurable than the already mentioned multi-mode. You just configure your preferred modes in your .emacs file like this: (require ‘multi-web-mode) (setq mweb-default-major-mode ‘html-mode) (setq mweb-tags ‘((php-mode “<\\?php\\|<\\? \\|<\\?=” “\\?>”) (js-mode “<script[^>]*>” “</script>”) (css-mode “<style[^>]*>” “</style>”))) (setq mweb-filename-extensions ‘(“php” “htm” “html” “ctp” “phtml” “php4” “php5”)) (multi-web-global-mode … Read more

Emacs in Windows

I use EmacsW32, it works great. EDIT: I now use regular GNU Emacs 24, see below. See its EmacsWiki page for details. To me, the biggest advantage is that: it has a version of emacsclient that starts the Emacs server if no server is running (open all your files in the same Emacs window) it … Read more

Emacs, switch to previous window

You might also want to try using windmove which lets you navigate to the window of your choice based on geometry. I have the following in my .emacs file to change windows using C-x arrow-key. (global-set-key (kbd “C-x <up>”) ‘windmove-up) (global-set-key (kbd “C-x <down>”) ‘windmove-down) (global-set-key (kbd “C-x <right>”) ‘windmove-right) (global-set-key (kbd “C-x <left>”) ‘windmove-left)

Move line/region up and down in emacs

Update: Install the move-text package from Marmalade or MELPA to get the following code. Here’s what I use, which works on both regions and individual lines: (defun move-text-internal (arg) (cond ((and mark-active transient-mark-mode) (if (> (point) (mark)) (exchange-point-and-mark)) (let ((column (current-column)) (text (delete-and-extract-region (point) (mark)))) (forward-line arg) (move-to-column column t) (set-mark (point)) (insert text) (exchange-point-and-mark) … Read more

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