2012-01-16

emacs: how to find out file location of a function

On Jan 16, 9:27 am, Bujji 〔bujjiec...@gmail.com〕 wrote:
│ Hi Xah,

│ All you said above looks correct for me.
│ This didn't show up in -Q enable of emacs.

│ But, how to trace where the .elc file exists and disabling the snippets?
│ Is there some debug command to see all loaded paths in emacs?

│ I started using emacs from 6 months and not an expert at this.

one easy way to track it is this:

when you think yasnippet mode is active, type
【Alt+x describe-function Enter yas/minor-mode Enter】

then in the help panel, it'll show you where the file is. Click on it to go to it. Then, delete that dir.

Restart emacs.

Repeat the above if necessary.

Xah

emacs autopair, paren, method comparison

2012-01-16

https://groups.google.com/forum/#!topic/gnu.emacs.help/_QM7AL1nxUk

hi Uday Reddy,

On Jan 16, 2:57 pm, Uday Reddy 〔usr.vm.ro...@gmail.com〕 wrote:
│ On 1/6/2012 4:31 PM, Xah Lee wrote:



│ │ i'd recommend not to use any minor mode for this. Here's my solution:

│ │ 〈Emacs: Insert Brackets by Pair〉
│ │http://xahlee.org/emacs/emacs_insert_brackets_by_pair.html

│ Xah Lee, here are 3 use cases for you:

│ 1. To type (x), you want to type exactly that: an `(' an `x' and a `)'.
│   Got it?

huh? I just type 【Menu+d x】. 2 keys (one combo plus a single key). and the keys are Thumb and home row on left hand.

As opposed to 【Shift+9 x Shift+0】, which is 3 keys (2 combos and a single key) that involves lots pinky.

