HomeMathComputingArtsWordsLiteratureMusictwitter facebook webfeed
Loading

Xah's Emacs Blog Archive 2011-01 to 2011-04

Advertise Here For Profit
2011-04-25

Emacs: Form Feed and Source Code Section Paging Commands.

2011-04-17

New version of ErgoEmacs keybinding is out, at 5.3.9 (2011-04-17). Major changes since 5.3.7 (2010-11-15):

See 〔_HISTORY.txt〕 for full detail.

Download at: ErgoEmacs Keybinding.

2011-04-16

Color Shell Prompt in Emacs

Here's a neat setup for your shell prompt within emacs. Put it in your emacs init file.

(setenv "PS1" "\\e[0;32m◆\\u@\\H \\D{%Y-%m-%d} \\t\\e[0;30m\\w\\n")

It'll make your prompt color green and display login name, date, and time, like this:

◆xah@xah-PC 2011-04-16 01:49:16 ~

Date and time is useful because when you log your shell output, you have info about when a command is executed.

The shell command itself is this, you can put in your bash init file 〔~/.bash_profile〕:

export PS1="\e[0;32m◆\u@\H \D{%Y-%m-%d} \e[0;33m\t\e[0;37m\w\n";

The \e[0;32m in the beginning set the color green. The \e[0;37m near the end sets color back to black.

2011-04-15

David Capello created a new version of “command-frequency.el” now called “keyfreq.el”. See here for detail and download location:Emacs's Command Frequency.

2011-04-13

Emacs vs Windows Notepad (rant)

2011-04-10

Emacs Bug: 【C-u】 & (key-translation-map) disables “undo”.

See: Emacs Misc Bugs.

2011-04-08

Emacs Undo & Emacs Cult Problem.

2011-04-05

Complexity of software engineering: Emacs grep Problem in Windows.

2011-04-04

Reminder: you can get all my emacs and elisp tutorial. Close to 300 HTML pages, each HTML page is about 1 to 5 printed pages. It comes in simple HTML+CSS, without web ads, banners, or javascript. See: What People Say about Xah's Emacs Tutorial.

2011-04-03

Emacs Featured in Tron.

2011-04-03

Emacs Dired Bug: Delete File List Not Visible

See: Emacs Misc Bugs.

2011-03-29

A recent article that should be here: Emacs Keybinding Rant & a Glimpse of Xah Lee's Life 2010 (essay)

2011-03-26

New version of Emacs Unicode Math Symbols Input Mode (xmsi-mode) (for math symbol and unicode input). This version added about 102 full width symbols. e.g. “fw&” becomes “&”. (these chars probably not useful to most, but i use the fullwidth version of ampersand often to avoid encoding complexity in html) happy using.

See: HTML Entities, Ampersand, Unicode, SemanticsProblems of Symbol Congestion in Computer Languages (ASCII Jam; Unicode; Fortress).

2011-03-21

Emacs Lisp Batch Text processing: Grep Find Replace Variations

2011-03-18

Emacs: Remapping Keys Using key-translation-map.

2011-03-17

Discovered the command “display-time-world”. These days, when communicating with people around the world (in twitter, Skype, Second Life …), usually i need to know what time it is in their location. This command helps. Faster and more accurate than i can do mental calculation.

2011-03-16

Am tired of using dictionary within emacs. See bottom of Emacs Dictionary Lookup for reasons.

2011-03-11

Here's the complete solution to the asciify-word-or-selection problem. See bottom of Emacs Lisp: Asciify Unicode String (Zap Gremlins).

2011-03-10

A Curious Look at GNU Emacs's 1000+ Default Keybinding

2011-03-08

Update: How to Quickly Switch Fonts in Emacs

2011-03-08

Emacs: some problems of slowdown (tabbar, font) (some report of my experiences)

2011-03-07

Emacs Lisp: Asciify Unicode String (Zap Gremlins)

2011-03-04

artist-mode

Discovered “artist-mode”. It's a mode that lets you draw ascii pictures with the mouse.

Open a empty file. (in ErgoEmacs, 【Ctrl+n】. In GNU Emacs, 【Alt+x b】 (switch-to-buffer) then give a random name.) Now, you can draw with your mouse. Hold right button to erase. Middle click to switch to rectangle, ellipse, and other tools.

You can see a video of this guy using it at: Source www.cinsk.org.

I should warn that you should not get into a habit of using ascii art in comments, such as drawing boxes. Because, it is a form of hard-formatting. As such, it is not flexible and creates all sorts of problems. See:

For the same reason, i never liked any comment alignment in my source code, and i am annoyed that emacs by default aligns your comment when you call “comment-dwim” 【Alt+;

2011-03-02

Much improved my code for “get-selection-or-unit”. Also, a “unit-at-cursor” function is created. This is separated out because sometimes you want to get the thing at point, without caring whether there's a text selection. For the code, see: Emacs Lisp: get-selection-or-unit.

2011-03-02

refactoring my “.emacs”

Xah's log, stardate 2011-03-02T02:03:32-08:00.

Spent the past 5 hours refactoring elisp code in my .emacs. Not exactly thrilled. it's the kinda work that has no immediate benefit, but potentially disruptive. The software proverb goes: “if it ain't broken, don't fix it.”.

I'd say it's only half complete. But am tired of it at this (point). Actually, about every 4 months in past 4 years i spend several hours refactoring stuff there. (not counting the time adding stuff there) As the functions pile up, more time went into it. As my elisp kungfu increases, more is there to be refactored.

well, today, most work done is to replace “thing-at-point” by get-selection-or-unit. But alone the way, saw old code, and can't help to clean it.

Though, my strategy towards “.emacs” is still basically “don't bother unless you absolutely have to”. Organize Your “dot emacs” Init File in 5 Minutes.

2011-02-28

sgml-delete-tag bug

See: Emacs Bugs.

2011-02-27

Emacs Lisp: Find String Inside HTML Tag

2011-02-26

I want a command to insert random strings, as a ID. So i wrote one:

(defun insert-random-string ()
  "Insert a random alphanumerics string of length 5.
The possible chars are 0 to 9, and a to z (lower case)."
  (interactive)
  (let (mycharset (possibleCharsCount 36))
    (setq mycharset "1234567890abcdefghijklmnopqrstuvwxyz" )
    (dotimes (ii 5)
      (insert (elt mycharset (random possibleCharsCount))) ) ) )

O emacs! ♥

Thanks to Teemu Likonen 〔tliko…@iki.fi〕 for a improvement.

See also: Emacs Lisp Examples (Page 1)

2011-02-26

vi, Emacs, Keybinding Design

2011-02-25

Emacs Custom Keybinding to Enhance Productivity

If you explore Second Life, try Emacs LSL Mode (xlsl-mode) for Linden Scripting Language.

2011-02-24

Reminder. If you like this blog, you might also enjoy my other programer related blogs:

Usually i don't repeat a article in more than one place, even if it's related to both.

2011-02-23

Bad Advices from Programers about Typing and Keyboard (RSI)

2011-02-21

Emacs Lisp Tutorial: List & Vector

2011-02-20

Find & Replace is a central mechanism in text processing, especially in emacs. I took few hours to edit and re-organize several articles i've written that are all related to find & replace. Here's the re-organized index. It gives a much more clear view on what each article is about and how they relate to each other.

Using a Elisp Function for Dynamic Replacement String

Multi-Pair String Replacement

If you like them, please support the site. You can support by buying computer stuff from Amazon links here. USB drives, keyboard & mouse, iPad, mobile phones, laptops, DVDs, …. Or, you can get all my emacs and elisp tutorial. (See bottom of Xah Emacs Tutorial.) Or, you can support the site by a donation. Any amount counts. Thanks!

You can also ask emacs questions here: Ask Emacs.

2011-02-18

A little avanced emacs lisp tip today. Emacs Lisp: Using thing-at-point.

2011-02-12

ErgoEmacs version 1.9.2 binary for Windows is released. Download at ErgoEmacs 1.9.2 Setup.exe.

ErgoEmacs 1.9.x release notes

Thanks to David Capello for the build.

2011-02-12

New version: Emacs Math Symbols Input Mode (xmsi-mode)

2011-02-07

How to Write grep in Emacs Lisp (tutorial)

2011-02-07

I'm creating a Ask Emacs page. There, you can ask all sort of questions about emacs or elisp.

2011-01-28

Unicode 6 and Emacs 23.2 semi-Bug

See: Emacs Bugs.

2011-01-24

Emacs Tip: Stop Org-Mode Opening File in Folded View

If you use org mode, you can set it to not open files in folded view. Put the following in your “.emacs”:

(setq org-startup-folded nil )

I find this useful because when i do interactive find & replace on multiple files, if the org mode files open in folded view, you won't be able to see what's being replaced.

If you prefer to open org mode files in folded view, one solution is to temporarily set the variable org-startup-folded to nil before you do find & replace in a dir. Just call “set-variable”.

2011-01-21

Emacs Online Resources and Communities 2011

2011-01-18

A great tutorial about eshell. Mastering Eshell By Mickey Petersen. @ Source www.masteringemacs.org

See also: Emacs: What's eshell? “eshell” vs “shell” Difference?

2011-01-16

Hauke Rehfeld send in this improved version of “fold”.

(defun fold (f x list)
  "Recursively applies (F i j) to LIST starting with X.
For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)."
 (let ((li list) (x2 x))
   (while li
     (setq x2 (funcall f x2 (pop li)))
   )
   x2
  )
)

This one improves upon on a primitive one i've written, which has problems if element in the list eval to nil. For some info and a practical example of using “fold”, See: Elisp Examples: symbol properties, set frame, font, fold, shell call. Thanks Hauke.

2011-01-13

Xah Emacs Modes; Asking Your Support. (a list of emacs lisp code i've written. Your support also very much appreciated.)

2011-01-10

About 3 months ago, i started to use the Caps Lock key for emacs “M-x”. That's fantastic. If you are on Windows, here's a util that can make it happen.

Download it at this page: System-wide ErgoEmacs Keybinding for Windows, Mac, Bash.

2011-01-05

Useful for emacs users on Creating Keyboard Layout in Mac OS X.

2011-01-01

Want to learn a new lang in 2011? How about emacs lisp? (See: What is Your Favorite Lisp.)

Instead of a new year's resolution, which often are forgotten after Jan, let's have a resolution just for January.

So, what about setting a short-term goal for learning emacs and elisp? What do you wish to learn in January? Answer these questions. Before you answer, try to have a realistic, low-key goal, that you actually would achieve after Jan. Some of the questions below is about emacs/lisp if you think that's something you'll find helpful.

• Is there a language you wish to learn in Jan?

• What are some things you always wanted to know about emacs/elisp?

• Is it a particular emacs setup that's bugging you for a while?

• Any particular mode, package, you wished to install or know more?

• Do you have a basic understanding of elisp?

• Is it some basic understanding of elisp you always wanted?

• What would be some pratical things that would help in your job?

• How much time you can devote to learning (your choice of new lang or elisp)? (i recommend no more than 30 min a day, but at least every other day. You must stick to this schedule)

• At the end of the month, what would be some things that can concretely measure your effort? (a small set of learning notes? A small program as a project?)

Post your answers below.

blog comments powered by Disqus