Xah Emacs Blog Archive 2019-01
code rewritten. now, instead of toggling the margin, toggle the window/frame width instead. Now it's in Xah Fly Keys.
emacs lisp walk dir problem, and emacs cult
the following was written on 2018-09-03. gonna put here now.
spent past 4 hour on emacs lisp. pretty tired and frustrated. elisp doesn't have a good traverse dir function. The short story is:
directory-files-recursively
does not let you skip sub-dir.
and
find-lisp-find-files
in
find-lisp.el
lets you do, but extremely slow. 10 times slow.
it's supposed to be faster cuz it skip some subdirectories. That's the whole point of using it.
perl python golang all lets you do this. They have a walkDir function, which passes the path to a walker function you write. The full path is passed, so you can then filter anyway u want. in elisp, it just have a f with regex as filter and on file name only, not full path.
every workaround i thought of, can't meet basic efficiency principles. The only solution, is to roll your own dir walker function that pass path to a user defined f. fk emacs lisp.
and in the process, you run into other problems. for example, one workaround i thought of, needs this: Emacs Lisp: String Match in List given a string and a string of strings (the dir to skip names), return t if it matches one of them.
but in emacs 25, there's supposedly better seq-some
.
[see Emacs Lisp: Sequence Functions]
…
i haven't posted it before because it's unfinished thought,
and i was beginning to write my own walk-dir function, but didn't complete
cuz got other things to do. I thought i'd finish that and write a nice blog.
Also,
find-lisp.el
must serve some purpose, else it's silly, maybe at the time it's written, it served some purpose,
but i haven't done a thorough study of it.
I actually have lots of unfinished blogs piled up in past 10 years. But i noticed, if you don't post it, often, it just ends up never. So, in recent years, i start to post whatever thoughts on the spot. Partly because, often, when i reread past posts, sometimes i work on them again. Often starting with typo/grammar correction or improving the text , but one thing leads to another. While the buried unpublished blogs, tend to be never seen again.
it seems, i toil and moil all day and night, all for naught.
sometimes, i feel am like talking to myself. There are lots problems in elisp, and emacs, and emacs community, but, what you see in the emacs community is often just happy singing.
it's amazing to me, there are people enamoured with emacs elisp, some i actually know and respect, and some claim a truly bizarre claim that elisp is a great lang. In fact, it's 10 times worse than any of perl python ruby, in almost all aspects, by any sensible judgment.
in my career as a non-conformist, and fringe (that is, despise mainstream or pop views), a lot people think am a troll, including those in emacs and unix and lisp communities. But, often, i wonder, who is really on drugs. One easily understood issue is emacs keybinding. To this day, there are still a lot people, you can see them in reddit emacs, who insist, that emacs's default keybinding is great, does not induce Repetitive Strain Injury, and that one should swap capslock to control, and that using palm to press control is a idiotic thought, and they believe these to the degree that if you disagree, you are troll or something.
cult, do lots of things. just that when you are in a particular one, you don't think you are.
Emacs Lisp: Simple Code Examples (minor update)
reviewed and updated
Emacs: Org Mode Markup Cheatsheet . added properties, drawers, tags, etc.
pay me
thanks a lot guys.
if you like my work:
- patreon me $5 https://www.patreon.com/xahlee
- amazon egift card to Xah@XahLee.org , $20 is nice.
- paypal to Xah@XahLee.org , $20 is nice.
Xah Emacs Tutorial update
Xah Emacs Tutorial update has been sent out to previous buyers.
if you like my work, Buy Xah Emacs Tutorial
thanks.
Emacs: Open File in External App 🚀
xah-open-in-external-app
code updated. now can be called from elisp. experimental.
Emacs Lisp: provide, require, features (minor update)
Emacs: Open File Path Under Cursor 🚀
code update. now, on url that contains a parenthesis, will work.
incomprehensible doc/spec from official big corps/orgs
now, having studied the whole, the org APIs are pretty good. My mistake was finding and reading that org-element.el doc, which lead to complete incomprehension.
when coding for work, often, you got 10 protocols/lang/names you need to understand. For each, you found 10 docs and tutorials. First you need to decide which to read. if you lucky, your 1st read is a good one. if unlucky, hours or days of bad taste in your mouth.
if official doc/tutorial are good, we don't have this problem. Often, the official ones are lousy. When the lang/protocol is from big corps, such as html/css/js/unix/tcp protocols, the official doc/spec e.g. from W3C ECMA RFC are usually entirely worthless.
doc/spec from W3C ECMA RFC etc are lousy not because they need to be formal or encompassing or academic computer science jargons. Rather, they are incomprehensible due to politics, commercialism, corp/org interests.
See also: doc by dummies
now, the tutorial is complete. Read it in 10 min, and you can write elisp code that extract tree structure and output in another format, such as json or graphviz DOT.
#emacs read the org mode syntax spec https://orgmode.org/worg/dev/org-syntax.html
it's the worst syntax spec ever written on this earth.
badly written, sloppy. it's nowhere like an actually syntax spec. Rather, it tries to describe the syntax to humans. but even at that, it's so badly written, ambiguous. not surprising, example: markdown the original version don't have syntax spec neither.
for example, i have a hard time understand its “greater element”, “element”, “object”. and its mention of “context free”, is questionable, rather completely bogus or misleading.
org-element.el, Parser for Org Syntax is written by Nicolas Goaziou. Don't know who he is, but great job. it's 6k lines. The org mode syntax spec, don't know who wrote it, very bad.
#emacs org mode. this is odd. i thought the maintainer is Bastien Guerry https://bzg.fr/ for over 10 years @bzg2
Emacs Lisp: How to Write a Toggle Command
reviewed and updated.
Emacs Lisp: Property List (updated)
Emacs Lisp: Symbol Property List (updated)
Emacs Lisp: Write grep (major update)
and See also, major updates
there's this package https://github.com/theodorewiles/org-mind-map , pretty lousy. errors. doesn't work.
See also: Intro to Mindmap, Gantt Chart, Graphviz
currently, looking at sacha's code for extracting org mode file's tree structure into elisp. http://pages.sachachua.com/evil-plans/ bottom. sweet
are there emacs written in Common Lisp or Scheme Lisp?
yeah. here's some old articles. 10 years old.
xah emacs tutorial good
thanks guys.
been working on my emacs/elisp tutorial in the past days. spent several hours a day, to review, and organize the pages. Today, this index about emacs key related topic, is much updated and reviewed.
i work on getting the emacs tutorial update sent to all buyers today.
xah emacs tutorial, new nav boxes and other updates
new nav boxes at Emacs Lisp Examples
and also added lots of other nav boxes at Practical Emacs Tutorial and other pages.
these nav boxes group pages of samiliar topic. They help organization.
also, updated ../sitemap.html
now 741 html pages.
there are lots more to do. As usual, i update the site and articles in a continuous style daily thru-out the years.
Emacs in Microsoft Windows FAQ minor update
now, the Practical Emacs Tutorial has much better table of contents. Each topic grouped into a box. still working on it.
subscribe to my YouTube channel
new organization, navigation box.
whenever you see a block like that on my emacs tutorial site, that means, each page will have the same navigation block.
It's for grouping purposes. I have written many commands over the years, many pages it's hard to categorize. A page can be under elisp tutorial section, or be under html helpers, or under text transformation section, etc. So, this grouping helps. A page may have multiple groupings.
by the way, categorization has always been a major prolem. there's duodecimal system, library of congress system, encyclopedia britannica system. In general, things are not a tree. But rather, complex graph of connections. (by the way, this also means, Object Oriented Programing is idiotic.) there is also keyword taxonomy. by the way, Wikipedia has several articles about this i've checked regularly since 10 years ago.
on a different topic, i haven't sent out emacs tutorial update yet. it's on my todo. sorry about that.
Emacs Lisp: Chinese Char To Reference Link (code update)
xah-find-replace-text to the rescue
a Chinese character etymology reference site's domain changed. #emacs to the rescue. 564 changes.
(xah-find-replace-text "http://www.chineseetymology.org/CharacterEtymology.aspx?submitButton1=Etymology&characterInput=" "http://hanziyuan.net/#" "/Users/xah/web/" "\\.html$" t t t t)
Mac processing video .mov .mp4 YouTube slow
here's my emacs videos. i haven't looked into what's in .mov format, but it's about 9 times size of mp4. (by the way, webm is even smaller). everytime you convert to mp4, all cpu ramp up, takes 1 hour to process 30 min video. Then, you have to upload to youtube, another 20 min.
usually i write in emacs, copy, switch to browser, paste. All copy past select all switch are done with single key strokes. Actually, switching is mostly done with mouse hover auto-click. (partly due to lack of physical F keys in past 4 years) Want me to do a video to demo? that'd be good topic.
Happy 2019
in 2018 i met few new emacs friends. Happy 2019 to
- https://twitter.com/JaafarTrull
- Ag https://twitter.com/iLemming
- George Jones https://twitter.com/eludom
- https://twitter.com/howardabrams
- Erik Anderson https://twitter.com/ebanders
- https://twitter.com/johnkitchin
- https://twitter.com/Tina_Russell
- Scott Bilik https://twitter.com/sbilik
- Tim Chambers https://twitter.com/tbc0
hope a great emacs road in 2019.
emacs video hangout
am going to work in #emacs. come in to say hi, chat. https://hangouts.google.com/call/vk5h4A08VADHMgD-AEOLAEEE