(i actually use Dvorak layout, so the 【Menu+d x】 is actually 【Menu+e q】. But i'll stick to qwerty notation in this message for easy understanding for the masses)

│ 2. If you change your mind after typing `(', when the buffer has (), you
│ want to hit DEL or BSP, and both the parens should disappear.

No. I use ErgoEmacs keybinding. So, after i typed 【Menu+d】 to have inserted () , and if i decided i don't want it, either i undo 【Alt+z】, or hold Alt and press “df” (that is: 【Alt+d Alt+f】), which delets backward and forward. This is better than moving your hand to far upper right to press Backspace then Delete key.

│ 3. If you have xyz in your text, and you want to put it in brackets, you
│ want to select it and hit either
│    - `(' to produce (xyz) and move to the beginning of (xyz), or
│    - `)' to produce (xyz) and move to the closing of (xyz).

not quite sure i understand what you mean here.

if i have “xyz” in my text, and i want to make it “(xyz)”, i press 【Alt+e】 once to to delete the “xyz”, then 【Menu+d】 to insert the paren, then F3 or 【Alt+v】 to paste the “xyz” back.

│ Once you have "solutions" for these 3 use cases, we will be happy to
│ give you more.

so now you see my power?

my method doesn't require esoteric learning. It is standard across all OS and apps. While, yours, i suppose the emacs way, requires much more learning and being less efficient, to boot.

please let me know if there's any part that's not clear, or needs to be challenged.

PS if you don't know already, my first 6 years of using emacs (1998-2005) is in text terminal EXCLUSIVELY (repeate: text terminal EXCLUSIVELY, as i despise unix fucking X11, and semi-refused to install X11 when collegue asked as a sys admin on Solaris boxes), and using emacs default keybinding EXCLUSIVELY. I've documented my experience here a few times as well as a essay on my emacs tutorial site. Please Let me know if you require a link.

Xah

2012-01-13

how to revive comp.lang.lisp

On Jan 13, 12:57 pm, Kaz Kylheku wrote: …

i'll tell u how to revive comp.lang.lisp. If all you follow it, i can guaranteed that comp.lang.lisp will revive immediately!

• all of you, switch to
https://groups.google.com/forum/#!myforums
as your newsgroup viewer, immediately.

• Stop your fucking bottom post. In fact, don't even quote the message. If you do want to quote, quote no more than one single sentence. And don't use the fucking “> ”.

• electric shock yourself whenever you felt a urge to bitch about how other is top/bottom posting, or whether he truncated lines, or whether he used unicode.

• if you have sympathy towards the cause of eternal-septmber.org, ask a neuro-surgeon to cut off the part of your brain that spawn such sympathy.

• use real names.

• add profile info, put a profile picture of yourself (and, not picture of some fucking planet, drawings, or batman.). e.g. fill info about your gender, age, code/job experience, etc. (ommit them only if you really want)

• add other link/contact info, such as your facebook, g+, twitter, blog, linkedin, stackoverflow, etc, if you have one.

yeah, let's make the world a better place. There's a cure for tech geeking. Follow me!

Xah

decline of newsgroup?

On Dec 30 2011, 11:14 pm, Kaz Kylheku wrote:
“ You know, folks, I don't quite understand this decline in Usenet.”

http://groups.google.com/group/comp.lang.lisp/msg/adb3567389b74a89


lol. it's dead precisely because there's this bunch of hacker tech geeker types, with views such as exactly you just expressed.

Further readings.

〈Death of Newsgroups〉
http://xahlee.org/UnixResource_dir/writ2/death_of_newsgroups.html

〈comp.lang.lisp is 95% Spam〉
http://xahlee.org/UnixResource_dir/writ2/google_group_lisp_spam.html

〈Spy vs Spy; Tech Geekers vs Spammers〉
http://xahlee.org/UnixResource_dir/writ/tech_geekers_vs_spammers.html

〈Computer Language Popularity Trend〉
http://xahlee.org/lang_traf/index.html

〈What is a Tech Geeker?〉
http://xahlee.org/UnixResource_dir/writ/tech_geeker.html

〈Computing Culture: What's Hacker?〉
http://xahlee.org/Netiquette_dir/whats_hacker.html

〈Paul Graham's Infatuation with the Concept of Hacker〉
http://xahlee.org/comp/Paul_Graham_language_design.html

〈Language, Purity, Cult, and Deception〉
http://xahlee.org/UnixResource_dir/writ/lang_purity_cult_deception.html

〈HTML5 Doctype, Validation, X-UA-Compatible, and Why Do I Hate Hackers〉
http://xahlee.org/js/html5_validation_doctype.html

〈the Death of Dennis Ritchie, John McCarthy, Steve Jobs, and Hackers〉
http://xahlee.org/comp/Death_of_Dennis_Ritchie.html

Xah

2012-01-06

do you recommend emacs paredit mode?

On Jan 5, 12:40 am, "Pascal J. Bourguignon" wrote:
> Yuan Luo writes:
> > I am using common lisp mode in emacs 23, and it seems to me whenever
> > there is unmatched parens when I was saving a file, emacs reports
> > paren not matched with cursor moved to where the unmatch occurs but
> > then the cursor never moved back to where i was just editing. How do I
> > tell emacs 23 to move the cursor back? In emacs 22, it was fine.
>
> Don't save files with unmatched parentheses.
> Use paredit.http://www.emacswiki.org/emacs/ParEdit

I don't recommend paredit. I do recommend to always insert paren by pairs, however.

Here's what i recommend:

〈Emacs: Insert Brackets by Pair〉
http://xahlee.org/emacs/emacs_insert_brackets_by_pair.html

〈How to Edit Lisp Code with Emacs〉
http://xahlee.org/emacs/emacs_editing_lisp.html

Xah

computer language syntax, formal spec, design

http://groups.google.com/group/comp.lang.lisp/msg/d58a82f4db51b862

On Dec 30 2011, 12:30 pm, Xah Lee wrote:
2011-12-28

Dear Richard,

you are, perhaps the top 10 haters of Mathematica/Wolfram on this
earth. Me, is a dedicated lover of Mathematica, and actually i admire
Stephen Wolfram, his ideas, personality, too, in fact many of his
views, philosophies, are in alignment with my own. (one other guy i
could think of is Bertrand Russell)

Richard Fateman wrote:
│ This is in contrast to "almost all computer languages"  which DO have a
│ syntax described in Backus-Naur Form.

Xah wrote:
│ No they don't. Show me some. Let's say the most popular ones: java, c,
│ c++, python, perl, php, html, xml.

Richard Fateman wrote:
│ OK, I thought you had access to Google and could find these yourself..

│ the C grammar is in
│ Kernighan and Ritchie, The C Programming Language, App. A,
│ the Java grammar is in http://java.sun.com/docs/books/jls/second_edition/html/syntax.doc.html
│ the Python grammar is in http://www.python.org/doc//current/reference/expressions.html
│ C++ is probably in various places, including http://www.nongnu.org/hcb/

│ perl is, I think not amenable to systematic context-free description, in
│ that it uses some odd tricks during lexical analysis.  (As does
│ Mathematica).

│ html is not a programming language but a markup language; it is
│ described formally not by bnf but by a formal SGML DTD.

│ I'm not familiar enough with PHP to say anything about it except that
│ from googling for its grammar, it seems to be a piece of malleable garbage..

│ Other languages, like Algol-60, Pascal, FORTRAN, Basic, ... also have
│ (annotated) formal syntax descriptions, typically available in any
│ reference manual for them.

they have syntax spec in the same sense that there's syntax spec for
english. Just read grammar books!

i didn't clarify myself before. Let me do now.

No major programing language in use has a formal grammar for their
syntax.  By formal grammar, i mean a “formal language” (in the context
of symbolic logic. See http://en.wikipedia.org/wiki/Formal_language.
Parsing Expression Grammar would be a example of such formal
language).

In particular, let's look at 2 examples. Java and Python.

Neither have a FORMAL LANGUAGE spec of their syntax.  Worse, both
their “spec” is not sufficient to implement the language, even just
the syntax part. The vast majority of “language spec” are like that.
They are more of “a guide to implementation”, and that's it.

Fateman wrote:
│ (The term "regular" wrt syntax has a particular formal distinction).
│ Sure, and i would ask you some questions about syntax, but given your
│ known antagonism against Mathematica and Wolfram, am not sure i'd get
│ answers that's unbiased and useful to me.
│ Google is your friend.  Look up "regular grammar" to find out about
│ right and left linear grammars, for example.

Now, let me discuss my idea about “regular syntax”. (i don't know if
there's a term for this idea, so i just say “my idea”. Actually i
should call it “systematic syntax”. That would be better than “regular
syntax”.)

The “systematic syntax” i have in mind is this:

• a language with a formal language spec of the syntax.

• this formal language spec, is “regular” in the sense that it is very
simple, perhaps just a handful of rules. As a example of opposite, you
could have a formal language spec for Java syntax, but that would be
tens or hundreds of pages.

Now, my claim about Mathematica is this: its syntax specified in a
general formal language would be very small, yet the syntax is very
rich. No other major lang comes close. (lisp would also have a very
simple syntax spec in formal lang, but its syntax isn't rich).

Now, we can discuss what is meant by “simple”.

First, let me give a formal lang spec in BNF for a simplifed lisp
syntax.

• The set of symbols are english letters a to z, and the parens “(”
and “)” and space “ ”.

• let's call the letters a to z as atoms, and denote it by α.

starting strings:

• α
• ()

transformation rules

• α → (α)
• (α) → (α α …)

That's it. Very simple.

Now, a lang can have such simple syntax, but usually such simple ones
are not useful, not expressive, hard to read. For example, assembly
langs. Or think of arithmetic with just “+”.

What we want is a rich syntax, but still regular with simple rules
(that can be specified by a formal language with just a few rules.) In
some sence, such syntax grammar is a systematic one.

I don't like the dwellers of comp.lang.lisp (they are idiots), because
lisp do have very simple syntax, yet it is totally irregular, yet the
typical lisp fans don't realize it almost in ANY WAY, but drivel all
day about sexp and macros and certain “code is data” fucking total
meaningless bizarre idea. (lisp macros is another major idiocy.)

as a example of the complexities of C-like syntax, let's have a peek
show:

 i++
 ++i
 for(;;){}
 while(){}
 0x123
 expr1 ? expr2 : expr3
 sprint(…%s,#@$#!%*&fuck@#)

Further readings:

• 〈Pattern Matching vs Lexical Grammar Specification〉 http://xahlee.org/cmaci/notation/pattern_matching_vs_pattern_spec.html

• 〈What's Function, What's Operator?〉 http://xahlee.org/math/function_and_operators.html

• 〈The Concepts and Confusions of Prefix, Infix, Postfix and Fully
Nested Notations〉 http://xahlee.org/UnixResource_dir/writ/notations.html

• 〈Programing Language: Fundamental Problems of Lisp〉 http://xahlee.org/UnixResource_dir/writ/lisp_problems.html

Btw, a little extra tip for my readers:

There is a confusion of the word “formal”. When people say “formal”,
as in “formal proof”, even mathematians, they usually mean “rigorous”.
Basically, they use the word “formal” as a synonym of “rigor”. (And
what's “rigorous” changes with time. Usually it just means the current
standard, accepted by other mathematicians.)

This is partly a abuse of language, partly a establish english usage
habit (called “phraseme”). Still, many mathematicians are ignorant of
“formal” in formal languages. In fact, many of them sneer at the idea
of David Hilbert's formalism or Bertrand Russel logicism, like idiots.

For more, see:

〈Math Notations, Computer Languages, and the “Form” in Formalism〉 http://xahlee.org/cmaci/notation/lang_notation_formalism.html

〈State Of Theorem Proving Systems 2008〉 http://xahlee.org/cmaci/notation/theorem_proving_systems.html

│ Happy new year.
│ RJF

Happy New Year to you too Richard!

 Xah Lee

emacs, insert parens by pair

On Jan 5, 6:11 am, Andrea Crotti 〔andrea.crott…@gmail.com〕 wrote:
│ Every time I try to open a dot file with the global autopair mode my
│ emacs becomes immediately
│ unusable and I have to kill it.

│ The error is:

│ Error in post-command-hook (autopair-global-mode-check-buffers):
│ (wrong-type-argument characterp nil

│ And if the post-command-hook stops working there's not much to do
│ unfortunately.
│ Any idea about how to fix this?

i'd recommend not to use any minor mode for this. Here's my solution:

〈Emacs: Insert Brackets by Pair〉
http://xahlee.org/emacs/emacs_insert_brackets_by_pair.html

Xah