Xah Emacs Blog Archive 2012-09
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).
(abbrev-mode 1) will only turn it on in current buffer.
frustrated in the past 40 on this. Trying to find out how to turn it on globally.
i had this and it works:
(custom-set-variables '(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) (abbrev-mode) (setq abbrev-mode t)
.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" (interactive) (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
also in emacs 24 package system, MELPA repository.
via Darren ha
Using ErgoEmacs with Emacs 24
DJNavas 〔firstname.lastname@example.org〕 wrote:
Does some one knows if I can apply ErgoEmacs v1.9.3 to GNU Emacs 18.104.22.168 (i386-mingw-nt5.1.2600)?
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
then, in your
~/.emacs , put
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:
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.
some keyboarding tips for emacs users on Windows. Updated: Windows Keyboard Shortcuts Advanced FAQ
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:
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 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.
The three S's of SUCCESS are (map (vec "SUCCESS") [0 5 6])
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 email@example.com with subject “emacs tutorial upgrade”.
See also: Emergency vi.
learned this tip from Sacha Chua:
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:
- Record a keyboard macro and name it “copy-append-to-kill-ring” and assign it a key. So that, one key press will copy+append. (if you need help, see: Emacs: Keyboard Macro.)
- Write a elisp command “copy-append-to-kill-ring”. (tip: use
kill-append.) (help: Emacs Lisp Basics • Emacs Lisp Examples)
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
emacs bug: whitespace-mode wrong char codes in config file. See: Emacs Misc Bugs
language comparison and tutorial
- Unicode in Python
- Perl: Unicode Tutorial 🐪
Emacs 24 Feature: Edit Search Output in list matching lines (occur-edit-mode)
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-mode 【e】. Example:
- Open a file, then Alt+x
- Switch cursor to the output pane.
- Edit. When done, Alt+x
- 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
Tip added to: Emacs 24.1 New Features (released 2012-06)
scroll-lock-mode. When on, up/down arrow moves the page, instead of the cursor.
See also: Emacs: Init File Tutorial
ErgoEmacs Open Recently Closed File
if you are using ergoemacs-mode minor mode, you can open the last closed file by
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) (interactive) (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.
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.
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
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 F￼ck Sh�t Stack
If you have a question, put $5 at patreon and message me.