Xah Emacs Blog Archive 2012-04

another bug report. “GNU Emacs Bug: find-dired on Filenames with Spaces”. See: Emacs Misc Bugs

Eli Zaretskii (a long time emacs dev) gave a detailed explanation about bi-directional text feature in emacs 24. At Source groups.google.com

GNU Emacs bug: find-dired

See top at Emacs Misc Bugs

Updated. 5 solutions for the Decimalize Latitude Longitude problem, in elisp, python, ruby. Programing: Decimalize Latitude Longitude

Emacs *scratch* Poem

The emacs scratch buffer thread on gnu.emacs.help newsgroup (Source groups.google.com) is rolling, and became a verse fodder.

emacs's *scratch*
amounts to a bitch
but we cannot ditch
the banner of our church

Emacs 24: Oddity with Bidirectional Language/Script Support

first, here's my emacs version am testing from. “GNU Emacs (i386-mingw-nt6.1.7601) of 2012-02-15 on MARVIN”

Some facts:

Now, paste this sentence in emacs “(كتاب ألف ليلة و ليلة)”. Then, hold down right arrow key, then when cursor moves into the Arabic text, it'll suddenly reverse direction, and move right to left, until it reaches the left most arabic char sequence, it'll jump back to the english text and continue move right.

Now, do the same but using forward-charCtrl+f】. Actually, the same behavior is observed visually!

from Eli Zaretskii's post (at Source groups.google.com), it seems to be the expected behavior. But then what's the difference of forward-char and right-char? Am totally confused now.

In emacs 23, holding right arrow (or Ctrl+f) simply move cursor to the right, ALWAYS. I was expecting this from emacs 24's right-char.

Programing: Decimalize Latitude Longitude

Emacs 24: Sort list-colors-display by Hue

Emacs 24: Bidirectional Text

Emacs 24: Unicode {Space, Hyphen} Chars Display

Programing: Decimalize Latitude Longitude

Emacs 24 Unicode 6 Support

Emacs 24 Improvements: copy/paste, describe-char, calc keymap

See: Emacs 24.1 Features (released 2012-06).

separated into a new page for easier search engine find: Emacs Dired Recursive Load Error 2011-05-26

Emacs: Stop Yasnippet auto-indent

See: Emacs: How to Stop Yasnippet auto-indent.

updated. Transform HTML Tags with Emacs Lisp. Much thanks to Jon Snader.

minor update: Process HTML with Emacs Lisp: Transform FAQ Tags. Thanks to jcs.

Emacs: kill-buffer Induces Buffer Accumulation

updated Emacs: Problems of the Scratch Buffer

Lisp: Check If a Item Exist in a List

wrote this yesterday, when i want to know if a item exists in a list.

