Xah Emacs Blog Archive 2019-01
Emacs: Novel Reading Mode
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.
lets you do, but extremely slow. 10 times slow.
it's supposed to be faster cuz it skip some sub-directories. 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: Elisp: 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
[see Elisp: 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.
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's 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.
Elisp: Simple Emacs Lisp Examples (minor update)
org mode Topic
reviewed and updated
Emacs: Org Mode Markup Cheatsheet . added properties, drawers, tags, etc.
UHK LISP keyboard
thanks a lot guys.
if you like my work:
Xah Emacs Tutorial update
Xah Emacs Tutorial update has been sent out to previous buyers.
if you like my work, Buy Xah Emacs Tutorial
you can see part 1 in the link on YouTube.
Elisp: Cursor Position Functions
Elisp: Read/Write File
on Surface Book, golang, haskell, beautiful languages, racket scheme lisp, clojure, java, enterprise coding, writing tutorial, cutthroat tutorial industry, money, and emacs!
Review of the Ultimate Hacking Keyboard
For detailed written review, see Ultimate Hacking Keyboard
Emacs: Open File in External App
xah-open-in-external-app code updated. now can be called from elisp. experimental.
Elisp: 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
Elisp: Parse Org Mode
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 no where 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, e.g. 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
Elisp: Lisp Symbol
Elisp: How to Write a Toggle/Cycle Command
reviewed and updated.
Elisp: Property List (updated)
Elisp: Symbol Property List (updated)
Elisp: 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
Emacs: Jump to Previous Position
Intro to Mindmap, Gantt Chart, Graphviz
Emacs: Move Image File
are there emacs written in Common Lisp or Scheme Lisp?
yeah. here's some old articles. 10 years old.
xah emacs tutorial good
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.
Emacs Keybinding, Keyboard, Articles Index
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 Command 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 Xah Emacs Sitemap
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.
xah emacs talk show 2019-01-07 xah-html-mode vs org mode
- writing raw html
- Japanese writing system
emacs talk: vim golf delete lines
new video. emacs talk: vim golf delete lines https://www.youtube.com/watch?v=XHfVYRkxxLQ am experimenting with video style. e.g. professional, focused, comedic, community building, nutjob as myself, heroic hacker, etc. lol. and lol style.
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.
emacs talk show. workflow. command log mode, working with raw html
#emacs talk show. my video skill improved. still need to cut verbosity.
randomish topic discussed:
- command log mode
- add html nav bar
- categorization problem
- 15:50 undo hell
- using xah-fly-keys.el and xah-html-mode.el
subscribe to my YouTube channel
video. The most efficient ways to switch window/app in linux, Mac, Windows.
- Set Key to Switch to emacs/terminal/browser How to Set Key to Switch to Browser
- Mac autoclick Mac: Hover to Switch Window
- Linux hover raise window Linux: Mouse Hover to Auto-Raise Window
- Linux autoclick Linux: Mouse Hover-Click
- ban Key Chords Banish Key Chords
- Why Function Keys Are Useful Why Function Keys Are Useful
comment on my YouTube or discuss on reddit https://www.reddit.com/r/emacs/comments/ach96l/most_efficient_ways_to_switch_windowapp/
a lot people like the style of type somethig to search. I think it began with the Mac app QuickSilver back around 2004. Then, it spread to MacOS, Microsoft Windows, Linux, and emacs (helm. was known as “everything”)
personally i don't like that workflow. (and actually don't use it in any OS nor in emacs)
with respect to switching windows/app, note that, the type something method is far less efficient. With function keys, it's just 1 key stroke. With the text search method, first a key combo to bring up the search box, then 3 or more letters. Though, it has advantage of being useful in general and no need setup. But i think its still better to set function keys. Can have both.
new organization block
Emacs Text Transform Under Cursor
- elisp wrapper + Python Ruby …
- Toggle Letter Case
- Title Case
- Upcase Sentences
- Cycle Space Hyphen Underscore
- Escape Quotes
- Quote Lines
- Spaces to New Lines
- Change Brackets/Quotes
- Remove Accent Marks
- Convert Straight/Curly Quotes
- Convert English/Chinese Punctuations
- Color Conversion (RGB, HSL, HSV)
- Decimal to Hexadecimal
- Replace Greek Letter Names to Unicode
- Twitterfy Text
- Toggle line wrap
- Clean White Space
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.
Elisp: Chinese Character Reference Linkify (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)
Emacs: xah-find.el, Find Replace in Pure Elisp
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.
in 2018 i met few new emacs friends. Happy 2019 to
- Ag https://twitter.com/iLemming
- George Jones https://twitter.com/eludom
- Erik Anderson https://twitter.com/ebanders
- 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