setting emacs font and the pain

On Aug 28, 5:20 pm, "Drew Adams" wrote:
> > How do i set a font for the current frame?
> M-x icicle-font S-TAB
> Choose any available font, using completion. Use `M-SPC', if you want to match
> different font parts separately (taking the intersection).
> > What i want is a toggle-font code so that i can press a key and have
> > the font set to either a monospaced or variable-spaced one, and just
> > for the current frame. More specifically: what's the elisp function
> > that makes the current frame use Courier New? (i'll also need to
> > know the full string or whatever that emacs uses for what Windows
> > calls the Courier New font.)
> (set-frame-parameter nil 'font "-*-Courier
> New-normal-r-*-*-14-112-96-96-c-*-iso8859-1")
> or whatever font you want.
> M-: (frame-parameters) is your friend.

Thanks Drew & Florian.

Spent another 1 hour on this, didn't want to go further at this moment but wanted to report some findings and reply.

finally was able to get something useful:

(defun cycle-font ()
"Change font in current frame, cycling thru a predefined set of fonts."
(if (not (eq last-command this-command))
(set-frame-parameter nil 'font "-*-Courier New-normal-r-*-*-14-112-96-96-c-*-iso8859-1")
(put this-command 'state "2"))
((string= (get this-command 'state) "1")
(set-frame-parameter nil 'font "-*-Courier New-normal-r-*-*-13-112-96-96-c-*-iso8859-1") (put this-command 'state "2"))
((string= (get this-command 'state) "2" )
(set-frame-parameter nil 'font "-outline-Lucida Sans Unicode-normal-normal-normal-sans-13-*-*-*-p-*-iso8859-1") (put this-command 'state "3"))
((string= (get this-command 'state) "3")
(set-frame-parameter nil 'font "-outline-Code2000-normal-normal-normal-*-13-*-*-*-p-*-iso8859-1") (put this-command 'state "1"))

(global-set-key (kbd "") 'cycle-font)

This is for Windows Vista machine. Press a button it'll cycle among 3 fonts. Mostly for the purpose of switching between mono-width courier and variable-width lucida.

The Code2000 is there just for the occation of viewing some unicode. Code2000 is so bad that it renders ascii dash/hyphen as invisible if the font size is not huge.

Code2000 is not part of Windows Vista. You have to downloaded it, i wouldn't recommend it, just that i happened to already did and that seems to be the font containing the most unicode

the elisp dealing is also painful, or, much less than ideal. Here's a outline of my problem.

So, Drew showed me this

(set-frame-parameter nil 'font "-*-Courier New-normal-r-*-*-14-112-96-96-c-*-iso8859-1")

which is great. So, i wanted Lucida. So, logically, i replaced the courier name to lucida like this:

(set-frame-parameter nil 'font "-*-Lucida Sans Unicode-normal-r-*-*-14-112-96-96-c-*-iso8859-1")

but emacs spits out error. I didn't know what those 112, 96, 96 are, so i figured i replace them with asterisk. Tried a few variations, no go. After a while, i found this works:

(set-frame-parameter nil 'font "Lucida Sans Unicode")
(set-frame-parameter nil 'font "courier new")
(set-frame-parameter nil 'font "Fixedsys")
(set-frame-parameter nil 'font "FixedsysTTF")

but i do need to set size because the size spec is not equivalent among fonts. e.g. One font at size 14 will be too large/small for another font at 14.

So i need something like.:

(set-frame-parameter nil 'font "Lucida Sans Unicode" 'size 12)

after looking up some inline doc or elisp doc in few min, i can't find out what's the available parms for set-frame-parameter. But i did find this function:


which gives out all the params/value pairs in a frame. So, after a while finding no easier way, i went thru the rather tedious process of using the menu to set a font, then run the frame-parameters and get the value of the font. So, i get the right font string spec for the fonts i want. e.g.

"-*-Courier New-normal-r-*-*-13-112-96-96-c-*-iso8859-1"
"-outline-Lucida Sans Unicode-normal-normal-normal-sans-13-*-*-*-p-*-iso8859-1"

btw, in my haphazard notes i found font-spec, e.g..

(font-spec :family "Unicode Symbols" :size 24)

which turns out not useful here.

now i got cycle-font, next job when i have time would be setting monospaced font whenever dired is opened or calendar (recently someone asked for that, which prob means lots others have the same question)... and also the job of getting all unicode to show...


ok a question. Is there a doc that list all the params of set-frame-parameter?

i've not attempted to read the elisp doc for the frame section or font/faces section in some cover-to-cover manner... well eventually i'll have to do that.

the cycle-font command above can be improved too... not happy with the state cycle code... hackish.

∑ http://xahlee.org/


setting default font for emacs

On Aug 25, 7:11 pm, Tom Roche wrote:
> summary:
> I'm running an emacs-23 and am wanting to set my default font for
> every frame in init.el. How to do so properly?
> ...

yeah, there's a better way.

pull the menu “Options‣Set Default Font”. Choose a font. Then pull “Options‣Save Options”. That should do it. However, on Windows, i noticed there's a bug that doesn't save the font. A work around is that, once you did the above, then type M-x customize. Then randomly choose something to customize. Then press Save for Future Sessions. That should save the font you've choosen. In particular, you should add something like the following in your emacs init file:

;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "honeydew" :foreground "SystemWindowText" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "outline" :family "Lucida Sans Unicode"))))
'(completions-common-part ((t (:inherit default :foreground "red"))))
'(pp^L-highlight ((((type x w32 mac graphic) (class color)) (:underline "maroon"))))
'(show-paren-match ((((class color) (background light)) (:background "azure2")))))

I am also interested in the raw elisp code to save the font or other face related things, without the custom-set-faces.

Given a (custome-set-faces ...) code, how do i pull things out and create the equivalent elisp code? setq certainly won't work.

∑ http://xahlee.org/

emacs lisp data structure

On Aug 25, 7:22 am, Dirk80 wrote:
> Hi,
> sorry for this beginner question. But I'm very interested how you would
> represent the data structure of my example in elisp.
> Here my example:
> I want to implement a vocabulary trainer in elisp.
> I have units. A unit is consisting of lessons and lessons are consistng of
> sublessons. One sublesson is consisting of vocabularies. A vocabulary is
> consisting of an audio-file, picture file and a text.
> Here how I would do it in C:
> struct Vocabulary
> {
> char audio_file[255];
> char picture_file[255];
> char text[1000];
> };
> struct SubLesson
> {
> int nb_vocabularies;
> struct Vocabulary[1000];
> };
> struct Lesson
> {
> int nb_sub_lessons;
> struct SubLesson sub_lessons[10];
> };
> struct Unit
> {
> int nb_lessons;
> struct Lesson lessons[10];
> };
> struct UnitList
> {
> int nb_units;
> struct Unit units[8];
> };
> e.g. Unit 4, Lesson 7, Sublesson 2, Vocabulary 1, audio-file
> struct UnitList unit_list;
> unit_list.units[3].lessons[6].sub_lessons[1].vocabulary[0].audio_file =
> "hello.wav";
> Now to the details of using. Because I think this is important in elisp
> because of performance.
> This "UnitList" shall be initialised with content. During runtime it will
> never be changed.
> Thank you a lot in advance for your help
> Dirk

emacs lisp, pretty much like other scripting lang, has variously called arrays, lists, hash tables, ... etc., and the types be nested rather flexibly.

Specifically, emacs lisp has it its terminology: arrays, lists, associative lists, and hash tables. Their difference is primarily their algorithmic acess properties.

Arrays are written as e.g. “[3 "a", 8, 7, "something"]”, and it is fast to access random elements, but very slow to add or delete elements.

Lists are written as e.g. “(list 3 7 9 "some")” or “'(3 7 9 "some")”, underneath they are cons cells like this: (cons 3 (cons 7 (cons 9 (cons "some" nil)))).
Lists are fast to prepend, but slow if you need random access to elements in middle.

Associative lists are pretty much a list of cons pairs. Extra difference is that you have easy interface with key and value structure. You can query a data, query a value, get all keys, get all values etc.

Hash is interface wise just list of pairs, but implemnted in a different way (not as lists or cons), so that it's extremely fast to query any element. Typically used for largish pairs. (say, thousands) There is no syntax to build hash directly. You have to build them element by element. (this is a common complaint and a problem of lisp)

So, if you want your data structure in memory, you pretty much use a nested mix of one of the above. Exactly how you mix and nest them depends on your app. I suppose if you have data like audio files or large text, your values in your structure will just point to them. e.g. as file paths.

i noticed few years ago there are already a couple or more flash card or dictionary type of apps written in elisp. Might look around.

here's lisp basics:

• Emacs Lisp Basics

• Elisp Lesson: Hash Table

• Sequences Arrays Vectors - GNU Emacs Lisp Reference Manual

• Lists - GNU Emacs Lisp Reference Manual

Here's a criticism of lisp's list problem.

• Fundamental Problems of Lisp

∑ http://xahlee.org/

Windows AutoHotKey: closing the current tab or app

how can i create a hot key, so that, it'll either close a tab if there's a tab in the app, or close the app?

if i do Ctrl+w or Ctrl+F4, that closes tabs in browsers, but if i'm in say Windows Mail, Ctrl+w takes me to newsgroup subscription and Ctrl+F4 does nothing.

basically i want a simple key to close whatever i see, without needing to figure out it is Ctrl+w, Ctrl+F4, or Alt+F4.


Xah ∑ http://xahlee.org/

emacs: deleting dir and all sub dir

On Aug 25, 1:37 am, Alain Muls wrote:
> Hi emacs users
> I installed trashcan.el and this works fine for deleteing files from
> dired, but deleting a directory (recursively) cannot be done. Is there a
> way around?

to delete dir, you need to set a built-in var.

Q: How to delete or copy a entire directory

A: Type “Alt+x customize-variable” then “dired-recursive-deletes”, then click on the Value Menu to make a choice. Then, click “Save for Future Sessions”, then “Finish”. Do the same with variable “dired-recursive-copies”.

;; allow dired to be able to delete or copy a whole dir.
(setq dired-recursive-copies (quote always))
(setq dired-recursive-deletes (quote top))
;; “always” means no asking.
;; “top” means ask once (top = top dir).
;; any other symbol means ask for each dir or subdir.

• File Management with Emacs


if you are running emacs 23, deleting trash is already part of it.

Deleting files in emacs can now be set so that they move to the OS's trash.

; deleting files goes to OS's trash can
(setq delete-by-moving-to-trash t) ; “t” for true, “nil” for false

However, this feature has a few problems. When this is on, your system trash will be filled with tens or hundreds of emacs temp files, such as those “#autosave#” files, “backup~” files, “.emacs.desktop”, “emacs00164”, “server”, etc. Also, when deleting a directory from dired, your system trash will end up with each individual files, instead of just a folder. If the folder has few hundred files, the process will be super slow. This happens at least on Windows emacs.

• New Features in Emacs 23

∑ http://xahlee.org/


getting unicode to show in emacs 23 on Windows

i have this unicode file

when viewed in latest Safari, Google Chrome, Opera, Firefox, on Windows (Vista), all char shows. But many chars don't show in emacs 23 for Windows of the same machine. I tried many fonts... Courier New, Lucida Console, Lucida Sans Unicode... but none shows all as browsers do.

any one got idea how to fix this?

Lucida Sans Unicode shows most, but unfortunately, it's not monospaced font.


∑ http://xahlee.org/


On Aug 25, 8:21 pm, Eli Zaretskii wrote:
> > Date: Tue, 25 Aug 2009 17:38:02 -0500
> > From: "B. T. Raven"
> > Could the glyphs that still show up as boxes (math, industrial,
> > computing, etc.) be made to appear if a fontset is used?
> I think so, but for me they appear without any customizations at all.
> > Why don't the ipa Symbols appear? They are part of Arial Unicode.
> I don't know enough about these issues. I suggest to submit a bug
> report with "M-x report-emacs-bug".

thanks Raven & Eli.

humm... it show for you Eli out of the box. Strange.

i don't have Arial Unicode MS, since it is part of Windows Office and OS X 10.5 both i don't have.

my current choice is Lucida Sans Unicode, which provide the most unicode chars among my choices, but is not monospaced font. Works out well, except dired, and unusable in M-x calendar. The unicode here also lacks a lot, e.g. half of the bottom page's chars won't show
but still is the font that shows the most on my machine.

Code2000 shows almost all the unicode, but the font is so bad... it's not readable.

Fixsys is also very good. Shows more unicode than Lucida Sans Unicode, but the only draw back is that its bitmapped. I just realized there's a Open Sourced TrueType one am going to try. (found from reading Wikipedia)

Courier New and Lucida Console are both very good. monospaced, but they don't show that much unicode except the most basic ones.

am guessing the problem really needs to be solved by some sort of font substitution. Browsers apparantly are all doing it and perfectly on my machine since they show all chars without user needing to set fonts.

i guess in emacs that is fontset? I'm not sure if it is just fontset, or emacs also calls the OS's font api to complete part of the display...

Eli, what version of emacs are you using? are you sure it's straight compile from source without customization?

∑ http://xahlee.org/

Windows AutoHotKey: force single instance

is it possible to creat a key to launch/switch to Google Chrome, but do NOT launch a new instance if it is already running?

i know how to create a key to launch a app, but usually that will just launch a new instance.

one good example of what i want is Windows Mail, or the My Pictures special key on Microsoft keyboards. They just launch one instance, or switch to it, if it is already running.


∑ http://xahlee.org/


• AutoHotKey Basics

emacs lisp function to copy dir and all sub dir?

is there a emacs lisp command to copy a whole dir? like unix's cp -R?

i started to write one:

(defun copy-dir (sourcedir destdir)
"Copy all files from SOURCEDIR to DESTDIR.

The input dir should not end in a slash.
Example usage:

Note: no consideration is taken about links, alias, or file perms."
(lambda (x)
(let ()
(when (and (not (string-equal x ".")) (not (string-equal x "..")))
(concat sourcedir "/" x) destdir) ) ) )
(directory-files sourcedir) ) )

but it is hackish because of the checking with “.” and “..”,
but also realized this doesn't do sub dirs. In order to do subdir, it'll might end up with few hours more...

so, am wondering if there's a pre-made solutions?


∑ http://xahlee.org/

On Aug 26, 5:32 am, Michael Heerdegen wrote:
> Have a look at the doc of `dired-recursive-copies'.

