make powershell script a icon to launch?

Hi, is it possible to make a PowerShell script that can be double clicked to run?

I like to have a icon that executes this

& "C:\Program Files (x86)\ErgoEmacs\bin\emacs.exe" -Q --load=~\ErgoEmacs_Source\ergoemacs\ergoemacs\init.el --load=~\.emacs

i tried to save it as a file run_ergoemacs.ps1 but double click only opened the file in a text editor.


∑ http://xahlee.org/


keyboard shortcut notations

On Sep 13, 7:32 am, Francesco Biccari wrote:
> Hi David,
> to me, you are right.
> This notation is the most common in Windows applications (and I think
> also in other OS's) and it is less ambiguos than other ones.

I agree with should go with for example Ctrl+N, though i do have a little personal gripe... which i never thought in detail but anyway here it is.

With keys involving shift key, in my mind i always thought it should be
Ctrl+n and Ctrl+Shift+n, for the none-shifted and shifted version...

The difference between “my” model and the Windows model is that, in “my” model, keys are treated as characters/symbol/glyphs that makes up text, and users press keys on the keyboard to enter these characters. Emacs uses interpretation for its keyboard shortcut notation too) In Windows notation, keys are more thought of as keys on the keyboard hardware. This model is actually more sensible.

In the docs i wrote i always used “my” model, but never really seriously decided if it is better.

Both model do have some problems. In both “my” model and Windows's model, the notation for pressing all keys Ctrl and Shift and 1, has two notations: Ctrl+Shift+1 and Ctrl+@, but also Ctrl+Shift+@.

For example, the key combo to increase font size is pressing at the same time Control and Shift and Plus. In Windows Firefox, it is shown as Ctrl++. However, it really should be Ctrl+Shift+=. (just noticed, that in IE, it actually uses this notation “Ctrl +”, which shows that the IE people are willing to break notational consistency for ease of understanding)

