2010-05-26

make AutoHotKey work in admin privilege apps

is there a way to make all my ahk keys work even when admin privilege app is in front?

For example, press Start key and on Notepad, right click and choose “Run as administrator”. Once in the program, all your AutoHotKey keys won't work, as if AHK is disabled. However, things like Win+1, or shortcut keys you personally defined in the shortcut files, still work.

This happens in RegEdit too since that is run as admin. This means all my volume change keys, app switching keys don't work.

Thanks.

http://www.autohotkey.com/forum/viewtopic.php?p=358154#358154

2010-05-22

avoid shebang in unix shells

On May 20, 12:01 pm, Johan Andersson wrote:
> Hey,
>
> I have an Emacs script where the first line looks like this:
> #!/usr/bin/emacs --script
>
> However, on Mac OSX, Emacs is installed by default, but with an old version.
>
> I have also installed Emacs via Homebrew (compiled from source) and can run
> that with:
> /Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs
>
> So, to run the script with the Homebrew version, I could change the first
> line in my script to:
> #!/Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs --script
>
> That works, but I want this script to work on both GNU/Linux and Mac OSX
> (Both default and Homebrew version).
>
> I was thinking I could use env somehow, like this:
> #!/usr/bin/env emacs --script
>
> And then make emacs an alias or function that points to the correct binary
> depending on system. But it's still the default Emacs that is used.
>
> Any ideas how I could solve this?

from my experiences, it's best to avoid the shebang construct. Just call the program directly.

The shebang construction is something of the 1980s. It's outdated and complex, and doesn't work well across platforms.

not sure what's your need here exactly, but for example, to call the script in mac, you can do as in your example:

/Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs --script myscript.el

to avoid typing the long text, you can define a alias. So, the whole thing can be either

emacs --script myscript.el

or even just

doit

to define a alias in bash, do like this:

alias doit='/Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs --script myscript.el'

Also, don't rely on environment variables if possible. They create more problems than is worth.

Xah
∑ http://xahlee.org/

2010-05-14

organize AutoHotKey code by app instead of key?

is there a way to organize ahk code so that it's grouped by application instead of keys?

for example, here's one block of code from my ahk script. It sets the * key on numpad, what it actually do depends on which app is front.

[code]
;;; make the numpad star “*” key to do next tab
$NumpadMult::
WinGet, myProcName, ProcessName, A
If (WinActive("ahk_class Second Life") Or WinActive("ahk_class Vertical Life") )
{
Send !{Right}
}
Else If (WinActive("ahk_class Emacs")
Or WinActive("ahk_class Chrome_WindowImpl_0")
Or WinActive("ahk_class MozillaUIWindowClass")
Or WinActive("ahk_class gdkWindowToplevel") )
{
Send ^{PgDn}
}
Else If (WinActive("ahk_class IEFrame")
Or WinActive("ahk_class OpWindow")
or (myProcName = "safari.exe") )
{
Send ^{Tab}
}
Else {
Send {NumpadMult}
}
Return
[/code]

so my ahk script is a bunch of such blogs.
It is easy to find all the definitions of a given key, but i'd like to find all hotkeys of a given app.

Thanks.

xah's ahk tutorial

post url http://www.autohotkey.com/forum/viewtopic.php?p=355260

2010-05-06

emacs closing file problems

On May 5, 6:51 am, Tyler Smith wrote:
> Xah Lee writes:
> > The emacs buffer management problem really has to do with emacs's lack
> > of closing file command. There's kill-file, but it requires you to
> > confirm, even a saved file. Plus, there's no keyboard shortcut for it.
> > So, this tends to get people to leave behind lots of opened files.
>
> Isn't 'C-x k' (kill-buffer) basically a file closing command? It doesn't
> require confirmation for files that are already saved, and the file that
> the buffer was visiting is then removed from the buffer list. Or am I
> misunderstanding what you mean by 'close file'.
>
> Also, I can't find kill-file on my emacs (GNU Emacs 24.0.50.2), did you
> mean kill-buffer to begin with?
>
> Tyler

sorry, been sloppy.

yes i meant kill-buffer (shortcut C-x k)

when you call kill-buffer, it prompts you, even for a saved file. More specifically, it prompts you which buffer you want to kill. It does not simply close the current buffer.

the other problem is that when you kill a buffer not asociated with a file, even if it is not saved, has content, it'll simply kill it after you give the buffer name, but not prompting you whether to save it.

the link i gave in my previous post does give detail about these.

Xah
∑ http://xahlee.org/



PS in a earlier post in this thread, i mentioned no keyboard shortcut. That refers to the Close command in the menu, which calles kill-this-buffer.

Xah

emacs distribution for Windows

not sure you specifically want NTEmacs or if other emacs distro on Windows is fine.

if you don't particularly care about a specific distro, here's few i know that works well for me:

• official GNU Emacs build for Windows.
http://ftp.gnu.org/pub/gnu/emacs/windows/
just download, unzip, and use right there.
No installation step needed.

• EmacsW32+Eamcs
http://www.ourcomments.org/Emacs/EmacsW32.html
download the patched version.
Then, run the installer.

• ErgoEmacs
http://ergoemacs.org/
download and run the installer.
(disclaimer: me and David Capello made this one)

you shouldn't worry about downloading multiple version of emacs that might interfere with each other. I have all the above three installed.

as to what tricks might impress a new emacs user, maybe these pages are good ideas for you to pick from:

http://www.gnu.org/software/emacs/tour/
http://xahlee.org/emacs/emacs_fun.html

Xah
∑ http://xahlee.org/



--------------------------


On May 5, 10:18 pm, dkco...@panix.com (David Combs) wrote:
> A friend wants to install ntemacs on xp, and we're
> not sure just how to do it.
>
> (I already have it, also on xp, but I sure don't want
> to try doing it here, and screwing up the one I have
> already got.)
>
> Anyway, here's the ntemacs home-page:
>
> -------------- this page is at:  http://ntemacs.sourceforge.net/
>
>  ntemacs
> Emacs CVS for W32
> (A SourceForge Project)
>
> Screenshot of ntemacs on Windows 7
>
> CAUTION: Unofficial builds
> Downloads  - [7z SFX]
>
>     * CVS Emacs binary [23.1.50.1] -  ntemacs23-bin-20090923.exe [md5sum: b1b5c33eea980127cf550e7f0f111e15]
>     * CVS Emacs source [23.1.50.1] -  ntemacs23-src-20090923.exe [md5sum: 0655b73ecad2f365bc24e2492e45266b]
>
> Steel Bank Common Lisp
>
>     * SBCL release binary [1.0.32] -  sbcl-1.0.32-x86-windows-binary.msi [md5sum: 3d2fba2ae0c513a0ef912a862caee21b]
>     * SBCL release source [1.0.32] -  sbcl-1.0.32-source.tar.bz2         [md5sum: 95e1f683e307fa4cbf053db37fbd1456]
>
> Last updated: Oct 27, 2009
>
> Now, he's downloaded both of those .exe-files -- says they ended up in
> /downloads ok.  But there are no instructions of what to do from
> then on.
>
> (I am not at his site -- this is all by telephone conversation.)
>
> I myself am not a windows person, and don't quite understand
> these .exe files -- some kind of self-executing wrapper around
> what I (on solaris) would think of as xyz.tar.bz2 that
> I'd explode into a whole tree of files.
>
> But, as I say, I don't want to try it on this PC (xp) because
> doing that might screw up my perfectly-working ntemacs (v23).
>
> (How did I install it?  I didn't -- knowing nothing about
> windows (since '86 I've been using only Suns), someone
> did it for me.
>
>  AND, the version I got installed was a few months
>  BEFORE the October '09 date of the current ntemacs,
>  and I recall that back then there WERE some instructions,
>  and maybe it wasn't a single .exe-file -- a bit
>  more straightforward to do.)
>
> So, any hints you can give me that I can send on to him
> would be a real help.
>
> THANKS!
>
> David
>
> PS: My idea is to turn him on to emacs -- have him first
> do the RMS tutorial (C-h t) to master cursor movements,
> idea of a buffer, "window", and region (nope, not there,
> I gotta teach him that one), and then blow him away
> with dired (and dired-x), M-x occur, M-x grep (well,
> he's gotta get cygwin too, I guess), C-x 3, follow-mode,
> fill-individual-paragraphs, dired-do-rename-regexp, wdired,
> doctor (of course!), emacs-wiki, desktop-save & read,
> rectangles, picture-mode, *info*, C-h, sort-paragraphs,
> C-x 5, defun, "interactive", toggle-truncate-lines,
> tabify and untabify, table-capture, kbd-macros,
> how you "live" in emacs and *shell* (and *shell1* and
> *shell-for-helping-joe*, etc), start up emacs and just
> keep it up for days and days,
>
> PLUS
>
> any ideas you give me to impress someone on easy to execute
> and explain -- nifty-features that, for someone who
> sits in front of a terminal all day long, will save
> him a HUGE amount of time (over using ONLY vi, say).
>
> Idea is to show him enough to excite him about emacs,
> to demonstrate how much time
>
> ... getting him interested enough to spend time learning more
> of it, eg via *info*.
>
> That's the idea, anyway.
>
> PS2: Any way via windows to have one screen we can
> both type into (like with the dec20 twenex-command "advise"),
> so I can type in stuff to emacs, he can watch, then
> try it himself, and I can say "no, no, use the X key,
> let me show you"?
>
> Again, the main problem is: how to INSTALL ntemacs
> on his xp machine.
>
> (Why ntemacs, why not cygwin's emacs.  Because ntemacs
> works so much better screen-display-wise, that you
> can't tell the difference from it and emacs on a Sun (sparc),
> that's why.)
>
> Thanks again.
>
> David

2010-05-03

Elements of Style in English

2010-05-02

• Elements of Style in English
http://xahlee.org/Periodic_dosage_dir/bangu/elements_of_style.html

http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/cab47c7322ae9bfe#

-------------
you see Raffael, your reply is not atypical of pedantic idiots. There are a sea of them.

But is there a way to resolve our argument in a definitive way?

Yes. One simple way, is to ask expert writers, say, those who are widely recognized as expert writers, make a judgment of my writings. Say, my very little essay here, or others on my website. Ask them, is these writings, clear, conveys the writer's thoughts well, fluent, creative, and in short, rather expertly done?

You see, we can even carry this out. The question, of whether my writings are above average among professional writers, is absolutely a question that can be answered with a definitive yes or no. But the question is, as with most arguments in online forums, there is no incentive to actually resolve arguments. In the past years, i've suggested concrete and practical ways to raise funds by both parties to resolve questions about computer language debates. Wrote at least twice with some 500 or so words on this that describes how this can be done. (search google group of my post with terms paypal, argument, expert, you'll probably find them) The closest case is someone paid me $20 usd to resolve a argument i had with another guy. (documented here: http://xahlee.org/UnixResource_dir/writ/Mathematica_optimization.html )

So, what am i gonna do with u? what CAN i do with another online netizen who i barely know? do i, honestly, spend the next 4 hours digging my heart out with sincerity about a proposal to resolve a argument, that i know, will result in nothing other than another bout of word fight? And consider you as a person, do i really, want to go to all this trouble that effectively in the end makes you look bad? hum? y'know, my persona, isn't the type to be kind with words about matters of truth or the size of my cock.

Xah
∑ http://xahlee.org/



On May 2, 7:31 pm, Raffael Cavallaro wrote:
> On 2010-05-02 18:57:21 -0400, Xah Lee said:
>
> > What you don't seem to realize, as with most pedants, is that writing
> > serves a purpose, a purpose of communication, and when a piece of
> > writing, communicated exactly what the writer wants the reader to
> > feel, understand, with no hiccups in the reading process, that writing
> > is successful.
>
> To the ear of a native speaker, your writing is filled with hiccups.
> You don't realize this because you haven't internalized english grammar
> and usage sufficiently to hear it. You think you're communicating in an
> unimpeded flow, but a native speaker cringes when reading your posts
> because of the numerous gaffes, errors that one would never hear from a
> native speaker.
>
> If you don't want to adhere to english grammar because it's too much of
> an effort for you to learn its byzantine norms (and they are in large
> part arbitrary and irregular), fine. There are thousands of posters on
> the internet whose english is far from perfect.
>
> > would any in the audience have problem understanding the above
> > perfectly and fluently? In particular, when the "pigs fly" part hits
> > them?
>
> It isn't at all clear what you mean. "When pigs fly" means "that will
> never happen." Do you mean that essays and novels will never happen? Do
> you mean that poetic license makes the impossible happen? Your usage of
> the phrase makes no sense in the context in which you use it. You can't
> repurpose long accepted idioms and expect that readers will magically
> read your mind and intuit your intended meaning. We don't live in your
> head.
>
> One problem with english being widespread is that it is a language in
> which is easy to attain understandability, but very difficult to attain
> comprehensive mastery of the huge laundry list of often arbitrary
> grammatical and usage norms. As a result, non-native speakers often
> fall into the trap of believing that it is easy to master. It is not.
> Such people my go for years repeating errors without realizing it
> because native speakers will understand their intended meaning, but not
> correct their grammar and/or usage.
>
> Please stop trumpeting your broken english as some sort of stylistic
> choice. It's not. It's obvious to native speakers that it's not. You
> don't *choose* to write "punctuations" instead of "punctuation," or
> write sentences with two verbs and no relative pronoun. You just don't
> know any better.
>
> Spanish is a language with relatively few phonemes. As a result,
> spanish speakers often speak other languages that have phonemes absent
> from spanish with a quite noticeable accent. My brother was acquainted
> with a spanish diplomat who, because of his profession, needed to be
> proficient in a number of languages. He once told my brother "I espeak
> eseven languages - all of them in espanish!"
>
> There is no shame in not having mastered english grammar and usage (or
> pronunciation) - I speak some spanish, french and german, but I would
> never claim to have mastery of the grammar and usage of any of these.
> At the same time, I don't write screeds condemning the authorities on
> the standard grammar and usage of these languages.
>
> Just be yourself without apology. At the same time, stop trying to
> denigrate accepted, widely used, english grammar and style just because
> you haven't mastered it. It just makes you look foolish.
>
> warmest regards,
>
> Ralph
>
> --
> Raffael Cavallaro