sorry all, but a bit clarification.

i needed a copy-dir function for elisp coding, not as user function in dired.

i haven't thought about looking into how dired-do-copy implement it, good thought. thanks.

looking into it, it seems a bit complex:

(defun dired-do-copy (&optional arg)
"Copy all marked (or next ARG) files, or copy the current file.
This normally preserves the last-modified date when copying.
When operating on just the current file, you specify the new name.
When operating on multiple or marked files, you specify a directory,
and new copies of these files are made in that directory
with the same names that the files currently have. The default
suggested for the target directory depends on the value of
`dired-dwim-target', which see.

This command copies symbolic links by creating new ones,
like `cp -d'."
(interactive "P")
(let ((dired-recursive-copies dired-recursive-copies))
(dired-do-create-files 'copy (function dired-copy-file)
arg dired-keep-marker-copy
nil dired-copy-how-to-fn)))

is this the only way?

i think most modern scripting lang has a copy dir function... that'd be good in elisp.



for solution, see:

• Emacs Lisp Suggestion: A Function For Copying and Deleting Whole Dir


emacs: make next word first letter cap then delete space

On Aug 22, 8:46 am, Harry Putnam wrote:
> I need to do a pile of editing that involves:
> Removing a space between words and upcasing the first letter of the
> next word like:
> Some example
> to
> SomeExample
> I went thru M-x apropos
> But didn't find a likely candidate ... or at least none appeared to be
> the right thing for what I want.
> So far I've been
> Ctrl To get to the space between words
> Ctrl-d Ctrl-d To remove the space and the leading lowercase char of
> the next word
> Shift to replace with uppercase
> Then back to Ctrl
> Where can I save some keyboard strokes?

you can easily do it with query-replace-regexp.

the regexp you should use is:

“ \([[:lower:]]\)”

and the replacement is

“\,(upcase \1)”

some detail here:

• Text Pattern Matching in Emacs

• Find and Replace with Emacs

∑ http://xahlee.org/

search word under cursor in emacs

On Aug 22, 4:07 am, lichtkind wrote:
> Hello,
> I have marked a string. Now I want to search for this string in the
> whole text. I know that I can search with C-R or C-S. and type in the
> searchstring. I'm looking for a way, that the marked string is
> automatic the searchstring. This should also work for the other
> search/ search and replace types.

if u are using emacs 22, then you can do this:

“Ctrl+s Ctrl+w”. This will search the current word, but you must move your cursor to the beginning of the word first.

In emacs 23, the above is deprecated. Basically, now you start it with M-s as prefix, then press some other key. It's rather complex and very not intuitive. I have 10 years of using emacs, but i did spent some 5 or 10 min reading the release notes... but i haven't figured it out.

You can, type M-s then C-h, to get a list of shortcuts that has M-s as start. You can read their command names there.

here's the output:

Global Bindings Starting With M-s:
key binding
--- -------

M-s h Prefix Command
M-s o occur
M-s w isearch-forward-word

M-s h f hi-lock-find-patterns
M-s h l highlight-lines-matching-regexp
M-s h p highlight-phrase
M-s h r highlight-regexp
M-s h u unhighlight-regexp
M-s h w hi-lock-write-interactive-patterns

ok, i just gave another try with M-s w. Spent another 2 min on this. Dunno what the fuck it is going.

someday i'll give a hour or two on this, maybe then i'll know the answer.

∑ http://xahlee.org/


where's emacs cheatsheet?

On Aug 21, 11:44 am, Ricardo Bánffy wrote:
> Hi folks.
> I am currently working (leisurely, for sure) on a cheatsheet for new
> Emacs users. It currently exists as a mind-map but will eventually
> become a freely available PDF more or less like the "navigational" one
> there is for git you can download athttp://zrusin.blogspot.com/2007/09/git-cheat-sheet.html
> The current version is linked onhttp://www.dieblinkenlights.com/blog_en/an-emacs-cheatsheet-as-a-mindmap.
> Thanks. Any comments, from newbies and veterans alike, will be
> appreciated.

be sure to consult existing work.

emacs comes with a bunch of cheatsheets in tex and pdf. Look in: e.g.

c:/Program Files (x86)/Emacs/emacs/etc/refcards

∑ http://xahlee.org/

emacs: code to cycle buffer & skip emacs internal ones

On Aug 21, 5:31 pm, Chris Seberino wrote:
> When I cycle through buffers, I'd like to skip *scratch*, *Messages*
> and *Whitespace Errors* buffers.
> I wrote following code to skip one more buffer if I'm sitting in
> either of those 3.
> However, it never matches those buffers. Why not?
> (BTW, the (end-kbd-macro) is just a dummy function since "if" needs an
> "else" command.
> Is there a better dummy command I can add there?)
> ; Sets F10 to execute a function that moves to another buffer.
> (global-set-key [f10] (lambda () (interactive)
> (next-buffer)
> (if (equal (current-buffer)
> "*scratch*")
> (next-buffer)
> (end-kbd-macro))
> (if (equal (current-buffer)
> "*Messages*")
> (next-buffer)
> (end-kbd-macro))
> (if (equal (current-buffer)
> "*Whitespace Errors*")
> (next-buffer)
> (end-kbd-macro))))

Wee, the code to skip emacs buffers is in ergoemacs here:

by default it's Ctrl + Page up/down is the shortcut, similar to Firefox et al for switching tabs.
With shift key down, it cycle among emacs's buffers.

here's the relevant code:

(defun next-user-buffer ()
"Switch to the next user buffer.
User buffers are those whose name does not start with *."
(let ((i 0))
(while (and (string-match "^*" (buffer-name)) (< i 50))
(setq i (1+ i)) (next-buffer) )))

∑ http://xahlee.org/

try upgrade ergoemacs keybinding

On Aug 21, 9:56 am, Benjamin Andresen wrote:
> Xah Lee writes:
> > On Aug 20, 10:50 pm, Torben Knudsen wrote:
> [snip]
> >> I use something similar. My idea is to stay close to original emacs
> >> bindings but to avoid to many key strokes.
> >> ;;; Window splitting
> >> (global-set-key (kbd "M-3") 'split-window-horizontally) ; was digit-argument
> >> (global-set-key (kbd "M-2") 'split-window-vertically) ; was digit-argument
> >> (global-set-key (kbd "M-1") 'delete-other-windows) ; was digit-argument
> >> (global-set-key (kbd "M-0") 'delete-window) ; was digit-argument
> >> (global-set-key (kbd "M-o") 'other-window) ; was prefix
> >> ;; Remove locale key binding of M-o in dired
> >> (add-hook 'dired-mode-hook 'my-dired-mode-hook)
> >> (defun my-dired-mode-hook ()
> >> (define-key dired-mode-map (kbd "M-o") nil)) ; was dired-omit-mode
> > umm.. that code looks like from
> >http://code.google.com/p/ergoemacs/
> It doesn't. None of these lines appear as they are in ergoemacs.

look at old versions. Go to code.google.com, download tab, then in the search, choose All Downloads. That will show older versions.

i noticed in many if not most tech geeker's projects hosted on google code, they don't bother to mark older version as deprecated. So, their download pages shows ALL the past versions. It kinda makes the page full and glorious, and shows the download numbers. But i think its silly and unhelpful...


tab key abused in emacs

On Aug 20, 9:08 am, "Farhan Ahmed" wrote:
> FWIW, I've mapped shift+TAB to 'next buffer and C+shift+TAB to 'previous
> buffer and now I only use one window to edit code. Takes a little getting
> used to, but it works.

using Tab is probably worst, because every mode vie for that key.

in just about all modes, tab does indentation.

ysnippet also uses tabs.

org mode uses tabs.

in minibuffer and elsewhere, it's also used for completion.

not recommended to pile on such a key. Also, i noticed, tab key is not actually a good key. Need to take care of your pinkies.

∑ http://xahlee.org/


easy way to switch panes in emacs

On Aug 20, 1:58 am, Tamas K Papp wrote:
> Hi,
> I have seen screenshots of Emacs running with many buffers. For
> example, having Emacs on the whole screen and splitting the buffers
> like this:
> A|B
> -+-
> C|D
> I know how to do the splitting, but I am curious about what people use
> to move around. Using C-x o (other-window) is a pain with many
> windows, same applies to selecting buffers by name (at least for me),
> and I want to avoid using the mouse for this. I am thinking of
> something like "move to buffer B, regardless of what is there".
> I am interested in how other people handle these setups. .emacs
> snippets are welcome, too. Also, feel free to tell me if I am
> trying to do something silly that does not mesh well with Emacs.

I reassign it so the key is right on the home row and using thumb instead of pinky.

after a year or two, this eventually became a system of keybinding.

then, later i added a shifted version to go into the other direction.

typically, this works well for 2 or 3 split panes. But for 4 or more, mouse is probably best.
I almost don't use more than 2 split planes. If needed, i open another window (emacs frame), then there's another easy shortcut to cycle among windows.

you might as well define another easy key to easily split and unsplit the panes.

Here's snippet of code, assuming you use dvorak keyboard:

(global-set-key (kbd "M-o") 'move-cursor-next-pane)
(global-set-key (kbd "M-O") 'move-cursor-previous-pane)

(global-set-key (kbd "M-2") 'split-window-vertically)
(global-set-key (kbd "M-@") 'split-window-horizontally)

(global-set-key (kbd "M-1") 'delete-other-windows)
(global-set-key (kbd "M-!") 'delete-window)

∑ http://xahlee.org/


which keys can user define in emacs?

On Aug 18, 5:58 pm, "Mark" wrote:
> Hello
> by default key-bindings for tags operations (find tag, find next tag etc.)
> are quite twisted and hard to remember, comparing to vim' default keys. Is
> there any other way to define more 'easy-to-use' bindings? I know I can
> re-define any key, but as I know not every key sequence is permitted to be
> used by end-user and those that are, are not very "handy" involving F1-F10
> keys or the like. Especially I'd love to have opportunity when find a tag,
> to open a file containing the tag in a new window (similar to Ctrl-W Ctrl-]
> in vim).
> So how do people deal with default tags options while editing for example
> C/C++ code? Can you please share your key-bindings for these cases, if I
> find them comfortable to use I'd be more happy with Emacs :)

well i use ergoemacs.

perhaps give it a try?

of course you can define any key. And yes most “Ctrl+‹key›” and “Alt+‹key›” spaces are already used. This is partly why emacs has a convention where “Ctrl+c ‹letter›” space is for users. If you do not wish to step over emacs keys or official convention, then “Ctrl+c ‹letter›” and F5 to F9 is pretty much the only one you can use.

However, if you look carefully, you'll see there are probably quite a few spots in “Ctrl+‹key›” and “Alt+‹key›” spaces that are bound to commands you never use. Might want to steal it then.

This might be helpful

• Emacs's Keybinding Layout

∑ http://xahlee.org/

how to prevent emacs losing unsafed un-file buffers when quit

On Aug 19, 5:22 pm, YOUNG wrote:
> Hi,
> If a buffer does not connect to a file but it is modified, if you type
> c-x c, emacs just quits and losts the data.
> Is there a way to protect of it?

I don't think there's a default way. This is one of the problem that pains me.

But if you use ergoemacs

it's fixed there.


On Aug 19, 7:09 pm, Xah Lee wrote:
> On Aug 19, 5:22 pm, YOUNG wrote:
> > Hi,
> > If a buffer does not connect to a file but it is modified, if you type
> > c-x c, emacs just quits and losts the data.
> > Is there a way to protect of it?
> I don't think there's a default way. This is one of the problem that
> pains me.
> But if you use ergoemacshttp://code.google.com/p/ergoemacs/
> it's fixed there.

O, just tried to reproduce your situation but there's a bit warning.

When you use ergoemacs, you can create buffers by Ctrl+n, which calls new-empty-buffer. Then, in this buffer, if modified and not saved, when you try to close it or quit emacs, emacs will prompt you to save it.

However, it does not fix when if you just use switch-to-buffer (C-x b) command to create a new buffer.

Here's the relevant source code. Note the line
(setq buffer-offer-save t).
Feel free to use it.

(defun new-empty-buffer ()
"Opens a new empty buffer."
(let ((buf (generate-new-buffer "untitled")))
(switch-to-buffer buf)
(funcall (and initial-major-mode))
(setq buffer-offer-save t)))
;; note: emacs won't offer to save a buffer that's
;; not associated with a file,
;; even if buffer-modified-p is true.
;; One work around is to define your own my-kill-buffer function
;; that wraps around kill-buffer, and check on the buffer modification
;; status to offer save
;; This custome kill buffer is close-current-buffer.

∑ http://xahlee.org/


emacs cult

> Please do not slag off a project if you want people to help;
> it tends to put the goat up.

a healthy community needs both positive comment as well as negative to grow.

emacs's user base has been rotting off from i estimate more than 50% of programers to less that 1% today.

the particular observation about info doc in this thread is a specific example.

You can help FSF and emacs to improve, by, for example, trying to help it to evolve with the rapidly changing computing industry, In this case, document formats, provided if you see some of my points as valid. Or, at least consider this eroding awareness of the gnu info format among average programers worth discussing. No disrespect to you, but dismissing it as “troll” or similiar sentiment is not helpful.

emacs community is too much cult and pride. FSF and its product the GNU was highly successful in the 1980 and 1990s, with its gcc, emacs, and slew of gnu version of unix tools. A significant part of the reason is because these products at the time is truely better products in comparison to existing ones, that there are almost no substitute. Today, for many variety and complexity of reasons, almost none of this is true, except possiblly a few such as gcc and GPG. The unix shells ways and sed, awk, etc tools has largely been replaced by perl, python, ruby etc, partly due to the changing nature of computing. For GCC itself, and make, yacc, bison etc there are tens of competiting products either commercial or open source. Then there's Java, with its entire suite of tools and libs, and there are tens of truely quality languages out there today other then the ones that GCC can handle.

emacs 23, although is fantastic to us emacs fans, but if you look carefully at its feature list, most of it is widely in commericial software about 10 years ago.

∑ http://xahlee.org/

On Aug 17, 4:32 am, "Colin S. Miller" wrote:
> Xah Lee wrote:
> > btw, is there still info format for python doc?
> > i feel kinda sad that emacs info format has pretty much been
> > deprecated over the past decade. About a decade ago, you still will
> > see now and then people asking for emacs info format of docs (was the
> > days of perl). Today, one don't hear of it.
> > Part of this is due to emacs cult problem. See:
> Xah,
> Please do not slag off a project if you want people to help;
> it tends to put the goat up.
> It is not "Emacs Info" format, it is FSF Info format.
> There is a stand-alone program to read the Info documentation.
> The program is called "info".
> Ubuntu maintains a package search site, it is onhttp://packages.ubuntu.com/
> However, there seems to be no files named
> python.*info (regexp)
> There is a
> python-docutils package
> which does contain information in several
> other formats.
> This package can be found either via the above site
> or using "apt-cache search python-doc".
> As "info" is a FSF format, all FSF produced programs
> will provide documentation in this format. However Python
> is not under the auspices of the FSF, so does not need to use
> this format.
> BTW,
> HTML versions of INFO documentation can be generated by
> info2html or info_to_html on them, or texi2html on the source.
> Have a nice day,
> Colin S. Miller

Basic Economics

On Aug 17, 12:00 am, Byung-Hee HWANG wrote:
> X11 supports UTF-8 stuff very well, i think. Currently, Emacs also good
> to UTF-8.

But my question is, if you would answer: is your screenshot from emacs 23 out of the box, or did you have some emacs customization such as choosing font? In particular, if you did have some customization, did you simpy pull the Options, Set Default Font, or is it more complicated, such as creating a emacs concept of fontset, or download some font on the net, etc?

> However, i don't know about MacOS. Please Let me pay my small
> adivce and respect for you. Yes, you need to switch from MacOS to free
> operating system (e.g., GNU/Linux or BSD).


Thank you for the suggestion.

May i suggest you one thing?

Basic Economics, by Thomas Sowell.


Recently i have discovered that this book has been pirated, and i have little doubt, by Open Source or Free Software proponents. I noticed, there's a audio version on the net.

∑ http://xahlee.org/


how to have blogger automatically make url into links?

How do i have blogger automatically make url into a link?

i know about using the wysiwyg editor and html format... but on this particular blog i'm posting plain text, and i'd prefer blogger automatically make my url into links. (but not doing that on comments)


∑ http://xahlee.org/

emacs info format for python/perl/php/ruby docs?

btw, is there still info format for python doc?

i feel kinda sad that emacs info format has pretty much been deprecated over the past decade. About a decade ago, you still will see now and then people asking for emacs info format of docs (was the days of perl). Today, one don't hear of it.

Part of this is due to emacs cult problem. See:

• Emacs Modernization

• Emacs Should Adopt HTML To Replace Texinfo

• Language, Purity, Cult, and Deception

∑ http://xahlee.org/

On Dec 11 2008, 6:56 am, Matthias wrote:
> Xah Lee writes:
> > in programing elisp in emacs, i can press “Ctrl+h f” to lookup
> > the doc for the function under cursor. is there such facility
> > when coding in perl, python, php?
> Yes, try C-h S (or similarly S):
> (info-lookup-symbol SYMBOL &optional MODE) Display the
> definition of SYMBOL, as found in the relevant manual. When this
> command is called interactively, it reads SYMBOL from the
> minibuffer.
> Note that `the relevant manual' means an info file. With recent
> emacsen on an Ubuntu distro, python arrives with info files and
> everything is well configured. It also works with bash, latex, perl,
> scheme, elisp, awk, texinfo, makefile, libc, or any info file with an
> index.
> --
> Matthias


I noticed that Matthias actually mentioned that info docs is available and bundled out of the box on Ubuntu linux for many popular langs, as of 2008-12.

Is that true? Where can i download these info files? As far as i know, a little google search or official doc sites usually don't have a download for info format.

I'm interested in getting current version doc for perl, python, php, and ruby.


∑ http://xahlee.org/

social problems of python doc


Thanks Raymond.

I've been out of python community for a couple of years. I've saved your messages and will study it later when next time i work in python. Possibly today and will reply in some of your points.

But just wanted to say thanks for improving python.

Also, sometimes ago out of the blue i noticed someone has posted a bug on python's gzip doc with acknowledgement. http://bugs.python.org/issue2406

Thank you M.-A. DARCHE (madarche).

Also, i noticed python doc now and later has improved a lot since last i looked around python 2.4. For one thing, the html/xhtml is now valid html. Good riddence of the fucking TeX. Also, code examples have syntax coloring on.

∑ http://xahlee.org/


On Aug 12, 12:15 pm, Raymond Hettinger wrote:
[Xah Lee]

> i've wrote several articles about this issue, total time spend on this
> is probably more than 2 months full-time work. See:

> • Python Documentation Problems
> http://xahlee.org/perl-python/python_doc_index.html

I just read you post. You did devote a substantial amount of time
to the project. Some of your criticisms are valid. Wish you had
posted patches, I think many of them would have been accepted.

Since you wrote this a few years ago, many examples have
been added to the docs and more are forthcoming.

> I often receive thank you emails for 2 particular articles, which are
> most frequently google searched as indicated by my weblog:

> • Python Doc Problem Example: gzip
> http://xahlee.org/perl-python/python_doc_gzip.html

> • Python Doc Problem Example: sort()
> http://xahlee.org/perl-python/python_doc_sort.html

> • Sorting in Python and Perl
> http://xahlee.org/perl-python/sort_list.html

Some are the criticisms are valid; others seem off-base.

Here are a few thoughts on list.sort() for those who are interested:

* The key= and reversed= parameters are not intended for special
cases, leaving cmp= for the general case. They were intended to
be full replacements. In Python3.x, the cmp function is gone.

* The interaction of the key= and cmp= functions can be made to
interact (the key function is first applied to every element and
the cmp function then gets applied to the results of the key
function). This isn't a normal or intended use case, so the docs
don't delve into the subject.

* The reversed parameter does more than list.sort() followed by
list.reverse(). It also preserves stability in the event of equal

>>> sorted([(1,2), (1,3)], key=itemgetter(0), reverse=True)
[(1,2), (1,3)]

So it was not correct to say that the following are equivalent:

li.sort(lambda x, y: cmp(x[1],y[1]), reverse=True)
li.sort(lambda x, y: cmp(y[1],x[1]))

* We should link the sorted() and list.sort() docs to the
sorting how-to (with a fuller discussion on the art of sorting
including a discussion of operator.itemgetter() and
operator.attrgetter() which were designed to work with the key=


Here are a few thoughts on list.sort() for those who are interested:

After one more reading of Xah Lee's posts on the documentation for
here are couple more thoughts:

* The reason that list.sort() allows None for the cmp parameter is not
so that you can write list.sort(None). It was put there to make it
easier for people writing function definitions where the cmp function
is a possible argument:

def sort_and_chop(seq, maxlen, cmp=None):
s = seq[:]
s.sort(cmp) # needs to accept None as a possible
return s[:maxlen]

* The reason for implementing the key= parameter had nothing to do
with limitations of Python's compiler. Instead, it was inspired by
decorate-sort-undecorate pattern.


Hi Raymond,

thanks for the many points. They are informative, some i disagree, but it's getting into detail. I don't know python 3.0, will have to look into its sort in the future.

This part i don't particular agree:

> * The reason for implementing the key= parameter had nothing to do
> with limitations of Python's compiler. Instead, it was inspired by
> the
> decorate-sort-undecorate pattern.

The decorate-sort-undecorate pattern is a compiler limitation, for most of today's langs. I'm not sure, but i think some of the fancy functional langs automatically detect such and optimize it away, to various degrees.

... my criticism is usually written in a style catered to irritate a particular class of coder i call tech geekers (they think of themselfs with their idiotic term “hackers”). So, parts are exaggerated. It'd be more clear to say, that the reason for python's “key”, and as a “solution” or need of the decorate-sort-undecorate issue, can be attributed to the current state of the art of popular imperative language's compilers (induced by such lang's semantics).

again, i haven't studied python 3.0 to see what it has changed with sort, and thanks for the informative post. I find it intriguing that it doesn't have “cmp” anymore as you say.... maybe when i actually study it and i'll come away with rage and rants. LOL.

∑ http://xahlee.org/


The importance of syntax & notations.

Xah's Edu Corner: The importance of syntax & notations.


this article should teach the coding sophomorons and computer “science” idiotic authors who harbor the notion that syntax is not important, picked up by all the elite i-reddit & twittering & hacker news am-hip dunces.

Further readings:

• The TeX Pestilence

• A Notation for Plane Geometry

• The Concepts and Confusions of Prefix, Infix, Postfix and Fully Nested Notations

• The Problems of Traditional Math Notation

∑ http://xahlee.org/

> Could you elaborate on why dx/dy is no good? Have you written something on it?


not sure why it is not clear... there are so many problems.

a/b means a divided by b, or, a times the multiplicative inverse of b.

but, obviously, dx/dx does not mean a variable divided by another variable.

in another interpretation, dx can be thought of as a unary operator d(x). However, that does not make any sense. But suppose there is some sense, then d(x)/d(y) does not make sense, since it is not a division as before.

the notion of dx and dy as Infinitesimal has a logical foundation

however, even with that, i doubt the dx/dy notation is good on any math notation as computer language background.

See the links on Functional Math and formal math at middle of:


Thanks for writing.

∑ http://xahlee.org/

upon a more detailed reading of Stephen's article, i discovered some errors.

On this page:

he mentions the Plimpton 322 tablet. It is widely taught in math history books, that this table is pythagorean triples.

On reading his article, i wanted to refresh my understanding of the subject, so i looked up Wikipedia:

and behold!

apparantly, in recent academic publications, it is suggested that this is not pythagorean triples, but rather: “a list of regular reciprocal pairs”.

∑ http://xahlee.org/

unicode rendering on Carbon Emacs 22 vs Mac Emacs 23.

unicode rendering on Carbon Emacs 22 vs Mac Emacs 23.


any conclusion from this?

PS since my mac and OS is few years old, both Carbon Emacs and Aquamacs Emacs has dropped support for about over a year, so i haven't tested their latest. Is current version Carbon Emacs or Aquamacs actually run on cocoa code base from emacs 23?

could anyone download this file
and show screenshot in their current Carbon/Aquamacs Emacs?


∑ http://xahlee.org/

On Aug 16, 3:03 pm, Byung-Hee HWANG wrote:
> Xah, i have no MacOS. Just i tested on my desktop, FreeBSD.
> http://izb.knu.ac.kr/~bh/stuff/unicode-test-xah-emacs23-20090817001.png
> It works well for me. Thanks!

Hi Hwang, thanks. Looks like you have a pretty good setup. Am rather surprised that it happens on BSD. Btw, is that emacs 23 out of the box or do you have to do some setup such as picking a font in emacs/X11?

∑ http://xahlee.org/

emacs 23 loads sgml-mode instead of nxml for .xml files?

on my Windows emacs, when i open a xml file, seems the default mode loaded is sgml-mode, not nxml?

is this a bug or intentional?

GNU Emacs (i386-mingw-nt6.0.6002) of 2009-06-30 on LENNART-69DE564 (patched)

Reproducible with emacs -Q using FSF's official emacs for Windows binary too.

∑ http://xahlee.org/

unicode char palette in emacs?

has anyone developed a command that calls up a unicode table? that is, similar to Mac OS's Character Palette or Windows's charmap.exe?

The purpose being that user can visually lookup unicode glyphs by category, and pick out the one she wants. This categorization can either be unicode defined subranges (charmap has done), or more arbitrarily defined categories that groups symbols commonly used by particular field (e.g. math, arrows, medicine, printer's symbols, phonetics, letter like, musical... (as done by Mac OS X)).




emacs upcase downcase commands problems

On Fri, Aug 14, 2009 at 8:26 AM, Stefan Monnier wrote:

the code i've been using cycle the case of the first letter, on current word, or region if there's one.

here's the code i've been using for about 2 years.
Andreas Politz and Nikolaj Schumacher had helped in the code.

(defun toggle-letter-case ()
"Toggle the letter case of current word or text selection.
Toggles from 3 cases: UPPER CASE, lower case, Title Case,
in that cyclic order."
(let (pos1 pos2 (deactivate-mark nil) (case-fold-search nil))
(if (and transient-mark-mode mark-active)
(setq pos1 (region-beginning)
pos2 (region-end))
(setq pos1 (car (bounds-of-thing-at-point 'word))
pos2 (cdr (bounds-of-thing-at-point 'word))))

(when (not (eq last-command this-command))
(goto-char pos1)
((looking-at "[[:lower:]][[:lower:]]") (put this-command 'state "all lower"))
((looking-at "[[:upper:]][[:upper:]]") (put this-command 'state "all caps") )
((looking-at "[[:upper:]][[:lower:]]") (put this-command 'state "init caps") )
(t (put this-command 'state "all lower") )

((string= "all lower" (get this-command 'state))
(upcase-initials-region pos1 pos2) (put this-command 'state "init caps"))
((string= "init caps" (get this-command 'state))
(upcase-region pos1 pos2) (put this-command 'state "all caps"))
((string= "all caps" (get this-command 'state))
(downcase-region pos1 pos2) (put this-command 'state "all lower"))

some logic on why i find this useful i wrote about here:


setting font in emacs 23 won't stick

in emacs 23 on Windows, if i choose menu Options, Set Default Fonts, then choose say Lucida Sans Unicode, then i choose Options, Save Options, then emacs will show

Saving file c:/Users/xah/.emacs...
Wrote c:/Users/xah/.emacs

However, the .emacs file shows nothing about setting a font. Upon restart, emacs revert to whatever font it was using.

Is this a bug? How to set it permanently?

This is GNU Emacs (i386-mingw-nt6.0.6002) of 2009-06-30 on LENNART-69DE564 (patched)

Same behavior with emacs -Q on FSF distributed emacs for Windows binary.
Same happens with emacs 23 compiled on the Mac.

∑ http://xahlee.org/


haven't looked into detail, but it appears if you run customize-group
on something, and click Save For Future Sessions, then the font do get
saved. (i happened to be using customize-group on whitespace-mode, and
noticed afterwards that i had font in my .emacs's custom-set-faces.


proper way to determine emacs version

what's the proper way to determine emacs version?

i use this code:

(if (string= (substring-no-properties emacs-version 0 2) "23" )
; is 23
; not 23

is there more robust way?


∑ http://xahlee.org/

Thanks to Teemu Likonen.

Variables emacs-major-version and emacs-minor-version..

but more properly, check on the function with fboundp.

emacs: combining just-one-space n delete-blank-lines

Deniz Dogan wrote:
; have long wanted to change the behavior of just-one-space to not
; only delete spaces and tab characters, but newline characters as well.
; Attached is the patch for this change.

; I don't think that this is such a controversial modification and I
; believe very few user macros will break. If I'm wrong, let me know!

i share this view.

though, in my experiment, i find that there are often situations where shrinking all whitespaces including EOL is not convenient. Here's a example:

for couple in findreplace:
c numRep += s.count(couple[0])

where the c is the cursor point.
If you shrink all whitespaces including EOL, then the current line becomes joined with previous line.

what i find more ideal is this:

when the current line contain non-whitespace chars, then shrink just spaces and tabs, but if the current line does not contain non-whitespace chars (it's all white space), then shrink all all spaces, tab, EOL.

the code i've been using is this:

(defun shrink-whitespaces ()
"Remove white spaces around cursor to just one or none.
If current line contains non-white space chars, then shrink any whitespace char surrounding cursor to just one space.
If current line does not contain non-white space chars, then remove blank lines to just one."
(let (
line-has-meat-p ; current line contains non-white space chars
whitespace-begin whitespace-end
space-or-tab-begin space-or-tab-end
line-begin-pos line-end-pos
;; todo: might consider whitespace as defined by syntax table, and also consider whitespace chars in unicode if syntax table doesn't already considered it.
(setq cursor-point (point))

(setq spaceTabNeighbor-p (if (or (looking-at " \\|\t") (looking-back " \\|\t")) t nil) )
(move-beginning-of-line 1) (setq line-begin-pos (point) )
(move-end-of-line 1) (setq line-end-pos (point) )
;; (re-search-backward "\n$") (setq line-begin-pos (point) )
;; (re-search-forward "\n$") (setq line-end-pos (point) )
(setq line-has-meat-p (if (< 0 (count-matches "[[:graph:]]" line-begin-pos line-end-pos)) t nil) )
(goto-char cursor-point)

(skip-chars-backward "\t ")
(setq space-or-tab-begin (point))

(skip-chars-backward "\t \n")
(setq whitespace-begin (point))

(goto-char cursor-point) (skip-chars-forward "\t ")
(setq space-or-tab-end (point))
(skip-chars-forward "\t \n")
(setq whitespace-end (point))

(if line-has-meat-p
(when spaceTabNeighbor-p
(delete-region space-or-tab-begin space-or-tab-end)
(insert " "))

;; (delete-region whitespace-begin whitespace-end)
;; (insert "\n")
;; todo: possibly code my own delete-blank-lines here for better efficiency, because delete-blank-lines seems complex.


but in general, considering this thread in whole, i share your view with merging just-one-space with delete-blank-lines, and the behavior be depending on context. Something like a shrink-whitespace-dwim.

I feel there are too many small functions on shrinking white spaces, esp those with a shortcut.
e.g. C-x C-o for delete-blank-lines and just-one-space with M-SPC.

i think that these can be merged into a single dwim version with a single shortcut, because i think most of the time context can correctly guess the desired behavior.

i think this applies to few other emacs editing functions for user convenience. One example i came to is about the 9 or so commands on letter case changing. Some work on word, some on region... with transient-mark-mode on now, the region versions could be merged. The lower case and upper case and cap first versions can also be merged, i think, into one dwim version that just cycles.

• Usability Problems With Emacs's Letter-Case Commands



emacs: boolean mess in elisp


gosh, stung by this bug. In my elisp code, i have:

(recentf-mode nil)

this should turn it off, but actually it toggles.
here's a quote of its inline doc:

(recentf-mode &optional arg)
Toggle recentf mode.
With prefix argument arg, turn on if positive, otherwise off.

this is reproduciable in the following:
GNU Emacs 23.1.1 (i386-mingw-nt6.0.6002) of 2009-07-29 on SOFT-MJASON

GNU Emacs (i386-mingw-nt6.0.6002) of 2009-06-30 on LENNART-69DE564 (patched)

∑ http://xahlee.org/


On Aug 11, 9:05 pm, Kevin Rodgers wrote:
> Xah Lee wrote:
> >>> With prefix argument arg, turn on if positive, otherwise off.
> >> It's not clear whether nil is positive or negative.
> It seems clear to me that nil is not positive, so the "otherwise"
> condition holds.
> > Thanks. That's interesting.
> > Can the doc adds a warning like:
> > The argument should be a integer. Do not use t or nil.
> Do not use `supercalifragilisticexpialidocious' either.
> How about: Use nil to toggle the mode on or off.

hi Kevin,

i think that's a bit unreasonable.

the use of 1 and 0 for on and off for minor mode function, is not exactly intuitive, because in elisp, although the lang does not have boolean datatype, but by convention, t is for true, and nil for false, and technically, nil is false, everything else is true.

So, minor modes using 1 and 0 is kinda unclean, un-elegant, or counter intuitive. The reason it does that, is of course due to the fact that emacs commands thru interactive use by convention takes universal-argument, and universal-argument only take integer as arguments, not some string or lisp symbol. So, there's the justification for 1 and 0.

However, in lisp code, it is also reasonable to expect that nil would be equivalent to 0, as by lisp convention. This logic may not look logical to you, but i think is reasonable alternative expectation. When a mode gets its arg thru interactive use, the arg is expected to be integers by the way emacs do things interactively, and thus positive int is considered true or turn on, negative is considered false/off. But in lisp code, besides 1 and 0, you can also specify t and nil as usual by lisp convention. This could easily be considered as a alternative design decision.

(adding to the mess is that some command will change behavior as kinda on/off or true/false depending on whether universal-argument is called regardless of its argument)

all things considered, i think it is reasonable that a average lisp coder will be confused by this. Thus my recommendation that a warning or notes be added to the doc. Is there somewhere in elisp manual that explicitly explains/warns that commands that turn minor mode on/off stick to 1 and 0 and consider t and nil not acceptable argument?

PS i didn't receive your previous email, i just happened to see your reply in google group. I'm not much in the emacs dev community so i'm not regular gnu emacs bug database reader... please cc me too on this. thanks.

∑ http://xahlee.org/


this is documented in emacs lisp manual.
• Minor Mode Conventions - GNU Emacs Lisp Reference Manual

thanks to Drew Adams and others:

where does emacs 23 stores unicode char properties?

in emacs 22, one can put in this unicode data file to emacs so that what-cursor-position with C-u can give full info about a char:

; load unicode data; used by what-cursor-position for showing full unicode info
(setq describe-char-unicodedata-file
(concat (file-name-directory
(or load-file-name buffer-file-name)) "UnicodeData.txt" ))

by looking at the output, it appears to me emacs 23 now has the full info on unicode char without needing that file.

Is that true?

where does emacs get the data that was in UnicodeData.txt?


∑ http://xahlee.org/

concept of margin comes to emacs?

On Aug 12, 4:31 am, Teemu Likonen wrote:
> On 2009-08-12 11:23 (UTC), Vincent Lefevre wrote:
> > Otherwise one can still use the Long Lines mode (longlines-mode, that
> > was already present in Emacs 22), which shows the logical lines in
> > some other way: with a character ("|" in Emacs 22, "¶" in Emacs 23) in
> > a different color at the end of the logical line (but with the
> > longlines mode, the show-trailing-whitespace variable has no effect).
> One can pretty much replace longlines-mode with this:
> (visual-line-mode 1)
> (whitespace-newline-mode 1)
> (setq fill-column 999999)
> This is nicer because longlines-mode is a hack which actually modifies
> the buffer in order to differentiate between hard and soft newlines.
> Emacs 23 has this proper way of doing it.

there's one functionality in longlines-mode that the above does not replace thoguh. Namely, setting up a right margin.

with longlines-mode, the rigth margin is the value of fill-column.

sometimes your window is wide, and you don't want long lines to go from left to all the way to the right. In word processors, you can set a right margin. Similarly, you can go into longlines-mode, and set fill-column to 50 or so.

typically, emacs geeks will say “you can just adjust your window width so your window isn't as wide”. But that solution is not so good, because you do want wide window in general, just not when displaying that particular file. For example, imagine word processors doesn't have the right margin feature, and for every file, they'll need to adjust window size in order to display the lines right.

I hope some concept of ruler/margin can come to emacs.

∑ http://xahlee.org/

parsing expression grammar in emacs

i very much second this! PEG's the next level of regex, and i expect it to replace regex in some sense in the coming years for the whole field of text processing.

there are currently 2 of them in elisp as far as i know:

* http://www.emacswiki.org/cgi-bin/wiki/ParserCompiler (2008) by Mike Mattie.

* http://www.emacswiki.org/emacs/ParsingExpressionGrammars (2008) by Helmut Eller.

it'd be much better if PEG is integrated from the ground up in elisp, possibly implemented in C or from other libs for speed. I imagine functions that takes a regex can have a version with PEG.



outline-mode vs org-mode

On Aug 10, 4:41 am, JackPhil wrote:
> If a heading have subheadings,the subheadings will always be shown. I
> want them to be hidden, not only the body of subheadings. How TO?

On Aug 10, 4:41 am, JackPhil wrote:
> If a heading have subheadings,the subheadings will always be shown. I
> want them to be hidden, not only the body of subheadings. How TO?

type “Alt+x org-mode”, then, type “Shift+Tab” to cycle thru levels of subsection hiding. Or, move cursor to particular heading, type “Tab” to do cycle on that particular level.

∑ http://xahlee.org/

i just learned outline-mode this month, due to reading emacs 23's NEWs file.

in outline mode, type Alt+x describe-mode, and it'll spit out its inline doc. Then you can read all about the shortcuts for hiding header or text etc.


C-c C-n outline-next-visible-heading move by visible headings
C-c C-p outline-previous-visible-heading
C-c C-f outline-forward-same-level similar but skip subheadings
C-c C-b outline-backward-same-level
C-c C-u outline-up-heading move from subheading to heading

C-c C-t make all text invisible (not headings).
C-c C-a make everything in buffer visible.
C-c C-q make only the first N levels of headers visible.

however, the keys are exceedingly complex and their logic cumbersome, especially if you have cua-mode on, or if you also have your own keyboard customizations.

So, i went to emacswiki for some read up.


which gives a very good intro about outline mode.

Then, i found out about outline-magic package by Carsten Dominik, which provides much better shortcuts and commands, so you simply use arrow keys to do various expanding/hiding of the headers, or just press tab to cycle thru the common pattern of toggling thru showing/hiding sub sections.

The name Carsten Dominik sounds familiar, and indeed, he's the author of org-mode, which i never used but did spend some time on in the past to vaguely recall it's outgrowth of outline-mode.

So, i did a hour of study or 2. Basically, my quick conclusion is that org-mode completely supplants outline-mode in features and quality.

just set your mode to org-mode, then just type tab key to hide/show headers or subsections. org-mode is robust and well maintained, so it's good to bet on. :D

you could put:
(defalias 'outline-mode 'org-mode)

hope this helps. :D

∑ http://xahlee.org/

emacs 23's dired-isearch-filenames redundant?

Hi Richard,

On Aug 9, 7:05 pm, Richard Riley wrote:
> Xah Lee writes:
> > in emacs 23's dired, there's
> > dired-isearch-filenames (Alt+s f Ctrl+s)
> > and
> > dired-isearch-filenames-regexp (Alt+s f Ctrl+Alt+s)
> > what's the use for these?
> > user can simply do isearch (Ctrl+s) as usual, no?
> They can, but it might be a pain if the dired display contains words
> in, say, the group or owner fields which match.
> The command only searches filename text.

that seems too much trouble. It's rare that one'd need to search for a file name where the string happens to be in the owner or group or date output from “ls -l”.

A guy Eric informed me of this manual entry:

(info "(emacs) Dired Navigation")

which indicatse that if one puts:

(setq dired-isearch-filenames t)

then C-s will automacially just focus on the file names.
If one puts

(setq dired-isearch-filenames 'dwim)

then C-s it will focus on the file name only if the cursor is at file names column, and on the whole dired text if the cursor is on the other part.

This is fantastic.

Thinking about this, i think it'd be even better, if
(setq dired-isearch-filenames t)
behavior just always assumed.

I'm thinking that it's even better if C-s does what it always does, and completely get rid of dired-isearch-filenames or dired-isearch-filenames-regexp. Because i think these 2 functions are rarely needed, and when user needs to search thru file names only, or with regex, there are lots of ways with grep or variant methods that does it.

... am guessing things are the way it is now because i vaguely recall in emacs dev list in recent months that emacs devers are moving dired-x things into dired... so in a short rush to release emacs 23 (which is great), not full thought has been put into this...

∑ http://xahlee.org/


social problems of python doc

The prob with python docs is with the python priests.

there are frequent posts about python doc's poor quality, and some efforts to improve the doc (such as wiki or seggestions), about few times a year (in so much as i've seen), the typical response is pissing fight, with python priests to tell them not to start another wiki, or “you should apply in our church first and formulate a PEP proposal first or kindly donate or otherwise fuckoff”, and so on.

i've wrote several articles about this issue, total time spend on this is probably more than 2 months full-time work. See:

• Python Documentation Problems

just about each article above generates a thread of flames.

I also have re-wrote the entire python regex doc in 2005:

• Pyhton Regex Documentation: String Pattern Matching

there are some positive reviews, but most are drawn out by nay-sayers.

I often receive thank you emails for 2 particular articles, which are most frequently google searched as indicated by my weblog:

• Python Doc Problem Example: gzip

• Python Doc Problem Example: sort()

• Sorting in Python and Perl

See also:

• Language, Purity, Cult, and Deception

∑ http://xahlee.org/

On Jul 31, 1:10 pm, kj wrote:
> I'm pretty new to Python, and I like a lot overall, but I find the
> documentation for Python rather poor, overall.
> I'm sure that Python experts don't have this problem: they have
> internalized some good ways to access the documentation, are
> productive with it, and therefore have lost the ability to see why
> the Python documentations is deficient for beginners. This explains
> why a suboptimal situation can persist like this: those who are
> most able fix it are also the least able to perceive it.
> I've heard similar complaints from other experienced programmers
> who are trying out Python for the first time: poor documentation.
> Here is an *entirely typical* example: on some Unix, try
> % pydoc urllib
> The displayed documentation mention the optional parameter "data"
> in practically every function listed (a few dozen of them). This
> parameter is not documented *anywhere* on that page. All that we
> are told is that its default value is always None.
> I'm sure that I can find a full description of this parameter if
> I fire up Google, and search online. In fact, more likely than
> not, I'll find far more documentation than I want. But my point
> is that a programmer should not need to do this. The full
> documentation should be readily accessible directly through a few
> keystrokes.
> I would love to know how experienced Python programmers quickly
> zero in on the Python documentation they need.
> TIA!
> kynn


powershell, perl, syntax soup

On Aug 8, 2:04 pm, Robert Uhl wrote:
> Bill McCleary writes:
> > Sure there is. Its syntax. There are psyops agents in the CIA that would
> > *kill* to know how Larry Wall devised such a deviously devilish mindjob!
> There's a good reason for Perl's arcane syntax: it is derived from shell
> syntax. In shells, symbols are the default and variables are the
> special case, so symbols are unquoted but variables must be indicated
> with a dollar sign. This convention was inherited by awk, where it made
> less sense, and thence by perl, where it made even less sense. However,
> it did provide an opportunity to indicate different types of variables
> with different sigils, with '$' used to indicate strings & numbers, as
> in shells, and @, %, & and * used for other types.
> Then there are all the implicit argument rules and such which _can_
> often do what the programmer means...and can just as often not.
> Then there are references and classes, which are a neat hack.
> Perl is a language whose design decisions made since at every step of
> the way, but whose final overall design is, frankly, ugly. I understand
> how it got where it is, and back when the choice was shell or perl, the
> answer was easy: perl. But nowadays there are better scripting
> languages like Python. Also, better dynamic languages like Common Lisp
> are freely available. So I don't see much reason to use Perl anymore.

recently i started to learn PowerShell, which is a scripting lang but also a shell. First of all, PowerShell was a fantastic shell lang, based on modern design, in the early 2000s, as opposed to unix's 1980. It was known as Monad, and has a lot features. It was based entirely on .NET, and support all unix shell's advantages and concepts.

though, i was rather surprised, that its syntax has a lot similarities with perl or unix shell. Piping “|”, dollar sign “$” for vars, redirect “>”, append “>>”, logic operator “&”, predefined var such as “$_”, “$?”, heredoc, array “@(1,2,3)”, array access “$x[3]”, “$aa[2][1]”, hash “@{'a'=1; 'x'='5'; 6=4; '6'=7}”, boolean operator “-eq”, “-ne”, “gt”, string expansion (aka “interpolation”) “"x is $x"” ...

so, that was a surprise for me. The key to note is that PowerShell is a cleanly designed from the ground up of a shell language, however, one gets the sense that perhaps a shell language which requires brevity must have syntax soup syndrome. The above examples barely illustrate PowerShell's brevity, because it has a lot more advance syntax sugars that i have yet to understand.

i haven't studied this issue in depth, but in my opinion, one could have a brief syntax yet based on a consistent syntax system, as opposed to ad hoc syntax soup. Mathematica is a example. For a exposition on this, see:

• The Concepts and Confusions of Prefix, Infix, Postfix and Fully Nested Notations

Here's my PowerShell tutorial. Right now pretty basic:

• Xah's PowerShell Tutorial

> Incidentally, I recently converted some tasks to Common Lisp from
> Python. Wow...the speedup was _amazing_. And this was simple stuff:
> scan in a CSV file then apply a function to every item. While it wasn't
> _slow_ in Python, it blazed in CL. Dunno how well Perl would have done;
> somewhere in between I guess.

Try Ocaml, it'd blow python or perl or Common Lisp to pieces.

unscrupulous self promotion:

• Xah's OCaml Tutorial

∑ http://xahlee.org/


persistant nodes in emacs manual

On Aug 4, 6:39 pm, "A.Politz" wrote:
> On Aug 5, 1:26 am, Xah Lee wrote:
> > It still works with or without the space, but would like to read about
> > this change.
> > thanks.
> > Xah
> * Added one space to the output of some info function, thought it
> might look better.
> Now you've done it, feel free to merge this line with your NEWS file.
> C-0 c
> , even more news.
> -ap

the change actually broke one of my elisp function. I have a command that when invoked, will turn the current line like



(info "(emacs)dired")

now it broke! lol. (yeah it can be fixed in few secs)

But anyway, i did some testing, at least this extra space change is backward compatible. e.g.

(info "(emacs)dired")
(info "(emacs) dired")

both works in emacs 22.

However, i noticed another, more important issue. In emacs 22, there's this node:

(info "(emacs)Transient Mark")

but doesn't exit in emacs 23's manual.

Shouldn't the manual nodes be persistant across versions, e.g. providing redirect when node changed?

as a pratical matter, this means now i have to search all my tutorial that points to manual nodes and check if they still work. This applies to any publication on emacs that reference to the manual by node.

this is a problem with python manual too... thinking about this, actually i don't know if there are any manual that:

(1) provide a computable reference to the chapter/sections.
(2) maintain this on different versions of the manual.

However, since emacs does (1) already, it's easy to do (2) too.

∑ http://xahlee.org/

emacs vs perl, perl-mode vs cperl-mode

> On 2009-08-07, Colin Williams wrote:
> > I'm trying to decide how to set up my perl development environment,
> > and I've come to a bit of a conundrum. I realize that there is both a
> > `perl-mode' and a `cperl-mode' lying around in the emacs code base,
> > but it's unclear to me which one is better. Many people have said
> > (rather authoritatively, I might add) that `cperl-mode' is much
> > better, but none of these people bother to list the ways in which it's
> > better. I was hoping somebody could categorically list the features
> > `cperl-mode' has that make it better than `perl-mode'.

i code in perl daily from day job as well as my own scripts from about 1997 to 2004. Since then i haven't looked at the issue of which perl mode is better, but basically, cperl-mode is far better during those years, and probably true without a slightest doubt today too.

these sort of questions really only you can determine. Posting here is probably just a social chatting call. LOL.

On Aug 7, 9:36 am, Ilya Zakharevich wrote:
> I (obviously ;-) tried to investigate this topic, and now I'm pretty
> sure that nobody would be able to answer your question. This is the
> standard gnoseological problem: it is many years now that I did not
> see people with clue (e.g., about cperl-mode) who know how perl-mode works...
> In CPerl menu Mini-docs, there is the description of one half of your
> question. The other half would probably remain a mystery forever...
> Hope this helps,
> Ilya

Hi Ilya, i was intriqued by one of interview on you about how perl lacks text processing functions. I wrote a essay about it:

• Text Processing: Elisp vs Perl

do you think my understanding of your remarks is roughly on the ball park? Your comment appreciated. Thanks.

∑ http://xahlee.org/

change file encoding with emacs, python,java

On Aug 7, 10:50 am, Christophe Jorssen wrote:
> Hello all,
> I'd like to know if it is possible to change the encoding of a buffer.
> For exemple, my buffer is encoded in ansinew and I'd like to recode it in
> utf-8.
> And, by the way, is it possible to "read a file with this encoding", that
> is automatically convert the encoding of a file when opened (say the file
> is encoded in ansinew and I'd like to have it in my buffer encoded in
> utf-8).
> I'm using
> GNU Emacs
> (emacs-snapshot), under unbuntu.
> Thanks a lot and sorry for my complete ignorance of the subject.

open the file, then call set-buffer-file-coding-system, then type the encoding system you want. Type Tab to see a list of possible values.

this page might help:

• Emacs and Unicode Tips

you could also run a lisp program that changes all your files in a dir to utf-8 or any other encoding. you could do this in python or elisp.

For python, see:

• Converting a File's Encoding with Python

for elisp, see:

• Emacs Lisp Examples

look for the section to-unix-eol there.
You'll need to change the line

(set-buffer-file-coding-system 'unix)
(set-buffer-file-coding-system 'utf-8)

on linux, there's a command line tool iconv that does this as well. Java solution is also there linked in the python page above.

∑ http://xahlee.org/


emacs: how to cap the first letter of sentences?

Elena wrote:
> how can I autocapitalize the first word in a sentence (that is, after
> a period)?
> I've searched the Emacs Wiki, but:
> - auto-cap.el doesn't work;
> - auto-capitalize.el raises an error after the first word, then it
> doesn't work anymore.
> Thanks

without using a special package, you can do it by simply use query-replace-regexp, with pattern like this: “\. +.”, and in the replacement string give this: “\,(upcase \1)”.

For detail, see bottom:

• Find and Replace with Emacs

∑ http://xahlee.org/

emacs dired needs a overhaul

On Aug 5, 11:27 am, destino wrote:
> Is it possible to customize the information that Dired displays?
> I would like to be able to hide the permissions, owner, group, and
> date columns for so that it is easy to read in a narrow vertical
> split.
> Any help would be greatly appreciated!
> Thanks!

i think that's good too. In my 10 years using emacs, though i haven't heard about some package that'd do this.

dired prob could use some overhaul in the next version of emacs. Allow user to set different views, much like modern OS's file manager. I should be able to say view it as detail (default emacs), or just file names, or view creation date, mod date, or customize any columns i might want to add/remove. Or, view as icons or thumbnails especiall for photo dir. (currently emacs can do thumbnail with tumme mode)

one FAQ is how to get dired to sort by different orders. Currently, it's rather lacking and difficult. Another faq is to get dired to auto refresh when folder content changed.

∑ http://xahlee.org/


emacs keystroke translate issue

Hi Elena,

; Make C-t acts like C-x, so that C-x is easier to type on dvorak
; (keyboard-translate ?\C-t ?\C-x)
; but this means ALL your C-t keys becomes C-x.
; So, for example, in outline-mode, C-c C-t runs hide-body.
; But now, when you type that, you get C-c C-x instead.
; A better solution is:
; (global-set-key (kbd "C-t") ctl-x-map)

i've been using
(keyboard-translate ?\C-t ?\C-x)

for the past ~5 years or so. In pratice, i never noticed any problem, prob because C-t hardly used as embedded combo in a key sequence, or, when it is used, such commands are often advanced features or not commonly needed.

in fact, the example C-c C-t in outline-mode i only noticed yesterday, as i was browsing emacs 23's News file which is in outline-mode. Other than this, i've not used outline-mode.

I switched to

(global-set-key (kbd "C-t") ctl-x-map)

yesterday, and noticed that it has problems too.
I often do “C-x r l” to get my bookmark list.
So, this means i've been pressing “C-t r l” in the past ~5 years.
But if you are in dired, that no longer works with the new setup. “C-t r” invokes image-dired-delete-tag.

∑ http://xahlee.org/

lisp program = data ???

On Aug 4, 3:07 pm, Jimmy Miller wrote:
> I hope no one will perceive this post as an attempt at trolling.
> I have known for a long time that part of the power of Lisp is that
> Lisp code is represented in list form, and lists are one of the data
> structures in Lisp; therefore, code and data are the same thing. My
> question is, cannot a similar statement be made about many other
> languages with an eval function? In Python, for example, the eval
> function takes a string as an argument, and Python source code is
> represented as a string, so does Python also have the property that
> code and data are equivalent?
> I came across a quote by Paul Graham that seems to dismiss this idea:
> >Lisp code is made out of Lisp data objects. And not in the trivial sense that the source files contain characters, >and strings are one of the data types supported by the language. Lisp code, after it's read by the parser, is >made of data structures that you can traverse.
> I don't understand why the case of characters and strings is
> "trivial". Lisp source code can be thought of as being represented by
> a list, and a list is a Lisp data structure, so code = data in Lisp;
> but replace "list" with "string" and Lisp with "any language whose
> eval function takes a string", and suddenly you don't have a true
> statement anymore?
> I would appreciate it if someone could explain what sets Lisp apart
> from every other language with access to eval; after all, many of
> those languages are quite good at manipulating strings, and could
> conceivably perform complex manipulations on source code that is to be
> evaluated at a later point, just as Lisp is known for its list
> processing.
> If the answer lies in Paul's last remark about the parser, I would
> appreciate an example of a code manipulation that is possible in Lisp,
> but not possible in a language like Python or Ruby. If the answer
> lies solely in a Lisp macro's ability to manipulate code at compile
> time, then I fail to see what this fact has to do with code/data
> equivalence in a larger sense.
> Thanks in advance.

In lisp communities, it is widely recognized that lisp's regular syntax has the property that “code is data; data is code”. However, what does that mean exactly is usually not clearly understood in the lisp community. Here is its defining characteristics:

A regular nested syntax, makes it possible to do source code transformations trivially with a lexical scan.

to fully appreciate this single sentence summary, see:

• Fundamental Problems of Lisp

∑ http://xahlee.org/

google sitemap generator python tool gone?

google used to have a sitemap generator written in python, at:

but the url is gone. It seems the current version is moved here:
and is a server based dynamic tool that auto detects changes and auto gen sitemap, as opposed to the python one that needs to be run manually.

is the old python version still available? or is there some official doc about this change?


∑ http://xahlee.org/

emacs shell on windows etc

Hi Len,

thanks for the w32shell.el tip.

we chatted this before... but i'll have to spend some time down the road to study this.

it'd be nice to integrate PowerShell into it too. Hopefully i can look at it soon and maybe send you a patch.

On Aug 4, 10:52 pm, Lennart Borgman wrote:
> On Wed, Aug 5, 2009 at 12:06 AM,XahLee wrote:
> > btw, on Windows emacsW23, it has cmd-shell. Is this particular to
> > emacsW23 or is it in GNU Emacs's Windows branch?
> w32shell.el (where cmd-shell lives) contains wrappers for the "shell"
> function that comes with Emacs itself.

i believe you are saying that w32shell.el is NOT in GNU Emacs code base right?

so, when people compile emacs 23 on Windows, they don't have cmd-shell, but just shell, which invokes Windows's cmd.exe right?

what are the reasons not to have w32shell.el in GNU emacs? It seems to me that it is good to have separate shells. Cause for me, i use all cmd.exe, cygwin bash, and PowerShell on my Windows machine, and i'd prefer to be able to run them indivdually while in emacs, instead of one shell that has all these shell's paths togeter... at least the unix cygwin bash shell wouldn't mesh well with Windows's.

> The purpose of it is to make it more easy to switch between uing cmd,
> Cygwin, MSYS etc as the shell program in command shell. (The name is a
> bit unfortunate. I did not know it was so hard to get additions like
> this into Emacs so I choose something that could fit Emacs.)

Thanks for the info.

Today i just compiled emacs 23 on my old PPC Mac, and it went very smooth! I was fantastically happy. Especially so because my mac is a late 2005 machine running OSX 10.4, and all the other Mac ports of emacs all have abandoned it for about a year now. I haven't compiled a program for years... last time i did compile emacs is sometimes in 2002, lol. This week or so i'll install cygwin gcc or whatever Microsoft's compiler offerings (if free) and try to compile it on Windows.

∑ http://xahlee.org/

learning emacs lisp

On Aug 5, 4:26 am, waterloo wrote:
> I have read the manual "An Introduction to Programming in Emacs Lisp".
> But still I can not be able to write complete code of lisp .

Practice. :)

I use emacs for like 8 hours a day daily since 1998. I read quite a lot emacs manual. For the first about 5 years i use emacs completely in a text terminal with emacs keybinding and ways. I thought i knew a lot about emacs, yet i didn't know shit about elisp until 2006 i started to learn it. Kinda resisted learning it. Learning a bit elisp helps your emacs using a lot. I've been programing elisp in a leisurely since 2006, am pretty good for using elisp as a text processing lang such as perl, python, but still quite hard to code emacs features such as major mode, minor mode, frames/windows, font etc.

just patience and practice. If you are not a programer, more practice i guess.

I have now some emacs tutorial i think you probably have seen. Here's some simple examples that might help.

• Emacs Lisp Examples

start small and gradual works well for me.

∑ http://xahlee.org/


emacs 23 info node name change?


in emacs 22, when in info inside emacs, if i press “c”, i get the node info in my kill ring, for example:

(elisp)System Environment

But in emacs 23, i get:

(elisp) System Environment

is there any explanation or doc about this change? I don't see it in the NEWS file.

this seems important to me because programatically, i can do eval in elisp:

(info "(elisp) System Environment")

to get emacs to display the node.
It still works with or without the space, but would like to read about this change.


∑ http://xahlee.org/

powershell: how to launch a process in the background?

is there a way to launch a program in PowerShell but still have access to the shell?

e.g. when i do


PowerShell launches emacs, but as long as that emacs is still running, i don't have access to the shell anymore. (PowerShell ISE tells me “Already running a command. Please wait.”)

Am looking for something similar to unix's “emacs &”.


∑ http://xahlee.org/

Solution. 2009-09-17

Thanks. I got it to work.

# launch ErgoEmacs with latest source code and your own emacs customization
function ErgoEmacsLaunch
start-process "C:\Program Files (x86)\ErgoEmacs\bin\runemacs.exe" -ArgumentList "-Q", "--load=~\ErgoEmacs_Source\ergoemacs\ergoemacs\init.el", "--load=~\.emacs"

set-alias ee ErgoEmacsLaunch

∑ http://xahlee.org/

On Aug 4, 9:34 pm, "Alex K. Angelopoulos" wrote:
> Another option for external applications that may take over the console (as
> opposed to cmdlets/scripts that may returnPowerShelldata) is to start it
> as a process. InPowerShell2, you can use the Start-Process command. If you
> want to retain a connection to the process, use the -PassThru parameter:
> start-processe macs-PassThru
> Even if this is a consoleemacs, it will be spawned in a new window by
> default.
> In PS1, use this:
> [diagnostics.process]::Start("cmd")

unix windows shells pain

> > (when (string-equal system-type "windows-nt")
> > (progn
> > (setenv "PATH" "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin")

i set my PATH in my Windows emacs to unix paths because i'm mostly using cygwin shell inside emacs...

i still need to do some study on the various paths to have a some sort of more universal setup, so that i should be able to invoke cygwin or Windows commands in all of emacs interactive shells: shell, cmd-shell, powershell... as of now, am not sure that's even desirable... i guess i needs to understand more about how these shells relates to each other technically outside of emacs first... the path separator issue of / vs \ and their automatic conversion in different shells has also been a pain... in all shells (cygwin bash, cmd.exe, PowerShell) they all have automatic conversion as you use the shell, but when you write scripts or set paths, you can't arbitrarily use / or \ (even if properly quoted in string), the rule for the omission of drive letter is also a complex issue, and cygwin has some rather esoteric mechanisms to map drives (e.g. in cygwin bash, “/cygdrive/c” maps to “C:\”) ...



dont use Windows if you dont' like it

On Aug 2, 3:50 pm, Peter Milliken wrote:
> Just loaded Emacs 23.1.1 for Windoze and now my site-lisp.el file nolonger
> seems to run. I tried copying the contents into default.el (and placed it in
> the same directory as my site-lisp.el) but it doesn't seem to run from there
> either.
> No much in it - just some code to turn off the annoying tool-bar when Emacs
> comes up (why a tool-bar meant for people with a mouse fixation is included
> as the default behaviour for an editor like Emacs is beyond me - let the
> people who need mice set it up if that is what they want! Don't force the
> rest of us to keep finding ways to turn it off!).
> Just for the hell of it, I copied the default.el into c:/emacs/site-lisp -
> and Emacs appears to run it from that location - which is NOT where I want
> my personal customisations to reside!
> Nothing else has changed i.e. my HOME directory prior to starting Emacs is
> still pointing to where the site-start.el/default.el files are located.
> I did a quick scan of NEWS and Changelog but can't find anything relevant
> there (not that I wanted to spend anymore than 30 seconds looking).
> Am I to assume this is an unexpected feature i.e. bug in this release?
> Regards
> Peter

Don't call it Windoze. if you don't like Microsoft Windows , don't use it. If your company requires you use Microsoft products, then choose to work for companies that don't.

I don't know what's your problem. Why are you mucking with emacs setup? If you want emacs 23, do a fresh install, or compile. If you need your setup to still fuction, your elisp code should be written in a portable way, and you simply just copy them to your new emacs install. Dont think you hot and mix and match components and libs and complain. If you run into some elisp incompatibilties introduced in emacs 23, you need to tell what are the errors, or which function coughed.

amazing, Lin Dozers always tech geek and gets nowhere.

Cheers :)

∑ http://xahlee.org/