Xah Emacs Blog Archive 2012-09 to 2012-09

Building Emacs on Linux — a Guide

Jon Snader gave answer about the abbrev mode mystery.

To turn on abbrev-mode globally, put this in your init file: (setq-default abbrev-mode t)

Thanks a lot Jon. Check out his blog at http://irreal.org/blog/. Always lots of nice tips about emacs, and also programing Common Lisp.

to turn on abbrev globally, use (setq abbrev-mode t). Note: (abbrev-mode 1) will only turn it on in current buffer.

Emacs: Abbrev Mode Tutorial

frustrated in the past 40 on this. Trying to find out how to turn it on globally.

i had this and it works:

 '(abbrev-mode t)

but yesterday i got smart and removed all my custom set var, thinking for a fresh start. MS Windows miraculously rebooted my machine for a update when i was sleeping. This morn, my abbrevs don't work. Turns out it's not on, but

(abbrev-mode 1)
(setq abbrev-mode t)

in .emacs, none works.

according to the manual, it's buffer local only, so it's correct behavior.

Also, emacs 24 made changes to the meaning of args of minor modes. Now it is extremely confusing.

i still don't see a simple way to turn on abbrev globally.

Yet, it's strange that custom-set-variables works. I always thought it's equivalent to setq of each. But now apparently not.

Anyone know the magic here?

Elisp: Defining a Temp Inner Function Insider a Function

My elisp homework, but am putting it out for fun.

Over the past years in coding elisp, sometimes i want to define a function inside a function, as a temp function. Not critical, but sometimes desired. Can you define a function inside a function?

Something like this:

