Posts

Showing posts from May 2, 2010

My Dick (song)

Post deleted. See here instead: http://xahlee.org/music/my_dick.html

Emacs Line Return And Dos, Unix, Mac, All That ^M ^J

Image
Perm url with updates: http://xahlee.org/emacs/emacs_line_ending_char.htmlEmacs Line Return and Windows, Unix, Mac, All That ^M ^J ^LXah Lee, 2010-05-07This page explains line ending conventions Windows, Unix, Mac, and how to change them with emacs.Here's a short table about different newline convention and how to input them:NameASCII Codestring notationCaret NotationAbbrevInput methodline feed10\n^JLFCtrl+qCtrl+jcarriage return13\r^MCRCtrl+qCtrl+m or Ctrl+qEnterFollowing is the newline convention in different operating systems.Operating SystemNewline ConventionNotesUnix, Linux, Mac OS X^JMac OS X prefers ^J, but accept the Mac OS Classic's ^M too.Windows^M^J◇Mac OS Classic^M◇Why does emacs show ^M in a buffer?The “^M” is ASCII caret notation for unprintable Carriage return char (ASCII 13). If emacs shows that, it's probably because you have mixed characters of ^M and ^J and emacs cannot interpret them consistently as newlines.To fix it, call “set-buffer-file-coding-system…

Regex Limits, or, Should You Read Mastering Regular Expressions?

Perm url with updates: http://xahlee.org/UnixResource_dir/writ/regex.htmlRegex Limits, or, Should You Read Mastering Regular Expressions?Xah Lee, 2010-05-06On 2010-05, David wrote:Go read O'Reilly's Mastering Regular Expressions by Jeffrey Friedl. ... good price, and explained a great deal.I read the first edition in 1999. (see: Perl Book Reviews.)Last i looked, the 3rd edition in 2006, they dropped coverage on emacs regex.In general, i don't recommend the book if all you need is to master a regex for practical coding. I recommend the book highly if regex research is part of your job. e.g. you need to implement a regex, or get a intro of its history, theory, and available implementations.The book gives a intro to the history and a bit of its original theory, but the large part is practical intro to regex engines as in unix grep, Perl, PHP, Java, “.NET”.Regex is useful for matching simple words or phrases. When your need for text pattern matching is slightly more complex t…

where and which emacs to download for windows and mac?

Perm url with updates: http://xahlee.org/emacs/which_emacs.htmlWhich Emacs to Download?Xah Lee, 2010-05-06This page is a guide on what emacs distributions are there, which one you should use, for Windows and Mac.WindowsGNU EmacsThis is the official GNU Emacs, build for Windows.http://ftp.gnu.org/pub/gnu/emacs/windows/Just download, unzip, and use right there. No installation step needed.NTEmacsNTEmacs is the latest build of GNU Emacs for Windows. Plain GNU Emacs for Windows.http://ntemacs.sourceforge.net/EmacsW32+EmacsThis is a emacs distro build by Lennart Borgman. It is a emacs with Windows specific patches, with some extra elisp packages bundled.Main feature includes the ability to use the Alt key to invoke menu like other Windows apps; fixes such as to make printing easier, makes emacs ftp work..., bundled nXhtml mode for mixed HTML/CSS/Javascript code, ...Download at: ourcomments.org.Download the patched version. Then, run the installer.ErgoEmacsMain feature includes a ergonomic…

mac os x mouse too slow

Perm url with updates: http://xahlee.org/comp/mac_osx_mouse_too_slow.htmlMouse Speed Too Slow in Mac OS X?Xah Lee, 2010-05-05The mouse on Mac OS X is often too slow, even if you have used the Preference pane to set the tracking speed to the fastest. You can fix this. Start Terminal.app, then type: defaults read -g com.apple.mouse.scaling The above will show your current scaling value. To make it faster, do: defaults write -g com.apple.mouse.scaling 5 You need to re-login for this to take effect. Best Trackball MouseLogitech Trackball Mouse ReviewsWhat's Mouse DPI and Does It Matter in Real-Time Combat Gaming?Mac OS X “.dmg” File and Command Line TutorialMac OS X Resource Fork and Command Line Tips

List Matching Lines and Delete Matching Lines in Emacs

Perm url with updates: http://xahlee.org/emacs/elisp_list_matching_lines.htmlList Matching Lines and Delete Matching Lines in EmacsXah Lee, 2010-05-03Emacs has a very useful command list-matching-lines. For example, open a file, then type “Alt+x list-matching-lines”. Then, give a word. Emacs will list all lines containing that word.You can click on any matched line in the output, then emacs will put cursor at the position of the occurrence in your file.There are also several other line processing commands for the current buffer that i use often: list-matching-lines delete-matching-lines delete-non-matching-lines sort-lines sort-numeric-fields reverse-region Shortcuts and AliasesIf you use them often, you can give them a keyboard shortcut, like this: (global-set-key (kbd "<f6>") 'list-matching-lines) ; F6 key (global-set-key (kbd "M-8") 'list-matching-lines) ; Alt+8 For defining more complex key combos, see: How to Define Keyboard Shortcuts in Emacs.…

Elements of Style in English

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/bangu/elements_of_style.htmlElements of Style in EnglishXah Lee, 2010-05-02Was reading Wikipedia on The Elements of Style. Here's a interesting quote:Edinburgh University linguistics professor Geoffrey Pullum has criticized The Elements of Style, saying:The book’s toxic mix of purism, atavism, and personal eccentricity is not underpinned by a proper grounding in English grammar. It is often so misguided that the authors appear not to notice their own egregious flouting of its own rules . . . It’s sad. Several generations of college students learned their grammar from the uninformed bossiness of Strunk and White, and the result is a nation of educated people who know they feel vaguely anxious and insecure whenever they write 'however' or 'than me' or 'was' or 'which,' but can’t tell you why.[9] Specifically, Pullum says Strunk and White were misguided in identifying the passive voice as in…