Xah Emacs Blog Archive 2009-12
Emacs: isearch Current Word (essay and practical tips)
A new version of ErgoEmacs Keybinding is out. Version 5.3.3, released on 2010-05-27. Major new features are:
- Ctrl+p now asks for confirmation before printing
- Copy and Cut will copy/cut current line if there's no text selection.
- Support for UK layout.
- Support for UK Dvorak layout.
- You can now change keybindings, for example, if it conflict with other minor modes.
Full detail is in the version history file in the package.
Download at: ErgoEmacs Keybinding.
Emacs Spell Checker Problems. (criticism; short essay)
Discovered a great tip to copy current line, or cut. See: Emacs: How to Copy/Cut Current Line
camelCase and Code Formatting (opinion; essay)
Sometimes you want to delete the file of the current buffer. How do you do it? Here's a simple command Emacs: Delete Current File.
A short elisp tutorial: Emacs Lisp list-matching-lines.
tutorial: Emacs: Newline Representations ^M ^J ^L.
Which Emacs to Download? (This page is a guide on what emacs distributions are there, which one you should use, for Windows or Mac.)
Basic tutorial: Emacs Lisp Functions Optional Parameters.
Another little emacs tip. The tip is about how to edit files that requires admin privilege.
Often, you want to edit a file that requires admin privilege. So, either you start another emacs instance as root, or, modify the file's permission first with sudo then edit then modify it back. Both solutions are painful.
Starting another emacs instance is slower, and you also need to navigate to the dir path. Edit permission bits is error prone and dangerous. You have to carefully remember what was the original perm bits.
When i was a full time unix sys admin, i usually always keep a instance of emacs as root, with different colored background. But this is also not a optimal solution. Often i need to login to several remote machines. Starting another instance as root is too much manual overhead, and may ends up too many terminal windows.
Here's one short tip from the web:
; from newsgroup gnu.emacs.help, by Richard Riley, 2009-08-02 (defun open-current-file-as-admin () "Open the current buffer as unix root. This command works on unixes only." (interactive) (when buffer-file-name (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
PS the above works in unixes only (including Linuxes and Mac OS X). How does one do on Windows? If you know, please post! Concrete solution that you actually use is preferred.
Little tips about calculating dates.
I needed to find the date of 2010-04-17 minus 200 days. How do you do it in emacs?
Start calendar mode by tying 【Alt+x cale Enter】. In calendar mode, the left arrow moves you back. But it also takes a universal argument of n to go back n days. So, type 【Ctrl+u 200 ←】 will put you 200 days back.
When your cursor is in the calender pane, there are these new menus: Scroll, Goto, Holidays, Diary, Sun/Moon. Check them out! I've been using emacs for 12 years, but never realized this!
PS thanks to people on comp.emacs, in particular Jason Rumney.
Best Unicode Fonts for Programer. (tutorial; tips)
Some of my emacs lisp tutorial have been translated to Chinese and Japanese.
- Elisp: How to Write Commands in Japanese: 《武蔵の日記 (Musashi's Diary)》 , By 武蔵, at Source
- Emacs Lisp Basics in Chinese: 《[elisp]EmacsLisp 基础》 , By laihj, at Source
Elisp: Region, Active Region (tutorial)
Count Words, Count Chars, Count Region (Emacs Lisp tutorial)
Ever want to quickly show the current file's location in dired? [see Emacs: How to Stop Yasnippet auto-indent]
Why Emacs Is So Useful. (essay)
A new version of AutoHotkey Mode For Emacs is out. This version fixes a defect where if the source code contains “"C:\"”, then everything after is badly syntax colored.
A new report: Emacs's Command Frequency. This report is a major update from the one in 2007, with data size that's 20 times larger. It took some 16+ hours to do this report, most time is spent on thinking and re-writing the Python script that generates the report. (i thought it was just gonna be some 2 hours)
If your are running Microsoft Vista, and you use emacs to edit files in the
C:\Program Files\ or
c:\Program Files (x86)\ dir, and without admin privilege, Windows will automatically create them in
$HOME\AppData\Local\VirtualStore\. This may be very confusing, because dired will show a certain file you have in the program dir, but it doesn't exist when you use shell to look for it. For detail, see: Windows Vista VirtualStore Problem.
Elisp: Doc String Markup (tutorial)
Emacs: Bookmark Tutorial (tutorial)
A new package: AutoHotkey Mode (xahk-mode.el) For Emacs. Took me about 8 hours to write, everything, including the web page, doc, this announcement etc, all. (i was expecting to be some 20 hours.)
Ever want to uncolor the current region? [see Emacs: How to Stop Yasnippet auto-indent]
On Dec 26 2009, 8:50 pm, Ccming wrote:
I very like the default style of PHP lanuage on Notepad++, hope I can use them on GNU Emacs.
i don't recommend it because emacs's font style for programing lang keyword types are used across all langs. For example, function is blue, strings is a bit orange, coments are red, etc., for all langs. Also, emacs's font face coloring are designed so it's also usable when in 8-color terminal.
anyway, to do what you want, do Alt+x customize-group, then give “font-lock-faces”. There, you can use the mouse to select and change.
you can see a sample of how emacs coloring are for different languages here: Syntax Coloring with Google-Code-Prettify.
When you use a hook, it is best to define it as a function, then add that to hook, instead of using a lambda. Let me explain… (archived at: Emacs Tips Collection.)
Starting a Dedicated Emacs Blog
Am starting this emacs blog. Often, i have random tips or notes i want to write down. Too small to be part of tutorial, but still useful even to myself later. This blog also serve as news update for my emacs tutorial. I have a main blog but that is not focused on emacs topic. Many people are interested in my emacs news but not others. So, this emacs blog will help.
What follows are emacs related stuff from my main blog in the past 4 months. I put them here to start with, and also gives some sense of the topics in this blog.
- Best Trackball Mouse
- Review of Gaming Mouses
- Emacs xbbcode-mode For Editing BBCode
- Microsoft IntelliType Hacks
- Problems of Microsoft IntelliType
- Problems of Emacs's Manual
- Review: American Heritage Dictionary vs Merriam Webster Collegiate
- Windows Environment Variables
- Emacs Does Not Support Viewing Images Files In Windows
- Idiocy of Keyboard Layouts: QWERTZ, AZERTY, Alt Graph
- Short Survey of Keyboard Shortcut Notations
- Emacs Lisp Suggestion: Function to Copy/Delete a Directory Recursively
- Mac and Windows File Conversion
- Problems of Emacs Supporting Obsolete Systems
If you have a question, put $5 at patreon and message me.