(defun ff (y)
  "test defining a temp inner function"
  (let (tempF)

    (defun tempF (x)
      "plus 1"
      (+ x 1) )

    (tempF y)


PS answer should be either yes or no. If yes, provide code. Code should be pure elisp, not with CL library. Nor using elisp macros. The inner function should be temp, not closure. A “lambda” doesn't count as solution. It should be a named function. (lambda assigned to a variable is acceptable)

I'll study this over the weekend and provide answer, if nobody gave answer first.

emacs tip: edit grep output: wgrep.el

See: https://github.com/mhayashi1120/Emacs-wgrep

also in emacs 24 package system, MELPA repository.

via Darren ha

See also: Emacs: How to Install Packages Using ELPA, MELPA.

Using ErgoEmacs with Emacs 24

DJNavas 〔denis.navas@gmail.com〕 wrote:

Does some one knows if I can apply ErgoEmacs v1.9.3 to GNU Emacs (i386-mingw-nt5.1.2600)?

Here's answer.

it's best to just apply the lastest ErgoEmacs from repository to GNU emacs 24.x

First, check out with git: http://code.google.com/p/ergoemacs/source/checkout

suppose your checkout dir is ~/ergoemacs_source/.

then, in your ~/.emacs , put

(load "~/ergoemacs_source/ergoemacs/ergoemacs/init")

that should be it.

if you have other init, you can add it after. Or, add this line after if it's in a file:

(load "~/my_emacs_init.el")

I've been doing this with alpha version of emacs 24, and have been updating the source weekly. No problem. Recently also did it on Linux and it is smooth.

I'll make a build real soon now (using David Capello's excellent build tool at http://code.google.com/p/ergoemacs/wiki/CreatingErgoEmacsWindowsInstaller. If you are on Windows, you can built a binary using that tool.)

Sorry for the delay. Let me know if there's any problems.

the day i lost control

some keyboarding tips for emacs users on Windows. Updated: Windows Keyboard Shortcuts Advanced FAQ

Ask Emacs Tuesday.

Keyboard Tip: One Key to Switch to {Firefox, emacs, Terminal} for {Linux, Mac, Windows}

I was going to blog about this, but Jon Snader (jcs) beats me to it. See: [• Emacs Rocks Episode 12 By Jon Snader. At http://irreal.org/blog/?p=1194 , Accessed on 2012-09-24 ]

A fantastic emacs showoff, from Emacs Rocks:

《Emacs Rocks! Episode 12: Working with HTML》

For details of the commands he used in the video, see: http://emacsrocks.com/e12.html.

One particular nice feature is renaming HTML tags. See the full demo of that feature here:

《Emacs Rocks! Episode 08: mark-multiple》

Emacs Rocks is Magnar Sveen. His videos are so entertaining and educational, to-the-point, and he's also the author of several very useful packages. See his github: https://github.com/magnars.

You can follow him at https://twitter.com/emacsrocks.

If you have any questions, you can ask him on twitter, or, i'd be happy to help out. I run a Ask Emacs Tuesday. Hope to see you there.

If you need to understand the basics of working with HTML, see: Emacs HTML Tips.

Laptops 2012 Comparison: ASUS Zenbook Prime vs Apple MacBook Pro

The three S's of SUCCESS are (map (vec "SUCCESS") [0 5 6])

Gary Fredericks

now, i don't think that's proper syntax, at least not elisp. Can anyone write a elisp version?

tweet it on g+, fb, twitter, tag @ergoemacs

A new version of emacs tutorial is available. Buy for $5. At: Buy Xah Emacs Tutorial. Thank you for support. If you've bought it before, please do email to xah@xahlee.org with subject “emacs tutorial upgrade”.

System-wide ErgoEmacs Keybinding for Windows, Mac, Bash

vi clippy assistant

See also: Emergency vi.

Ask Emacs Tuesday.

learned this tip from Sacha Chua: append-next-killCtrl+Meta+w】.

Ari Jordon explains how to use this command:

Quite useful, actually. Normally, if you kill a couple of lines, move the cursor, and then kills some more lines, only the second batch of lines will be yanked with C-y. However, if you use append-next-kill before the second batch of kills, they will be appended to the first batch.

Here's 2 exercise, one for emacs one for elisp:

Discovered xz compression. Not due to some tech geeking, but because FSF actually uses it for emacs. Size significantly smaller than gzip and bz2.

emacs-24.2.tar.gz  49M
emacs-24.2.tar.bz2 40M
emacs-24.2.tar.xz  33M

See: Linux Compression How-to: tar gzip bzip2 xz 7zip rar zip

emacs bug: whitespace-mode wrong char codes in config file. See: Emacs Misc Bugs

language comparison and tutorial

Emacs 24 Feature: Edit Search Output in list matching lines (occur-edit-mode)

When using list-matching-lines (aka occur) or multi-occur, you can edit the output, so that the change will happen in the original file. In the output buffer, Alt+x occur-edit-modee】. Example:

  1. Open a file, then Alt+x occur or multi-occur.
  2. Switch cursor to the output pane.
  3. Alt+x occur-edit-modee】.
  4. Edit. When done, Alt+x occur-cease-editCtrl+c Ctrl+c】.
  5. Your changes are made in original file(s) too. You still need to save the file(s).

Thanks to Darren ha for the tip on occur-edit-mode.

Tip added to: Emacs 24.1 New Features (released 2012-06)

Emacs has scroll-lock-mode. When on, up/down arrow moves the page, instead of the cursor.

See also: How to Set Emacs's User Interface

Ask Emacs Tuesday.

ErgoEmacs Open Recently Closed File

if you are using ergoemacs-mode minor mode, you can open the last closed file by open-last-closedCtrl+Shift+t】.

What if you want to open a file you closed that's way before the last closed?

Boris Kheyfets gave the following code:

(defun ergoemacs-undo-close-buffer ()
  "Opens a file that are closed in current emacs session.
Requires `ergoemacs-mode'"
  ;; code by Boris Kheyfets, 2012-09-10. (naming/documentation slightly edited by xah)
  (let* ((mylist (delq nil (delete-dups (mapcar 'car recently-closed-buffers))))
         (baseName (ido-completing-read "Open this session closed buffer: " mylist))
         (fileName (cdr (assoc baseName recently-closed-buffers))))
    (find-file fileName)))

It's nice that it lists the files in ido-mode, so you can use left/right arrow keys to select.

Thank you Boris Kheyfets. Original post at http://stackoverflow.com/questions/12330088/how-do-i-find-the-value-of-the-key-in-association-list-of-strings

Do you want to stop emacs backup files~ littered in every directory? Do you want them to all go into one directory? See bottom Emacs Advanced Tips. Recently updated the elisp code.

Lisp Programer Daniel Weinreb Died (1959 – 2012)

A emacs lisp story. One Language to Rule Them All?

you can start emacs with maximized window by emacs -mm. (thx to Bozhidar Batsov)

you can also start emacs with reverse video by emacs -rv. Good for under bright sunlight.

updated recently: Emacs: Single Key to Delete Whole Line

recently updated Emacs: Select Line, between Quotes, Extend Selection

Ask Emacs Tuesday.

not emacs related, but important personal event: Larry Sanger Reported me to FBI

on Windows + Cygwin + emacs, and have problem with Z on gzipped file in dired? see: Emacs Cygwin gunzip Problem.

This is RMS doppelganger in parallel universe: the Philosophy of Fck Sh�t Stack