This problem occur because of the fact that some keys are used for more than one glyph with the Shift down (e.g. 1 and !, 2 and @, 3 and # etc.). Basically, the result is that there is no one-to-one correspondence with key presses and the notation.

This problem gets worse with different keyboard layouts, because not all layouts have the same Shifted symbols. For example, i looked at the Spanish Spain layout, according to Wikipedia http://en.wikipedia.org/wiki/Keyboard_layout#Spanish_.28Spain.29.2C_aka_Spanish_.28International_sort.29 A key combination of Ctrl and &, would be: Ctrl+Shift+6 and Ctrl+&. But in US keyboard, it would be Ctrl+Shift+7 and Ctrl+&. (From this example, we can see a slight advantage of interpreting the notation as characters to type, instead of keys on keyboard. Because if we treat the notation as chars to type, then Ctrl and & would just be that only, not Ctrl+Shift+7 or Ctrl+Shift+6 depending on layout. Again, this is what emacs do, but again, emacs is “better” only because it too lazy to deal with keyboard and layout complexity. Keyboard notation really should deal with keys on the hardware as human pressing buttons, not as typing text.)

Btw, it is also worth to mention that Apple's OS X, does not use the plus sign for its keyboard notation... For example, in Firefox for the Mac, to zoom in, the notation on the menu is shown as: “⌘+”, which means holding down the Command key and press “+”. The Apple model is arguably more elegant

(was hoping to find some screenshots or do one myself... to lazy.
however, i did check Wikipedia,
but it didn't discuss Apple's notation.

I would be interested to know what are the notation shown in menus in Linux Gnome and KDE. (am guessing they follow Windows, but would like confirmation)

Anyway, all the above is just personal philosophizing. For ErgoEmacs, i think using Windows notation will be good.

∑ http://xahlee.org/


elisp: pulling code out of custom-set-faces

i have in my emacs init file these code:

;; 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.
'(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")))))

how to pull the code into a normal elisp code?

for example, in custom-set-variables

;; custom-set-variables 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.
'(abbrev-mode t)
'(ange-ftp-try-passive-mode nil)
'(auto-save-default nil)

i can pull them out by replacing each line with the form:

(setq abbrev-mode t)


∑ http://xahlee.org/


emacs eshell quoting bug on -exec rm {} \;

this is probably a bug.

when running eshell in Windows, i do

c:\Users\xah\web>find -name "*el" -exec rm {} \;
find -name "*el" -exec rm {} \;
find: missing argument to `-exec'

it turns out, one needs to quote the ending semicolon.

This does not work:
find -name "*el" -exec rm {} \\;

This works:
find -name "*el" -exec rm {} ';'

It appears to me, this seems to be a bug, since
-exec rm {} \;
is a standard idiom in shells, and no reason that shouldn't work.

∑ http://xahlee.org/


ErgoEmacs history

On Sat, Sep 5, 2009 at 2:19 PM, biccari wrote:
> > 1. Why don't you delete the Emacs2010 and ergoemacs keybindings
> > project and create a single Google page ErgoEmacs?
> > I think that now the situation is a bit confusing.

On Sat, Sep 5, 2009 at 11:36 PM, David Capello wrote:
> I think the same. I suggest that we should remove Emacs2010 and
> stay just with the already created "ergoemacs" google project (anyway
> I don't know if it is easy/possible to move all issues from emacs2010
> to ergoemacs, and we will lost SVN history (anyway it could be
> better to do it now that the respository is small)).

as far as i know, google code doesn't let you rename project. I think last i read you have to ask them to do it for you.

ideally, i'd like to rename emacs2010 to ErgoEmacs, and the “ergoemacs” to ErgoEmacs Keybindings.

Perhaps i'll have to post a request to google. A possible tech complexity is that we are renaming to existing names (i.e. emacs2010 → ergoemacs). So, i hope if we do this, there'd be no screwup. But in any case, the code base is small as David said. At worse, starting over new project from scratch is no problem.

I think we are kinda small now. I'm guessing there are maybe few hundred of ergoemacs keybinding users at most, and probably less than 5 who actually seriously use or looked at the code for ErgoEmacs (emacs2010).

My sense is that we are at early stage and can wait a bit... e.g. from my experience, lots of other projects that eventually became successful has to be renamed for legal reason or otherwise. (lindows, firefox, many others ...)

> Xah has the last word.

wee! :)

> > 2. At the moment your target are the Windows and Mac users.
> > Why don't you write a very small page where you suggest the best emacs
> > distribution (one of the EmacsW32 package for Windows or just GNU
> > Emacs? Aquamacs for Mac?) and put the instructions to install
> > ErgoEmacs over these distributions?

> That is a good idea. A wiki page "How to use ErgoEmacs with
> GNU Emacs" for advanced (current emacs) users. Anyway that
> tutorial should not be necessary to be read by any future ErgoEmacs
> user (when the installer is done).

> Maybe we need two pages:
> 1) How to install ergoemacs keybindings
> 2) How to convert your GNU Emacs to ErgoEmacs

i think (1) is already there. For (2), i hope we can have a ready-to-use binary soon.

Following is some more explanations.

Ideally, i'd like to see one simple page of just maybe 2 paragraphs of text, then a download button, for users to download this editor for Windows and Mac. (as binary of course) And, without any philosophies, emacs history, why another emacs, which choice you should make, etc. Basically, look at any mainstream successful software e.g. google chrome, firefox, opera, Visual Studio... without the “hacker community”'s extra culture to be able to make sense out of it.

For emacsW32 and almost all emacs distro out there (including the other major emacs distro for the Mac, the Carbon Emacs), it's trivial to install the ergoemacs keybindings.
for any who sees this page, they can get it to run in 5 minutes without problems. (otherwise it's a major bug)

The only exception is the Aquamacs Emacs on the Mac. Aquamacs is exception because it is in a world by itself (lol). It is designed to be a complete Mac-like application as much as possible. So, all emacs ways are gone. It is not easy to customize it for a typical emacs users, because its own customization is rather radical and large. (with files opening in its own windows, tabbed gui, lots other pop up gui, etc.) Basically, on the mac, there are 2 major distros. Aquamacs and Carbon emacs. Aquamacs is mostly for those who never used emacs before, and for those who have used emacs or came from unix, they usually use Carbon emacs. One can, of course, always customize emacs to whatever if he has enough time.

Aquamacs is highly successful however, as a editor, because it grabbed all the “normal” people (mostly academics/students, and non “hackers” and non unixers) who simply needed to use a editor. (most of its users are LaTeX users)

Aquamacs is not a good mix with ergoemacs keybindings, due to the fact that Mac uses the Cmd key for standard shortcuts. Since Aquamacs is meant to be a Mac application, so it fully respect that. This means, Ergoemacs Keybindings won't have the easy Cmd key for shortcuts. That basically throws off the purpose of ergonomics in ergoemacs. (the Mac's Cmd key is analogous to the Alt key on PC keyboards with respect to position)

> ErgoEmacs over these distributions?
> Now some informations are reported in the DeveloperIntro page but I
> think a simple page for the essential informations is a good thing.

this project for much of this year is just my own... started as frustration with the emacs people and my rants and own customizations. I figured it might be useful to put them together, and eventually thought might as well start a project. For much of this year there's just this emacs2 zip file you can download that's pretty much my own customizations. It should work with any emacs distro. (but without much quality checking) David helped a lot since he joined recently and helped to start to build a binary and made the ergoemacs into a minor mode.

For now, the emacs2 dir package is in a flux but should still work... again, we hope to get the binary out, which is the real goal.

Thanks a lot for your suggestions. It's always useful to get feedback.

∑ http://xahlee.org/


hotkey to enable/disable a AutoHotKey set

how can i create a hotkey that disable/enable a ahk script?

i can enable by

F4::Run c:/Users/xah/Documents/autohotkey/xah_hotkeys.ahk

but how to disable? (or, suspend/re-run)

Sometimes, in playing Second Life, i want to turn my general hotkeys off so i can use the game's function keys becomes available.


∑ http://xahlee.org/


emacs truncate/line-wrap documentation problem

There's this variable truncate-partial-width-windows in emacs 23.1.

I think it's documentation is not very clear. I read the doc carefully, together with associated var such as word-wrap and truncate-lines. However, i cannot find out what exactly this variable do or its effects, after spending about 30 min setting various combination of values to these variables and or adjusting my frame width.

following is particular detail on why i didn't find it clear.
The doc reads this:

> Non-nil means truncate lines in windows with less than the frame width.

this seems to be that this var only has effect when its val is less than frame width. So i set it to 30.

> For an integer value, truncate lines in each window with less than the
> full frame width, provided the window width is less than that integer;
> otherwise, respect the value of `truncate-lines'.

I don't see any effect. It is not clear to me what this clause means: “truncate lines in each window with less than the full frame width”. It's not clear pratically, and it's ambiguous. Does the “with less than” being a codition where this takes effect, or does it mean it is the effect of this var? Also, the emacs tradition of using “truncate lines” can probably be improved. Usually, i understand it to mean “let long lines run off the right frame width”. It does not actually _truncate_ lines. In most of today's editors, similar feature is usually called “no word wrap” or “no line wrap”. This seems much more clear to me. So, in conjunction with this report on doc issue of truncate-partial-width-windows, perhaps emacs doc would consider change the wording of “truncate” in related documentation about line wrapping.

In any case, i cannot understand what this paragraph means.

> For any other non-nil value, truncate lines in all windows with
> less than the full frame width.

> A value of nil means to respect the value of `truncate-lines'.

> If `word-wrap' is enabled, you might want to reduce this.

In short, i tried to set this to 30 or 150. 30 is less than my frame width, and 150 is more. And tried to turn on off or set to other value the other mentioned vars, but i can't see the effect.


∑ http://xahlee.org/


Thanks Eli & Stefan on explaining this.

How about something like the following?

A value n sets the display to show only the first n characters per line.

This variable applies only when you have vertically split windows, and
when window width is less or equal to n.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 23.1 of Emacs.

Note that i removed the line “If `word-wrap' is enabled, you might
want to reduce this.”. I don't see that line appropriate, nor as
sensible suggestion. My gut feelings i'd rather want slightly larger
value of n if word-wrap is enabled.

it's not clear to me what happens when the value is something other than positive integer and is not nil. The original doc seems to suggest that has particular behavior...


∑ http://xahlee.org/


coloring text phrase in emacs

i would like to highlight some phrases when a file is opened.

So, i thought i put this in the first line:

-*- eval-expression: (hi-lock-face-phrase-buffer "me:" 'red ) -*-

however, the proper syntax for hi-lock-face-phrase-buffer seems to be:

(hi-lock-face-phrase-buffer "me:"
(defface myface
'((((background dark)) (:background "red" :foreground "black"))
(t (:background "red")))

can it be simpler? I just need to color the text and background.

i have other people's names i need to color red, blue.


∑ http://xahlee.org/

hard coded formatting mentality

On Sep 1, 8:21 pm, Allan Gottlieb <gottl...@nyu.edu> wrote:
> (I am using emacs 23.1)
> Start with emacs -Q and a buffer in fundamental mode
> Consider a line wider than the frame, for example
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> which exceeds an 80 column frame.
> Now assume you have a short line say
> yyyy
> followed by the above long line, i.e.
> yyyy
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> So far so good. Now indent the long line with say one space.
> If visual-line-mode is OFF, I see what I expect, the long line is
> preceded by one space.
> But with visual-line-mode ON, a blank line appears on the screen between
> the short and long lines, i.e. the long line (with only one word) was
> wrapped.
> This behavior seems wrong. I am getting burned in the following case
> among others with html
> <ol>
> <li>
> <a
> href="a-looong-url-that-naturally-contains-no-blanks">
> go here
> </a>
> When the looog-url exceeds the line length a blank line appears
> after the <a
> I realize the blank line is not in the file so the browser is not
> affected, but I find a plus of html to be that it reads well in emacs
> even when not formatted (by say w3m).
> Am I correct in viewing this as a bug? If so I will file a bug report.

it's not a bug. It's a natural behavior of smart word wrapping. Try that in any word processor, you see the same behavior.

The problem is that you have this un-natural long string, those 80 or so x. Not human language or computer lang have such long string as words.

for plain text, sure that happens, originated in 1980s as a hack of using ASCII pict to emulate a horizontal line. i.e. in html it's <hr>. Such a hack is less and less used today. If you must use it, word wrap (aka emacs's visual-line-mode) is not suitable.

all this has to to with physical formatting, a mindset particularly started by unix idiots. For references, see:

• A Simple Lisp Code Formatter

• A Text Editor Feature: Extend Selection By Semantic Unit

• The Harm of Hard-wrapping Lines

• Tabs versus Spaces in Source Code

• Plain-Text Email Fetish

• A Text Editor Feature: Extend Selection By Semantic Unit

• Fundamental Problems of Lisp

∑ http://xahlee.org/

someone wrote: False!

I tried in Notepad, Notepad++, Wordpad, and on Mac: TextEdit, TextWrangler, XCode. These are the top major editors in Windows and Mac.

All behavior is as i described. I wasted me 15 minutes on this now. Fuck.

Tried Eclipse and NetBeans, but can't findout how to turn on wrap lines in them.

∑ http://xahlee.org/

AutoHotKey !F4 means pressing Alt first or together?

in this example, where i tried to define a special case to close Microsoft Mail indiviual mail window.

IfWinActive ahk_class ATH_Note
Send !F4 ; close window
Send ^w ; close window

why would !F4 not work? Normally, pressing Ctrl+F4 would close the window. But it activates the menu instead (apparantly behaving as if Alt is pressed first, followed by F4, which Windows Mail ignores). ( ! c works though).

my question is, when i have syntax like !F4, does that always mean pressing Alt, release, then F4? Whats the syntaxt for pressing Alt and F4 together at the same time?


Xah ∑ http://xahlee.org/ ☄


powershell's directory code? d-r--, d---hs etc

in PowerShell, when i do a dir, i get for example:

d-r-- 9/1/2009 11:16 AM Contacts
d-r-- 7/29/2009 8:50 PM Desktop
d-r-- 8/31/2009 9:28 PM Documents
d-r-- 9/1/2009 6:08 AM Downloads
d---- 8/28/2009 2:11 PM ErgoEmacs_Source
d-r-- 5/23/2009 9:56 PM Favorites
d-r-- 5/23/2009 7:23 PM Links
d---- 8/5/2009 3:40 PM Mail
d---- 5/25/2009 10:31 AM Movies
d-r-- 6/26/2009 4:54 PM Music

is there a page that explains all the code "d-r--"?


∑ http://xahlee.org/