(defun sequence-to-alist (mySequence)
  "Take a sequence mySequence and returns a association list.
Each element's cdr is “t”.

 (sequence-to-alist (list 3 4 5)) ⇒ ((3 . t) (4 . t) (5 . t))

This function is useful when you need to check a element is in a list, using
`assoc' without loading CL library."
  (mapcar (lambda ($x) (cons $x t) ) mySequence))

ends up not using it. But, i think even if i need it, i probably should just use whichever is in the CL package. Btw, of you Common Lisp coders, what function would it be?

Answer: there's a elisp function member. (thanks to [Elias Mårtenson https://plus.google.com/115209488640908180409/posts].)

Updated the navbar for emacs and elisp manual. The navbar now floats at bottom right. e.g. Emacs manual: Buffers. Elisp manual: Synchronous Processes.

aspell's Dismal Vocabulary Size

Elisp vs Perl: Validate File Links

Ruby Creator Matz: How Emacs Changed My Life

updated: Elisp: google-earth Command

Updated: how to query user for string, file path, regex, with name completion and input history support, at Elisp: How to Write Commands.

Twitter Humor: Chrome vs Emacs, Version Numbering Pressure

Got this tweet today:

bamanzi: «Emacs压力好大 RT @riku: 我擦, Chrome 的版本都已经到 20 了。»


riku: «OMG! Chrome's version reached 20.»

bamanzi: «pressure is on Emacs»

Updated. For you Linux and Mac users, please help test. Emacs: Open File in External App. Let me know if it works.

ErgoEmacs Keybinding is now in the MELPA repository

ErgoEmacs Keybinding is now in the MELPA repository. (thanks to Steve Purcell)

I've also added instructions for check out using svn. For how to use melpa/svn to install, see: ErgoEmacs Keybinding.

Large Scale Software Development with Elisp

Scheme Lisp is Coming to Emacs!

(meeting - Tue Apr 10 19:00 - Rocky Bernstein: Large Scale Software Development with Elisp)

He lives in relative obscurity yet his software is used daily by millions. Rocky Bernstein, former IBM Researcher, Chaitin co-author and 30 year developer walks us through a mosaic of development techniques focusing on personal software scalability.

The long time Free Software developer is best known for his decade of debugger development using Emacs Grand Unified Debugger as a front-end for his other works:

Additionally, Rocky is the author of libcdio: the GNU CD I/O and ControlLibrary. Allowing multimedia assessing of CD-images (includingISO-9660) in an OS and device-independent way, it is used in FreeBSD, NetBSD and nearly every Linux distribution.

Meetup HQ, 9th Floor (maps.google.com)
632 Broadway

Official announcement: www.lispnyc.org

Slashdot news: Guile Scheme Emacs-Lisp Compatibility Matures At http://news.slashdot.org/story/12/04/02/197221/guile-scheme-emacs-lisp-compatibility-matures

Xah Emacs/Elisp Tutorial Update 2012-04-07

New version of my emacs tutorial ready.

If you've bought it before, please just email to xah@xahlee.org with subject “emacs tutorial upgrade”.

If you haven't bought it yet, you can get it for just $10. See: Buy Xah Emacs Tutorial. Currently about 350 HTML pages, about 1k pages printed.

Also, you can subscribe my emacs blog from Google Plus, facebook, twitter, or Google Reader. See: Xah Lee Feeds. Help spread the word. Thanks.

ErgoEmacs pt-Nativo Portuguese Efficient Keyboard Layout

One of the layout supported by ErgoEmacs Keybinding is pt-Nativo for Portuguese. [see Supported ErgoEmacs keyboard Layouts] The website for br-native is gone.

Here's a page containing basic info about the pt-Nativo layout, and the installation files for Windows and Linux. pt-Nativo (Portuguese) Efficient Keyboard Layout (Thanks to Xavier Pinho for the archive.)

updated. Simplified. Emacs: How to Define Keys. Also, separated into a new page: Emacs Keybinding Syntax.

Updated; new page. ELisp: Beware of Region Boundary Change

Updated. Elisp: Command to Update RSS/Atom Webfeed (thanks to jcs for feedback)

updated: Ask ErgoEmacs.

updated: Problems of Calling Unix grep in Emacs

updated (new page): Emacs: Inconsistency of Search Features

updated (new page): Emacs: Change to Title Case

when quitting emacs save-buffers-kill-terminalCtrl+x Ctrl+c】, emacs will ask to save unsaved buffer, but doesn't switch it to front to let you see.

Is there a hook or variable to make it so?

Note: save-buffers-kill-terminal eventually calls save-some-buffers. According to its doc string, it says you can press Ctrl+r to view the buffers in question. (this doesn't work in ErgoEmacs for some reason, i'll have to look into) In anycase, i want automatic switch.

describe-syntaxCtrl+h s】 nice.

other keys i learned in past months and use heavily are:

Emacs: man for woman?

got this comment.

«You define man as an alias for woman? woman doesn't work all the time, if it fails, how do you invoke man?»

major lol. (See: Emacs: Use Alias for Fast M-x.)

Btw, why doesn't alias man to woman work? I have this alias: (defalias 'man 'woman) but it still calls man when M-x man.

Here's why, answer given by Stefan Monnier [http://www.iro.umontreal.ca/~monnier/]:

The reason is that woman.el begins with (require 'man), so when you Alt+x man, it autoloads woman, which loads man, which redefines man thus overwriting your defalias.

So, to get what you want, do this:

(defalias 'man 'woman)
(eval-after-load 'woman '(defalias 'man 'woman))

Emacs Lisp for Text Processing and Wishes

Elisp is really cool.

been using it to do text processing like perl for several years now. About every day, my script goes over few thousand files. (doing report, or find replace. Though, the files sizes are each under 100k) No problem. (caveat: always use with-temp-buffer or with-temp-file, never use find-file to open file, else it can be 40 times as slow. [see find-file vs with-temp-buffer])

recently ditched my last perl and python scripts i use daily for this purpose. (one perl for validating local links of HTML files. one python for find/replace)

It's slower than perl/python, but fast enough for interactive use, and more powerful. More powerful is especially true when you need to deal with nested things such as HTML that's out of regex's reach. (because with emacs's buffer datatype, you just move the cursor about, save positions, grab text, etc. (From my perl and python experience, all you can do there is apply regex to each line or whole file. Anything more complex than that gets complex quickly, and you basically have to start to implement your own text buffer, or use/write a parser.))

(just did a speed comparison of my perl and elisp script that check local links of 5k HTML files. The script algorithm used are not exactly identical, but do the same thing for my need. Perl runs 20 seconds. Elisp 44 seconds. (the elisp is called interactively in emacs, as opposed to emacs --script ‹script name› in shell.))

2 wishes:

rant: Elisp: read-from-minibuffer Propels Deep Questions

Emacs: Single Key for isearch

one of the key i use the most often is isearch.

if you want a single key to do isearch, you can define it this way.

(global-set-key (kbd "<f8>") 'isearch-backward)
(global-set-key (kbd "<f9>") 'isearch-forward)

(defun xah-isearch-hook ()
  "Hook for `isearch-mode-hook' "
  (define-key isearch-mode-map (kbd "<f8>") 'isearch-repeat-backward)
  (define-key isearch-mode-map (kbd "<f9>") 'isearch-repeat-forward)

(add-hook 'isearch-mode-hook 'xah-isearch-hook)

See: Emacs: Change Minor Mode Keys.

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial