2011-07-28

emacs lisp. looking for rassoc-default

2011-07-13

emacs lisp. Is there a rassoc-default for getting ALL elements matching a VALUE?

emas lisp. Is there a rassoc-default function? i.e. similar to assoc-default but get all items of a alist of a give value.

i want to be able to properly setup cperl-mode to load instead of perl-mode. Here's detail.

easy way is just
(defalias 'perl-mode 'cperl-mode)

but the problem with that is you can't call perl-mode anymore, if you still want it on occasion.

So, i went to set the auto-mode-alist. Like this:

(setq auto-mode-alist (rassq-delete-all 'perl-mode auto-mode-alist))
(add-to-list 'auto-mode-alist '("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . cperl-mode))

but that's not all, because there's also interpreter-mode-alist. So i wrote:

(when
(rassoc 'perl-mode interpreter-mode-alist)
(let ((mykey (car (rassoc 'perl-mode interpreter-mode-alist)) ))
(setq interpreter-mode-alist (rassq-delete-all 'perl-mode interpreter-mode-alist))
(add-to-list 'interpreter-mode-alist (mykey . 'cperl-mode))
)
)

but i discovered there are actually several elements for perl in that alist:

("perl" . perl-mode)
("perl5" . perl-mode)
("miniperl" . perl-mode)

So my code above won't work. One slightly sloppy way to do it is simply do this:

(setq interpreter-mode-alist (rassq-delete-all 'perl-mode interpreter-mode-alist))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))

but a more proper way is to query for the value 'perl-mode, get *ALL* results, then remove them all, then add them all back with 'cperl-mode.

Ι found the function “assoc-default”, which gets all elements by KEY, not value.

so, my question is, is there a “rassoc-default” that gets by value? Or, is there any simpler proper way to setup cperl-mode instead of perl-mode?

Thanks.

Xah

emacs validate matching brackets

2011-07-21

On Jul 21, 9:43 am, pyt...@bdurham.com wrote:
> Xah,
>
> 1. Is the following string considered legal?
>
> [ { ( ] ) }
>
> Note: Each type of brace opens and closes in the proper sequence. But
> inter-brace opening and closing does not make sense.

nu!

> Or must a closing brace always balance out with the most recent opening
> brace like so?
>
> [ { ( ) } ]

yea!

> 2. If there are multiple unclosed braces at EOF, is the answer you're
> looking for the position of the first open brace that hasn't been closed
> out yet?

well, as many pointed out, i really haven't thought it out well.

originally, i just want to know the position of a un-matched char.

i haven't taken the time to think about what really should be the desired behavior. For me, the problem started because i wanted to use the script to check my 5k html files, in particular, classic novels that involves double curly quotes and french quotes. So, the desired behavior is one based on the question of what would best for the user to see in order to correct a bracket mismatch error in a file. (which, can get quite complex for nested syntax, because, usually, once you have one missed, it's all hell from there. I think this is similar to the problem when a compiler/interpreter encounters a bad syntax in source code, and thus the poplar situation where error code of computer programs are hard to understand...)

but anyway, just for this exercise, the requirement needn't be stringent. I still think that at least the reported position should be a matching char in the file. (and if we presume this, then only my code works. LOL)

PS this is a warmup problem for writing a HTML tag validator. I looked high and lo in past years, but just couldn't find a script that does simple validation in batch. The w3c one is based on SGML, really huge amount of un-unstandable irregular historical baggage. XML lexical validator is much closer, but still not regular. I simply wanted one just like the match-pair validator in our problem, except the opening char is not a single char but string of the form and the *matching* closing one is of the form , and with just one exception: when a tag has “/>” in ending such as
then it is skipped (i.e. not considered as opening or closing).

I'll be writing this soon in elisp… since i haven't studied parsers, i had hopes that parser expert would show some proper parser solutions… in particular i think such can be expressed in Parsing Expression Grammar in just a few lines… but so far no deity came forward to show the light. lol

getting ranty… it's funny, somehow the tech geekers all want regex to solve the problem. Regex, regex, regex, a 40 years old deviant bastard that by some twist of luck became a tool for matching text patterns. One bloke came forward to show-off a perl regex obfuscation. That's like, lol. But it might be good for the lulz if his code is actually complete and worked. Then, you have a few who'd nonchalantly remark “O, you just need push-down automata”. LOL, unless they show actual working code, its Automata their asses.

folks, don't get angry with me. I'm a learner. I'm curious. I always am eager to learn. And there's always things we can learn. Don't troll dance with me in a pit. Nobody's gonna give a shit if you win. If u are not the master of one thousand and one languages yet, you can learn with me. ☺ Lol & troll!!!!

Xah

2011-07-13

emacs lisp. Is there a rassoc-default for getting ALL elements matching a VALUE?

2011-07-13 emacs lisp. Is there a rassoc-default for getting ALL elements matching a VALUE?

emas lisp. Is there a rassoc-default function? i.e. similar to assoc-default but get all items of a alist of a give value.

i want to be able to properly setup cperl-mode to load instead of perl-mode. Here's detail.

easy way is just
(defalias 'perl-mode 'cperl-mode)

but the problem with that is you can't call perl-mode anymore, if you still want it on occasion.

So, i went to set the auto-mode-alist. Like this:

(setq auto-mode-alist (rassq-delete-all 'perl-mode auto-mode-alist))
(add-to-list 'auto-mode-alist '("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . cperl-mode))

that turns out doesn't do it, because there's also interpreter-mode-alist. So i wrote:

(when
(rassoc 'perl-mode interpreter-mode-alist)
(let ((mykey (car (rassoc 'perl-mode interpreter-mode-alist)) ))
(setq interpreter-mode-alist (rassq-delete-all 'perl-mode interpreter-mode-alist))
(add-to-list 'interpreter-mode-alist (mykey . 'cperl-mode))
)
)

but i discovered there are actually several elements for perl in that alist:

("perl" . perl-mode)
("perl5" . perl-mode)
("miniperl" . perl-mode)

So my code above won't work.

So, the proper way is to query for the value 'perl-mode, get *ALL* results, then remove them all, then add them all back with 'cperl-mode.

Ι found the function “assoc-default”, which gets all elements by KEY, not value.

so, my question is, is there a “rassoc-default” that gets by value? Or, is there any simpler proper way to setup cperl-mode instead of perl-mode?

Thanks.

Xah

2011-06-17

piano, computer keyboard: pinky vs 4th finger, stronger?

2011-06-17
On Jun 15, 5:43 am, rusi wrote:
> On Jun 15, 5:32 pm, Dotan Cohen wrote:
>
> > Thanks. From testing small movements with my fingers I see that the
> > fourth finger is in fact a bit weaker than the last finger, but more
> > importantly, it is much less dexterous. Good to know!
>
> Most of the piano technique-icians emphasis, especially those of the
> last century like Hanon, was to cultivate 'independence' of the
> fingers.  The main target of these attacks being the 4th finger.
>
> The number of potential-pianists who ruined their hands and lives
> chasing this holy grail is unknown

Hi rusi, am afaid going to contradict what u say here.

i pretty much mastered Hanon 60. All of it, but it was now 8 years ago. The idea that pinky is stronger than 4th is silly. I can't fathom any logic or science to support that. Perhaps what u meant is that in many situations the use of pinky can be worked around because it in at the edge of your hand so you can apply chopping motion or similar. (which, is BAD if you want to develope piano finger skill) However, that's entirely different than saying pinky being stronger than 4th.

there's many ways we can cookup tests right away to see. e.g. try to squeeze a rubber ball with 4th and thumb. Repeat with pink + thumb. Or, reverse exercise by stretching a rubber band wrapped on the 2 fingers of interest. You can easy see that pinky isn't stronger.

Xah

http://groups.google.com/group/comp.lang.python/browse_frm/thread/ff3a9b0dda4161a7

2011-06-14

keyboard: use of numerical keypad

2011-06-13

On Jun 13, 6:45 pm, Gregory Ewing wrote:
> Chris Angelico wrote:
> > And did any of the studies take into account the fact that a lot of
> > computer users - in all but the purest data entry tasks - will use a
> > mouse as well as a keyboard?
>
> What I think's really stupid is designing keyboards with two
> big blocks of keys between the alphabetic keys and the mouse.
> Back when standard-grade keyboards didn't usually have a
> built-in numeric keypad, it was much easier to move one's
> right hand back and forth between the keyboard and mouse.
>
> Nowadays I find myself perpetually prone to off-by-one errors
> when moving back to the keyboard. :-(

numerical keypad is useful to many. Most people can't touch type. Even for touch typist, many doesn't do the number keys. So, when they need to type credit card number, phone number, etc, they go for the number pad. Also, i think the number pad esentially have become a calculator for vast majority of computer users. These days, almost all keyboard from Microsoft or Logitech has a Calculator button near the number pad to launch it.

i myself, am a qwerty typist since ~1987, also worked as data entry clerk for a couple of years. Am a dvorak touch typist since 1994. (and emacs since 1997) However, i never learned touch type the numbers on the main section till i think ~2005. I used to always just move my hand to the number pad when i need to type a phone number. Since about 2008, the numerical keypad is now used as extra function keys.

Xah

2011-06-13

keyboard: menu key, Alt, window key

On Jun 12, 8:58 am, Elena 〔egarr...@gmail.com〕 wrote:
│ On 12 Giu, 09:19, Xah Lee 〔xah...@gmail.com〕 wrote:

│ │ ------------------------------------------------
│ │ PC Keyboard Modifier Keys (A Short Survey)

│ │ However, the right side is entirely a different story. Here's some common design:

│ │     ① Alt Win Menu Ctrl (most cheap keyboards)
│ │     ② Alt Menu Ctrl (some Microsoft ergonomic models)
│ │     ③ Alt Flip3D Menu Ctrl (some fancy (non-split) Microsoft models)
│ │     ④ Alt Fn Ctrl (many Logitech keyboards)
│ │     ⑤ Alt Ctrl. (keyboards of early 1990s)

│ Actually, things are worse than that: in ISO (European) layouts, there
│ is no right Alt key, since it has been replaced by AltGr.

Ah, thanks. I forgot about that.

Additonal info: On Windows, if the layout is set to one of the euro lang, the right Alt became AltGr.

i have a question: in Europe and keyboard manufactured for Europe with a real AltGr key, does that key actually send a different scancode than the right Alt?

│ I think modifier keys - Win key included - should always be on both
│ sides of a keyboard.

I agree.

│ In Windows, Menu is equivalent to Shift+F10 (if I remember correctly).

Yeah. Wikipedia has a lot detail: http://en.wikipedia.org/wiki/Menu_key

though, one cannot expect them to be exactly equivalent, since it is done in software layer.

│ As for the lack of Win key, you could always remap Win key chords to
│ Ctrl+Alt.

yeah. But then that interfere with emacs use of Ctrl+Meta. e.g. with arrow key it navigate lisp code …

│ Thanks for writing this article: I'll pay attention to the modifier
│ keys whenever I'm going to buy a new laptop, where keyboards always
│ are a bit crippled.

thanks. Yeah laptop is one entire different story. I think i'll do a survey of laptop layout soon. Already started to gather some pics. … i think the main ones to start with is Apple's, HP/Compaq's, IBM/Levono, and maybe some sony, toshiba, Acer, ...

i think prolonged use of laptop real quick to RSI anyway. I used laptop (Apple) exclusively for 1 year in ~2004, that's the first time i felt RSI coming. Then i got myself a external keyboard, in fact opted for a ergonomic (split) one (of Microsoft), and now i never looks back on straight keyboards ☺.

Xah

emacs, unicode, keyboarding, troll

2011-06-11

On Jun 11, 12:25 am, dkco...@panix.com (David Combs) wrote:
│ Just a reminder here:

│ As far as I can tell, a Sun keyboard (type 6, I think, the one with
│ "control" in the CORRECT place, just left of the "a") has no
│ windows key (nor the other one mentioned, a "super" key, was
│ that it?).

now, this post gotta be a troll — one fat piece of meat waiting for me to byte, and how i cannot resist, as tech geekers wont to say.

Hi David Combs, if i recall correctly, you are the one insistently complain, like Alan Mackenzie have done, politely to boot, several times in the past years, that newsgroup posts shouldn't use unicode chars such as “” «» → etc. LOL And as i've mentioned a thousand times, a decade and two ago the same tech geekers insisted that web shouldn't commericialize, that it should remain plain text, that GUI is for idiots, and MIME is a plague. (and these same idiots today toting iPad, Amazon Kindle in their hands, sipping coffee pleasurably at Starbucks, banter on commercial sites such as slashdot, reddit, hacker news, about software ethics, while grabbing movie files from pirate bay, because, after all, information should be free.)

So, what shall i say about the « Sun keyboard (type 6, I think, the one with "control" in the CORRECT place, just left of the "a") has no windows key (nor the other one mentioned, a "super" key, was that it?).»?

if you are a typical conservative tech geeker with coding experience back to the 1980s, then, the CORRECT position for Control key for emacs use today is at the 2 Alt key on standard PC keyboards. In contrast, if you are not the conservative hacker of old school, then the correct position is to tell FSF to wipe out emacs's keyboard shortcut set. Wipe it out. All of it.

References:

〈Sun Microsystem's “Type 6” Keyboard〉
http://xahlee.org/emacs/sun_microsystems_keyboard.html

〈How To Avoid The Emacs Pinky Problem〉
http://xahlee.org/emacs/emacs_pinky.html

〈Why You Should Not Swap Caps Lock With Control〉
http://xahlee.org/emacs/swap_CapsLock_Ctrl.html

〈Why Emacs's Keyboard Shortcuts Are Painful〉
http://xahlee.org/emacs/emacs_kb_shortcuts_pain.html

O, by the way, recently i discovered this from emacs manual of version 23.2, node ((emacs) User Input), quote:

(1) We refer to <Alt> as <Meta> for historical reasons.

O, so FSF refer to Alt as Meta. I didn't know that! I double checked and that line wasn't in emacs manual of 22.0.50. For a moment i thought it reads “Xah refers Alt as Meta, because he's a troll.”.

Xah

2011-06-12

Pascal vs Xah

Pascal J Bourguignon 〔p…@informatimago.com〕 wrote:
> Not at all.  (Yet some other fodder for Xah's idiocy articles, sorry).

you mean my articles describing idiots like you?

Here's a juicy passage of Pascal J Bourguignon fellow, in which you can get a glimpse of his highness:

«Ruby's been done by some Japanese newbie… I guess there was some language barrier preventing him to learn from the 50 years of occidental experience in programming language design. At least, he wasn't a "linguist"… In any case, why should we suffer for THEIR incompetences?!?»

Xah

On Jun 11, 9:51 pm, "Pascal J. Bourguignon" 〔p…@informatimago.com〕 wrote:
│ Alan Mackenzie 〔a…@muc.de〕 writes:
│ │ Hi, Xah.

│ │ Xah Lee 〔xah…@gmail.com〕 wrote:
│ ││ in a elisp program, if i have created a temp var (but not using let)
│ │ ….

│ │ As a matter of interest, how do you do that?

│ ││ …. and later i want to delete the var, i can do:

│ ││ (setq temp1 nil)

│ ││ or is it better to do

│ ││ (unintern 'temp1)

│ │ Shouldn't much matter.  Probably better to set it to nil, because that's
│ │ more usual.  OTOH, if you want to detect an error should temp1 be
│ │ subsequently accessed, then uninterning it will be better.

│ Not at all.  (Yet some other fodder for Xah's idiocy articles, sorry).

│     (defvar temp1 42)

│     (defun f ()
│       temp1)

│     (unintern 'temp1)

│     (f) --│ 42

│ ││ The temp1 var holds a big list, and there are few more, e.g. temp2,
│ ││ temp3.

│ │ Either approach will allow these lists to be garbage collected.

2011-06-03

programing: monad in emacs

On Jun 3, 5:19 am, jvt wrote:
> On Jun 2, 6:44 am, Xah Lee wrote:
> > On May 30, 10:30 am, jvt wrote:
>
> > > Hi cll -
> > > …
> > > I'd worry about spamming the list serve with my own content except Xah
> > > Lee is always posting his crazy blog posts, so I guess its ok?
>
> > i guess i'm honored. It's great of u to peddle ur stuff at the expense
> > of my name.
>
> > perhaps you seek a lil constructive advice from me: if you think your
> > stuff is useful, feel free to post here, without feeling guilty and
> > needing to find scapegoat as excuse.
>
> > and now you should thank me too, because i've contributed to your
> > advertisement.
>
> > long live the spirit of newsgroup.
>
> >  Xah
>
> The jab was entirely good natured, Xah.  I actually enjoy your posts,
> for the most part.

Wee! I figured if the pesky Pascal J B would praise a article, it must be worthwhile.

〈Deep Emacs Lisp Part 1 (Basically, a Monad Tutorial)〉, (2011-04-09) by JVT. @ http://dorophone.blogspot.com/2011/04/deep-emacs-part-1.html

btw, is there a subscribe button on your blog? Blogger is annoying in that by default they have subscribe button to comments but not the blog. (one can subscribe in Google Reader just by plain blog site's url, but still, a explicit rss button would be better)

i'll be reading your article soon and perhaps blog about it on my blog and maybe give some feedback.

PS it annoys me to no end when one cannot easily find the name of the author on blogs, when the blog author clearly didn't meant to be anonymous. Is there a reason you didn't want it spelled it out?

(i despise hacker culture, where these “hackers” idiotic-namesake prefer to go by “handles” or abbrevs (e.g. “RMS”, “ESR”, “JWZ”) or whatnot insider-fashion fuck. But that's just me.)

Xah

2011-05-22

Functional Programing: stop using recursion, cons. Use map & vectors

this is important but i think most lispers and functional programers still don't know it.

Functional Programing: stop using recursion, cons. Use map & vectors.

〈Guy Steele on Parallel Programing〉
http://xahlee.org/comp/Guy_Steele_parallel_computing.html

btw, lists (as cons, car, cdr) in the lisp world has always been some kinda cult. Like, if you are showing some code example and you happened to use lisp vector datatype and not cons (lists) and it doesn't really matter in your case, but some lisper will always rise up to bug you, either as innocent curious question or attacking you for not “understanding” lisp. (just as other idiocies happen in other lang that lispers see but other langs don't see)

it's interesting to me that all other high level langs: Mathematica, perl, python, php, javascript, all don't have linked list as lisp's list. It's also curious that somehow lispers never realises this. I've been having problems with lisp's cons ever since i'm learning Scheme Lisp in 1998 (but mostly the reason is language design at syntax and lack of abstraction level in calling “cons, car, cdr” stuff, without indexing mechanism). Realizing the algorithmic property and parallel-execution issues of linked list is only recent years.

Xah

2011-05-18

English Idiom in Unix: Directory Recursively

http://groups.google.com/group/comp.lang.python/browse_frm/thread/3702cd4e7d2c54c5/

Xah wrote:
〈English Idiom in Unix: Directory Recursively〉
http://xahlee.org/comp/idiom_directory_recursively.html

Mike Barnes wrote:
> Xah Lee :
>
> >For example, when you want to delete the whole dir in emacs, it
> >prompts this message: “Recursive delete of xx? (y or n) ”.
>
> AFAICS what emacs calls "recursive delete" is what the ordinary person
> would simply call "delete". Presumably the non-recursive delete is
> called simply "delete" but is actually something more complicated than
> delete, and you're supposed to know what that is.
>
> Also (I'm speculating) a recursive delete means carrying out the
> (ordinary, non-recursive) delete process on sub-directories,
> recursively. The result of which is, put simply, to delete the
> directory.
>
> I find all this somewhat arcane. Questioning the precise suitability of
> the word "recursive" seems like a quibble.

that's good point. I think what happens is that the “recursive” has become a idiom associated with directory to such a degree that the unix people don't know what the fuck they are talking about. They just simply use the word to go with directory whever they mean the whole directory.

In the emacs case: “Recursive delete of xx? (y or n) ”, what could it possibly mean by the word “recursive” there? Like, it might delete the directory but not delete all files in it?

also, in the rsync case: “This would recursively transfer all files from the directory … ”, what does the word “recursively” mean there?

Xah

2011-05-10

emacs autoload, auto-mode-alist, nxml-mode

the reason it nxml-mode is loaded when u call xml-mode is probably because there is a alias.

you can probably set it back by:

(defalias 'xml-mode 'sgml-xml-mode)

Peter wrote:
> (setq auto-mode-alist (cons '("\\.[XxRrMmDdTt][TtMmDdSsNnEe][PpAaMmLlFfSsIi]?[EePp]*[Cc]*$" . xml-mode) auto-mode-alist))

that seems to be pretty bad.

you probably want to use add-to-list instead of setq.
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))

also, the file suffix
"\\.[XxRrMmDdTt][TtMmDdSsNnEe][PpAaMmLlFfSsIi]?[EePp]*[Cc]*$"
seems quite wild. What is it?

nxml-mode is a new mode for xml, written by the xml expert James Clark, who is also the original author of sgml-mode (html-mode and xml-mode are parts of sgml-mode). nxml-mode features on-the-fly xml validation. It's 10k lines of elisp.

the following might provide helpful info:

〈How to Install Emacs Packages〉
http://xahlee.org/emacs/emacs_installing_packages.html

〈New Features in Emacs 23〉
http://xahlee.org/emacs/emacs23_features.html

Xah

On May 7, 3:45 pm, Peter Flynn wrote:
> I just upgraded a machine to Ubuntu Natty, which installed Emacs 23.2,
> which appears to open XML files in nxml-mode by default. My .emacs file says
>
> > (autoload 'xml-mode "psgml" "Major mode to edit XML files." t )
> > (setq auto-mode-alist (cons '("\\.[XxRrMmDdTt][TtMmDdSsNnEe][PpAaMmLlFfSsIi]?[EePp]*[Cc]*$" . xml-mode) auto-mode-alist))
>
> which has been working fine for years. It looks as if Emacs 23.2 defines
> xml-mode to point to nxml-mode, and this is somehow superseding my .emacs.
>
> Unfortunately I still need to use psgml's xml-mode for all my XML stuff.
> Does anyone know how I disable Emacs' new behaviour?
>
> ///Peter

2011-04-28

emacs: Alan, lsl-mode

http://groups.google.com/group/comp.emacs/browse_frm/thread/db1f6a1a2308dea4/fd83f92f3bac7224#fd83f92f3bac7224

Xah wrote:
> 〈Xah's Linden Scripting Language (LSL) Tutorial〉
> http://xahlee.org/sl/ls.html
> if you take a survey, i think 99% professional programers wouldn't
> know what the shit ^L is.

Alan wrote:
> I'm sure a much greater proportion of professional programmers, my colleagues,
> know this.

emacs cult victim Alan, i'm so prescient, i anticipated ur idiocy. See this sentence in my previous post:

Xah wrote:
> (Xah's edu corner: professional programer means those who
> makes a living mostly by coding; it doesn't mean your
> hacker buddies or those who slave in comp.lang
> newsgroup).

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

Xah wrote:
> here's my LSL tutorial Alan. You might browse it sometimes.
> 〈Xah's Linden Scripting Language (LSL) Tutorial〉
> http://xahlee.org/sl/ls.html

Alan wrote:
> Then again, perhaps not. I've no interest in Second Life.

remember you asked what's the problem being old? The above is a example.

> Have you written an Emacs mode for LSL?

i dunno if you really don't know, or just trying to get me to post my links.
Any idiot who spent 30 secs on the above link will see this link:

〈Emacs LSL Mode (xlsl-mode) for Linden Scripting Language〉
http://xahlee.org/sl/ls-emacs.html

and it's written from scratch baby, not based on some other mode.

Xah

2011-04-17

map F5 to emacs's C-x while ignore cua-mode

if i want to set F5 to emacs's C-x and F6 to emacs's C-c, how to do that?

i know i can use key-translation-map or function-key-map, something like
(define-key key-translation-map (kbd "") "")

but i also want it so that if cua-mode is on, it unconditionally do emacs's C-x, not cut.

i thought it's something like this

(defun f5-Cx ()
"DOCSTRING"
(interactive)
(let (cuaModeState cua-mode)
(cua-mode 0)
;; type C-x here
(if cuaModeState (cua-mode 1) (cua-mode 0))
))
)

but not sure how to do the “type C-x” there. Even so, not sure the whole would work.

Thanks.

Xah

2011-04-11

autism, schizoid, artificial intelligence

On Apr 11, 4:04?am, "Pascal J. Bourguignon" wrote:
> Don Geddis writes:
> > Xah Lee wrote on Sun, 10 Apr 2011:
> >> my parents are abusive fuckheads.
> > [...]
> >> Perhaps, it's also why i'm this way.
>
> > Ah! ?An explanation, at last.
>
> But not an excuse. ?He has a brain to compensate.

intelligence does not compensate for mental “illness”, personality disorder, trauma, or the like.

you can look at people with High IQ, and suicide rate, or psychological problems. They don't correlate.

as a human animal, there is certain psychological need, just as food is a physical need. Intelligence helps thinking, but that does little to grow or mend psychologically oriented problems.

i've put tremendous effort in my 20s and 30s to become a pure emotionless and logical being, pretty much as Mr Data or Spock in Star Trek. And as a person with mild so-called schizoid personality, i'm already far more emotionally removed than the general populace, even more so than most hard core programers, engineers, scientist types. (some say i have autism or Asperger syndrome, but between these and schizoid i'm not quite sure which or both)

in my interest in these things, one realization is that human animal isn't just a machine albeit made of meat, but psychological issues changes/damages your brain's wiring or chemical makeup in physics ways that even with intact high IQ your thinking pattern or emotional response will be changed in irreparable ways. e.g. easy way to see this is to imagine trauma victims. (or, you can think of the fictional Joker & Batman for illustration. Both are highly intelligent, but got psy problems. lol)

so, for much of my life, my quest of becoming a pure emotionless thinking machine using intelligence and logic is misguided and ultimately doomed to fail. In summary, the human animal, its behavior, thinking, is not and can not be controlled by pure will out of thinking.

related article:

〈Reading Notes on “Intimate Behavior”〉
http://xahlee.org/Periodic_dosage_dir/t2/intimate_behavior.html

〈Are You Schizoid or Autistic?〉
http://xahlee.org/Periodic_dosage_dir/schizoid.html

back to computer science... you know there's theories that when a computer gets sufficiently complex to approach Strong AI, it will develop emotion (which we perceive as negative), e.g. fear, love, incisiveness, etc, that these are so-called emergent phenomenon.

as to the question of whether machines will ever become sentient or achieve strong AI... i kinda think yes, because i think that if you don't believe some concept of soul or inherent spirit with a human animal, then it's just a machine, albeit made of meat, governed by physics. As such, artificial machines may one day be made in ways like the meat machine of human animal. (and then we have cloning tech on the horizon... which gets equally interesting on the question of sentience, identity, soul.)

Xah

2011-04-10

emacs, richard stallman, disruptive leaders

2011-04-10

http://groups.google.com/group/comp.emacs/browse_frm/thread/1d6b9c7d3cf0f4ee#

hi Louis Wen,

thanks for the thoughts. Here's some response as discussion.

On Apr 8, 9:25 pm, "Louis.Wen" wrote:
> Xah, I read all you article and some other else.  You are a interesting
> person but I don't agree with you completely.  I think you are doing
> good in your way(write articles on these and release ErgoEmacs).  And I
> want to make comments and give suggestions.

thanks.

> Although I am not much interested in politics (and actually not good at
> it), in my opinion it is somewhat radical to ask for dropping the word
> "free software" and replace it with "FSF ideal software", to advocate
> the abandonment of all traditional way of doing things in emacs (that is
> what you call "emacs cult", do I understand you exactly right?).  As
> emacs is developed in more than three decades, due to the compatible or
> historical reason there is something, e.g. the "undo" issue,  is not so
> easy to use comparing to some other more modern editors.  If you want to
> change this, I think you could easily get the source code and do it as
> you want. (actually you have built another branch of emacs, ErgoEmacs.)

it's not easy. People say one of the main power of emacs is customization. Yes, for small dosages. But to change keybinding (such as C-c & C-x for copy/cut), or adding the redo, really takes a lisp coder with several years of coding experience. Such is the case with ErgoEmacs as well as AquaMacs, Carbon Emacs, or the grandaddy XEmacs which took several elite pro programers several years full times in a day job to produce. Some of these core UI issues can't be fixed unless you hack emacs's C. At which point, you pretty much ends up as XEmacs, a complete incompatible fork, unless you kiss Richard Stallman's ass and dedicate your years of work under his design and name.

> That is exactly what FSF does, to make the software source code
> available to everyone and the provide the freedom to you to modify and
> redistribute the software.  There is 4 different levels of freedom that
> GPL provides. Yes, it is just some points of view (and actually put down
> in GPL as law text). It seems you have different thought in you article
>
> http://xahlee.org/UnixResource_dir/writ2/Richard_Stallman_abuse_freed...
> I think it's easy to see that you take thinking on it, however I don't
> agree with part of you points in this article.  By the way, the
> "entrepreneurs and businesses" example in this article is not good to
> support you point of view. It says you have the freedom to write
> software and release no matter in what license, but what GPL asks (for
> the entrepreneurs) and provides (to the user) is much more than this.

it should be noted that i was a dedicated FSF/GNU advocate, from late 1990s when i learned it to early 2000s. This can be seen in these essays:

〈On Microsoft Hatred〉
http://xahlee.org/UnixResource_dir/writ/mshatred155.html

〈The Unix Pestilence: GNU〉
http://xahlee.org/UnixResource_dir/gnur.html

quote:

Of the Open Source, which is one of the most paltry idea of humanity, of dolts' musing, paupers' plead, a offshoot and outright turncoat of Stallman's vision & hardship, dressing itself as the mediator between FSF and business men, fiddling and hawking a pipe dream of its own; a pot calling the kettle black; thieves and slouch's back seat. And in the end, it's just another fantastic fad pest of the world that is lingering. A sucker of programer's blood. A ruse for the enterprising corps. A disparate incongruous splash of vaporing nothingness that we shall see. —Xah Lee, 2002-05

that was when in ~1997 the Open Source started and there's a big war going on between it and FSF. (remember KDE, anyone?) I have also been called a Richard Stallman fanboy in mac fanatic mailing (which subsequently i was ban'd). Remember in late 1990s, there's a unix history page that was hugely popular on the web. The fuckhead guy, put Steve Jobs as one of the important unix people, yet does not include Richard Stallman. I criticized, nay, motherfucked the page in public. Eventually, the author put Richard Stallman there, but of course i don't get any credit. Those unix supposedly ethical hacker MOTHERFUCKING scumbags — GO FUCK YOURSELF.

am too lazy to search the links, but if anyone wants to doubt, i'll get the link, the Wikipedia history page on unix history that links to it, and the mac os x mailing list where i discussed this. (it was running on omniweb... one bunch of Mac fucking fanatics cheerleaders)

am ban'd in quite few places btw. It's funny that hacker news ban'd my site xahlee.org from submitting. (btw, i NEVER submitted my articles to any of those hip hop slashdot reddit hackernews motherfucking fashion FUCKS for the tech geekers) This page gives a summary:

〈Ban Xah Lee〉
http://xahlee.org/Netiquette_dir/ban_Xah_Lee.html

in my past unix/gnu history sniffing, i've noticed there are quite a few prominent people who had problems with Richard Stallman. XEmacs people being one of the famous example, but there's also KDE camp, BSD camp (early 1990s or even 1980s), and lots others. Richard Stallman is to be admired 100% until this happened to you personally.

btw, i still fully respect Richard Stallman as a person, as i think most coder who have come to unfortunate dislike of him. Though, he's like attacking Linus, and quite few others. In recent years, i think he's getting old. Attacking cell phones and Google and Miguel de Icaza ect. In mid 2000s as far as i sniffed, he's been voted out in several rather leet hacker open source communities...

and there's one thing i never quite understood. Debian was the most free, but seems since mid 2000s there's lots of complex controversies and is not today considerd free... (there are lots of lots of these internal factions among FSF/Open Source communities)

I think FSF is going downhill fast.

> About the "paperwork issue", I think you have and good view of it and
> get the point.  The requirement of paperwork is for protecting GPL, but
> it would slow down the process, probably we could find solution for this.
>
> Anyway, I think it is good to speak it out if you have different
> opinions and find some other guys who have the same though to figure out
> the problem, to improve things.  BUT, ALWAYS REMEMBER TO WATCH YOUR
> LANGUAGE.  It is much easier for others to accept your point if you
> speak in a good manner, isn't it?

In the end, there's a choice to make. It is not true that one should never go foul. Quite a few historical philosophers, and i think politicians, who made a change to the world, went full foul. Was ban'd, jailed, and so on. Their foul language or disruptive behavior varies in degrees.

to name a few from top of my head: Socrates, Hypathia, Bertrand Russell, Li Ao, Marquis de Sade. (and no, am not including common idiot's heros such as Ghandi, Martin Lurther King Junior fucks, etc.) Here's some related articles:

〈Justine by Marquis de Sade (Hardcore Sadomasochism)〉
http://xahlee.org/p/justine.html

〈Li Ao on Tibet and Dalai Lama〉
http://xahlee.org/Periodic_dosage_dir/tibet.html

〈Li Ao on Tiananmen Square Protests Of 1989〉
http://xahlee.org/Periodic_dosage_dir/Li_Ao_on_Tiananmen_Square.html

i don't give a flying fuck to social norms. Kill me, then we'll talk.

Xah

xah lee abusive parents; the free lunch of morality

http://groups.google.com/group/comp.emacs/browse_frm/thread/1d6b9c7d3cf0f4ee#

On Apr 8, 7:06 pm, des...@verizon.net wrote:
> Xah Lee writes:
> > G*****n m+++++++++++g emacs undo.
>
> Xah, didn't your mom ever wash your mouth out with soap?
>
> Everyone should experience that at least once, the world
> would be a better place.

my parents are abusive fuckheads. In today's USA, it is legally a crime, especially in California. I wish them both dead. (rather rhetorically speaking, because they dead doesn't do me any good. Rather, i wish my story be known, and any of those moral or kind fuckheads who keep insistiing the notion of “you should always love your parents”, or “parents are always good”, should be tortured. (can't blame them, because abusive parents are rather rare. However, there's a minority of ignorant fuckheads who think themselves as “good or loving” people, who perpetuate the harm. Typically the rich and fat and comfortable who never suffered or understood pain, hunger, war) It is these kinda fuckheads, do society bad.

Perhaps, it's also why i'm this way.

Xah

2011-04-05

what skills self taught programer lack??

http://www.quora.com/What-skills-do-self-taught-programmers-commonly-lack/answer/Xah-Lee

the collected answer in the summary is garbage.

i doubt programers with a CS degree understand half of those in the list.
And i doubt there are programers who really understand all of it, in particular: implementing language, compiler, machine learning, finite state machines, lambda calculus, category theory... the answer is totally garbage. Some of the items, such as machine learning, lambda calculus, category theory, really is something phd might understand, and most just barely. (they “understand” it as in “i've read a book”, “i've taken a class”.)

further, self-taught in programing is probably not much different than auto-didact in other fields, with respect to this question. What one may lack really depends on interest. Possibly, perhaps there might be something that all self-taught programers collectively lack statistically speaking, but this list is just garbage.

the alternative phrasing “Or, to put it another way: What should a self-taught programmer study to get up to speed with his/her formally-educated peers?” makes more sense. Here, i'd say typically it's more computer science subjects. I presume most self-taught programers here refers to those picked up programing and are making a living coding.

i'm self-taught. I'm trying now to make some constructive answer based on the list, but the list is so bad it's hard. For example, if you don't understand data structures, can you even code?? Compiler i might say is something self-taught ones normally wouldn't understand, because most programer don't need to know it to make a living coding. But there are hobbyist who study compilers as a subject of interest. Similar can be said of other items. For example, even though i'm self-taught, but my main interest in math, and my first lang is Mathematica, so i'm well familiar with functional programing and math related CS subjects (such as recursion, machine learning) before i even understood the concept of OOP. Another example, the last item says “Common vocabulary, jargon, and conventions”. If you work in the industry as a coder, that's really the first thing you learn, so i can't possible see why that item is on the list...

2011-03-30

emacs: compatibility problem whitespace-mode

On Mar 30, 9:13 am, "Drew Adams" wrote:
> > there seems to be a compatibility problem with whitespace-mode and
> > both http://user42.tuxfamily.org/formfeed-hline/index.htmland
> >http://www.emacswiki.org/emacs/PrettyControlL
> > in short, when one of PrettyControlL or formfeed-hline-mode is loaded,
> > then the unicode in whitespace-mode disappears.
> ...
> > it seems when pretty print is loaded, all those triangle and
> > middle dot doesn't show. same problem happens with formfeed-hline.
> > any idea what's going on?
>
> I replied to your question on Emacs Wiki
> (http://www.emacswiki.org/emacs/PrettyControlL).  I don't know what causes the
> problem, but I can confirm it.  Perhaps someone else can help?  Sorry.

Thanks Drew.

I found that this problem is reproducible without my personal settings on whitespace-mode and pretty-control-l-mode.

New steps to reproduce:

(1) load pretty control mode. (require 'pp-c-l)
(2) turn it on. (pretty-control-l-mode 1)
(3) turn on global-whitespace-mode
(4) now the unicode char ( “·”, middle dot, #xb7) used to indicate spaces are gone.

Some other interesting findings.

• turning off pretty-control-l-mode doesn't help.
• unloading it doesn't fix it neither. (unload-feature 'pp-c-l)
• the problem does not happen if you simply load pp-c-l but doesn't turn it on. Once turned on, the problem happens and cannot be fixed by turning off pp-c-l or unloading it.

The above are tested with pp-c-l but it happens with
http://user42.tuxfamily.org/formfeed-hline/index.html
too as i tested earlier.

Xah

2011-03-26

emacs, windows, cygwin, key problems

On Mar 25, 5:34 pm, KevinSimonson wrote:
> My laptop has Windows 7 Enterprise as its OS, but a few people I know
> there enjoy Unix enough that they had the Cygwin Bash Shell installed
> on their machines, and I have found Unix useful enough in the past
> that I decided I wanted that Bash Shell on my laptop as well.  So when
> I bring up a Command Prompt I'm using Windows 7, but when I click on
> All Programs->Cygwin->Cygwin BashShell>, a window comes up
> that to all intents and purposes is running Unix.
>
> I was very happy to discover that I can run "emacs" in this Bash Shell
> emulation, because there are a lot of editing tasks that Emacs macros
> make a lot easier than other editors I know.  But after my first Emacs
> session I was dismayed to find out that when I typed in > C>, this version of Emacs didn't recognize that key sequence!  At
> first I panicked, but eventually I found out that I could type in > X> "save-buffers-kill-terminal", and that got me out.  That saved the
> contents of the original file, but it's getting to be very irritating
> typing in that long command every time.
>
> Since then I've learned that when I'm done with a file I can type
> to save the file and "kill-emacs", which is a little
> shorter, but it's still a nuisance.
>
> When I type in , the Emacs editor tells me, "C-x C-g
> is undefined".  That's no typo.  It appears to mistake my for
> a !  Is there some way to tell Emacs to let
> be the key sequence for "save-buffers-kill-terminal"?  And to save
> that in my ".emacs" file so that whenever I bring up an Emacs session
> stays the key sequence for "save-buffers-kill-
> terminal"?
>
> Also, is by default the key sequence for "open-line", but I
> hardly ever use that, and find myself using "o" very often,
> so is there some way to tell Emacs to let be the key sequence
> for "other-window", and to save that in my ".emacs" file as well, so
> that every time I bring up Emacs it stays the key sequence for "other-
> window"?
>
> Any information on this would be greatly appreciated!  When I type in
> "emacs -version" it says:
>
> GNU Emacs 23.2.1
> Copyright (C) 2010 Free Software Foundation, Inc.
> GNU Emacs comes with ABSOLUTELY NO WARRANTY.
> You may redistribute copies of Emacs
> under the terms of the GNU General Public License.
> For more information about these matters, see the file named COPYING.
>
> Kevin Simonson

i used cygwin since 1998. I still use cygwin daliy, but these days i don't run emacs inside cygwin.

if i recall correctly, the key problem you encounter can be fixed by some cygwin specific environment variable (or config file, i forgot which.). They have a faq about it, it's a bit complex.

also, there are several GUI based emacs that's almost always more up to date than the one that comes with cygwin (but of course you can always compile you own).

I listed 3 most popular GUI ones, including ones from FSF:

〈Which Emacs to Download for Windows and Mac?〉
http://xahlee.org/emacs/which_emacs.html

also note, emacs's dealing with keys has major difference depending on whether you are running it in a text terminal (such as cygwin shell running on Windows Console), or if you are in a GUI environment. For example, in terminal, emacs cannot distinguish C-‹cap letter› vs C-‹lower case›. In general, running emacs in a GUI environment is much better even if you don't use mouse.

You could run a GUI emacs in X11 from cygwin if you want the whole cygwin unix environment. Or, you could just use emacs Windows port running in Windows. (you can still call cygwin shell & command inside emacs here, of course.)

i've written some experience of running emacs on Windows and Cygwin, you might find interesting.

〈Emacs and Microsoft Windows Tips〉
http://xahlee.org/emacs/emacs_mswin.html

hope that helps.

Xah

emacs, unicode, math symbols input

http://groups.google.com/group/comp.emacs/msg/eed4919307a80db0

On Mar 26, 2:31 pm, RS Wood wrote:
> On 2011-03-10, Xah Lee wrote:
>
> > might be interesting.
>
> > 〈A Curious Look at GNU Emacs's 1000+ Default Keybinding〉
> >http://xahlee.org/emacs/gnu_emacs_keybinding.html
>
> > plain text version follows.
>
> Very interesting.  The C-x 8 series I was unaware of, and I would've
> been glad to know about it as I usually have to change input method
> when I want to type a bit in French or Spanish.  Interesting to see the
> A- notation, for example A-Y for the Yen symbol, doesn't work with a
> modern Alt key.

yes, the C-x 8 is great. Though these days i've setup my own system of keys to input special chars, much like Mac OS's Opt+letter key. (I use Hyper+‹letter›, where the Hyper is Window keyboard's Menu key) This is faster than Ctrl+x 8 ‹letter›.

setting up your own is sometimes desired because the C-x 8 mechanism is mostly for latin symbols, and doesn't contain much math symbols such as infinity ∞, lambda λ, alpha α, arrow →, etc.

here's several ways to setup a symbol keyboard layout. Thru OS mechanism, or with emacs:

〈How to Create a APL or Math Symbols Keyboard Layout〉
http://xahlee.org/kbd/creating_apl_keyboard_layout.html

But if you work with math a lot (e.g. XeTeX, MathML, Mathematica, or functional langs), where you need to input hundreds of math symbols, direct key input is not suitable because it becomes difficult to memorize the exact key combos. For that many symbols, a input system is more suitable. e.g. type “inf” then press a hotkey and it becomes ∞. Same for lambda, whole greek letters, sum, logic and/or/not, all direction of arrows and variations, etc.

here's my math symbols input system:

〈Emacs Unicode Math Symbols Input Mode (xmsi-mode)〉
http://xahlee.org/emacs/xmsi-math-symbols-input.html

it's open source, but donation is much appreciated.

Xah

2011-01-27

youtube embed code invalid html

http://www.google.com/support/forum/p/youtube/thread?tid=2fe9c0cb02f1558f&hl=en

When going to YouTube, it gives a embed code such as

<iframe title="YouTube video player"
class="youtube-player" type="text/html" width="640" height="385"
src="http://www.youtube.com/embed/QRvVzaQ6i8A?rel=0">
</iframe>

Note that the

type="text/html"

is not valid html. There's no such attribute for iframe tag.

could anyone explain why google put that? I guess it's for some practical reason, but i couldn't guess what.

PS you can get the embed code by going here http://www.youtube.com/watch?v=QRvVzaQ6i8A

i also posted this question on
http://stackoverflow.com/questions/4800227/why-did-youtube-put-a-type-attribute-in-iframe-for-embedded-video
but i hoping some google employee would us some good insight.

Xah Lee

2011-01-26

emacs describe-char missing info on unicode thumb up char

there are these unicode symbols

ok hand sign 👌 #x1f44c

thumb up 👍 #x1f44d
thumb down 👎 #x1f44e

when calling describe-char on them, it doesn't give their names.

is this a bug? does it happen to just few chars, or perhaps all chars outside basic multilingual plane? I know that many chars outside of BMP doesn't have this problem.

Xah ∑ http://xahlee.org/

2011-01-22

what's the de facto practice on ampersand encoding in html

http://stackoverflow.com/questions/4768391/whats-the-de-facto-practice-on-ampersand-encoding-in-html

by html spec, ampersand should be encoded as

&

but of course a lot web doesn't do that. Here's a example of ad widget from amazon:

src="http://rcm.amazon.com/e/cm?t=xyzxyz-20&o=1&p=11&l=ur1&category=textbooks&banner=17P1AE8RQ1T7ZFC62V82&f=ifr"
width="120"
height="600"
scrolling="no"
border="0"
marginwidth="0"
style="border:none;"
frameborder="0">


note that the ampersand is not encoded.

My question is, for those work a lot with commercial sites, work in a company, or work with many widget codes, do most of these sites actually encode the ampersand?

(in other words, what percentage of top 1k sites try to encode ampersand properly when it is in url?)

2011-01-03

elisp 23.2 doc on regex on multibyte char still correct?

2011-01-03

http://groups.google.com/group/gnu.emacs.help/browse_frm/thread/7315c78b42984bb0#

in elisp doc for emacs 23.2, section on regex, it
it has a section that talks about multibyte chars.

is that info still correct?

________________________________________


This is edition 3.0 of the GNU Emacs Lisp Reference Manual,
corresponding to Emacs version 23.2.

(elisp) Regexp Special

The beginning and end of a range of multibyte characters must be in
the same character set (*note Character Sets::). Thus,
`"[\x8e0-\x97c]"' is invalid because character 0x8e0 (`a' with
grave accent) is in the Emacs character set for Latin-1 but the
character 0x97c (`u' with diaeresis) is in the Emacs character set
for Latin-2. (We use Lisp string syntax to write that example,
and a few others in the next few paragraphs, in order to include
hex escape sequences in them.)

If a range starts with a unibyte character C and ends with a
multibyte character C2, the range is divided into two parts: one
is `C..?\377', the other is `C1..C2', where C1 is the first
character of the charset to which C2 belongs.

You cannot always match all non-ASCII characters with the regular
expression `"[\200-\377]"'. This works when searching a unibyte
buffer or string (*note Text Representations::), but not in a
multibyte buffer or string, because many non-ASCII characters have
codes above octal 0377. However, the regular expression
`"[^\000-\177]"' does match all non-ASCII characters (see below
regarding `^'), in both multibyte and unibyte representations,
because only the ASCII characters are excluded.

A character alternative can also specify named character classes
(*note Char Classes::). This is a POSIX feature whose syntax is
`[:CLASS:]'. Using a character class is equivalent to mentioning
each of the characters in that class; but the latter is not
feasible in practice, since some classes include thousands of
different characters.

________________________________________

Xah ∑ http://xahlee.org/ ☄