| How To Define Templates In YASnippet |
[Feb. 18th, 2009|04:10 pm] |
perm url http://xahlee.org/emacs/yasnippet_templates_howto.html
plain text version follows: ------------
How To Define Templates In YASnippet
Xah Lee, 2009-02-18
This page shows you how to define your own templates for emacs's YASnippet template system.
YASnippet is a template system for emacs. It allows you to type a abbrevation and automatically expand the abbreviation into function templates. Bundled language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML, CSS and more. But you can define your own template set for your own language, or for any text that you need a template.
You will need to have yasnippet installed. If you haven't already, see: http://code.google.com/p/yasnippet/.
( Read more... ) |
|
|
| Emacs Prolog Major Mode Fixed |
[Feb. 7th, 2009|11:28 pm] |
Hello Friends
You may remember this issue.
I've been communicating with Stefan Bruda, maintainer of the prolog.el major mode and he decided to make the fix himself :) I've tested it and sent him confirmation that the fix works. He may soon post version 1.18 with the included fix to the official download page. |
|
|
| Updating Atom/RSS with Elisp |
[Jan. 21st, 2009|03:03 pm] |
This page describes a real world example of using emacs to update a web syndication (RSS/Atom) page. If you don't know elisp, see: Emacs Lisp Basics. The Problem
Summary
I want to write a command, so that, when invoked, the current selected text will be added as a entry in a RSS/Atom file.
This lesson will show you how write a command that grabs the region text, switch buffer, search string to locate position for inserting text, insert the text, and update date field in a file.
perm url: http://xahlee.org/emacs/elisp_update_atom.html |
|
|
| Suggestions on Emacs's Line-Cutting Commands |
[Dec. 11th, 2008|12:57 pm] |
Suggestions on Emacs's Line-Cutting Commands
Xah Lee, 2008-12-10
Emacs has a command fill-paragraph (Alt+q) that inserts a newline char for every run of about 70 chars. This command is especially useful when writing email or plain text based report. Emacs also have fill-region, which is to be used on a text selection. Emacs also have fill-buffer, that does to a whole file's text. However, there are some usability problems with these commands. This page discuss the problems and some suggestions.
• Suggestions on Emacs's Line-Cutting Commands http://xahlee.org/emacs/modernization_fill-paragraph.html
plain text version follows below
( Read more... ) |
|
|
| Suggestions on Emacs's mark-word Command |
[Dec. 9th, 2008|01:16 pm] |
• Suggestions on Emacs's mark-word Command
http://xahlee.org/emacs/modernization_mark-word.html
plain text version follows. (formatting is screwed up)
------------------------- Suggestions on Emacs's mark-word Command
Xah Lee, 2008-12-09
Emacs has a command to select the current word, mark-word, with default shortcut of “Alt+@”. Selecting the current word is a frequently needed operation. However, emacs's mark-word command is inconvenient. It does not select the whole word. It only select from the cursor position to the end of the word. For example, if your word is “transmission”, and your cursor is at the “m”, then it will select just “mission”. To select the whole word, you need to move the cursor to the beginning of the word first. Also, mark-word has a feature that if you repeat the command, then it extend the selection to the next word to the right.
Here we suggest a improvement. We want a command that select the whole word. When repeated, it should select the next larger syntactic unit. In human languages, that would be sentence, then paragraph, then whole buffer. In computer languages, the sequence would be: current identifier, current expression, current construct (or line), current block or defun. Similarly, if the lang is lisp, it simply extend the selection to the next outer parens. For detailed example of this, see: A Text Editor Feature: Extend Selection By Semantic Unit.
( Read more... ) |
|
|
| Problems with Emacs Prolog Major Mode |
[Dec. 3rd, 2008|01:14 pm] |
It seems that this site is the location of the most popular Emacs mode for Prolog. I've tried both the Debian package and the source distribution and neither of them seem to do a good job at syntax highlighting. For example, syntax of the form foo(X). (a functor) is correctly highlighted if it is a) the only functor on a line and b) not preceded by a tab or space character. I have GLOBAL-FONT-LOCK-MODE set to T and some Lisp/SLIME-specific stuff in my .emacs file. Nothing else.
Screenshot:
 Note how color(5,green,b). is not colored and how all indented functors starting with adjacent(X,Y). are not colored. My question: Has anyone experienced this problem? If so, have you fixed it with an alternative Prolog mode? I know Lisp syntax. How easy is it to wade into an Emacs mode definition file and modify it so it works as desired? Will I have to face a high learning curve if I try to do so? |
|
|
| Emacs's Mode Line Modernization Suggestions |
[Nov. 15th, 2008|05:24 pm] |
• Emacs's Mode Line Modernization Suggestions http://xahlee.org/emacs/modernization_mode_line.html
plain text version follows:
----------------------------------------
Emacs's Mode Line Modernization Suggestions
Xah Lee, 2008-12
This article gives some suggestions on improving emacs's “mode line”, so that it is more intuitive and useful.
I think the mode line is one of emacs's problem in usability. emacs mode line
above: Emacs's mode line.
Here's what i think are better default:
( Read more... ) |
|
|
| Dictionary and Reference Lookup with Emacs |
[Nov. 2nd, 2008|01:11 am] |
Dictionary and Reference Lookup with Emacs
perm url: http://xahlee.org/emacs/emacs_lookup_ref.html
plain text version follows: (lisp code formatting may be screwed up)
--------------------------------
Dictionary and Reference Lookup with Emacs
Xah Lee, 2008-11
This page shows you how to use emacs as a dictionary application, that allows you to lookup the definitions of a word under cursor, or any general reference such as Wikipedia or Google.
( Read more... ) |
|
|
| js-comint.el - an interactive javascript mode for use with js2-mode. |
[Oct. 31st, 2008|09:34 am] |
Hey Guys.
I just made my first official release of js-comint.el.
Js-comint.el is a javascript comint mode which lets you run a javascript interpreter from within emacs. It's hosted on http://sourceforge.net/projects/js-comint-el and has a web page which can be found here: http://js-comint-el.sourceforge.net/
It works really well in conjunction with js2-mode by Steve Yegge for javascript editing. With a couple of extra lines of elisp, you can be editing along some javascript, hit C-x C-e and execute the javascript in a javascript interpreter like Rhino or Spidermonkey.
Questions or comments can be sent to me via e-mail (check the .el for my e-mail). As I'm a bit of an amateur elisper, suggestions for imrpovement are always welcome. |
|
|
| A Text Editor Feature: Extend Selection By Semantic Unit |
[Oct. 23rd, 2008|12:34 pm] |
A Text Editor Feature: Extend Selection By Semantic Unit
perm url: http://xahlee.org/emacs/syntax_tree_walk.html
plain text version follows. (however, you need css to see the point. lisp code also screwed up in the following) ----------------
A Text Editor Feature: Extend Selection By Semantic Unit
Xah Lee, 2006-09, 2008-10
In this article, i introduce a feature in the Mathematica↗ frontend (that is, the editor bundled with Mathematica), that could be useful in any editor and for any language.
In Mathematica frontend, a user can press a key (“Ctrl+.”), and the token the cursor is on will be selected (highlighted), when user presses the key again, the selection expands to highlight the next smallest semantic unit . When the key is pressed again, it extends further.
( Read more... ) |
|
|
| Macro Trouble |
[Sep. 8th, 2008|08:40 pm] |
Hello Friends
Lisp newbie here running into a bit of trouble when using Macros.
(defun fun (args)
(mapcar #'(lambda (x) (print x)) args))
(defmacro macro (&rest args)
`(progn ,@(fun args)))
(defun test ()
(macro 'a 'b '(c d)))
Trouble is, I can't get this code to compile. It seems that the compiler can't recognize that the function FUN is defined on line 1. When it attempts to compile the function TEST, SBCL/Slime throws the following error:
CL-USER> (load (compile-file "macro.lisp"))
; compiling file "/home/jde/CAP5635/proj/numbrix/macro.lisp" (written 08 SEP 2008 08:38:21 PM):
; compiling (DEFUN FUN ...)
; compiling (DEFMACRO MACRO ...)
; compiling (DEFUN TEST ...)
; file: /home/jde/CAP5635/proj/numbrix/macro.lisp
; in: DEFUN TEST
; (MACRO 'A 'B '(C D))
;
; caught ERROR:
; (in macroexpansion of (MACRO # # ...))
; (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
; The function FUN is undefined.
;
; compilation unit finished
; caught 1 ERROR condition
; /home/jde/CAP5635/proj/numbrix/macro.fasl written
; compilation finished in 0:00:00
T
The same test was causing clisp to abort with a stack overflow error!
Got any ideas? Is there a fallacy in my approach? How do I convince the compiler that FUN really is defined before test is compiled?
Thanks! |
|
|
| generating sitemap with emacs lisp |
[Jul. 3rd, 2008|04:13 am] |
Here's a little tutorial on text processing with emacs lisp.
I want to use elisp to create a sitemap. More specifically, generate a list all files of a given directory including its subdirectories, for each file create a url string in some particualr XML form, and put the whole result into a file with proper header and footer texts.
HTML version with syntax coloring and links is at: http://xahlee.org/emacs/make_sitemap.html
livejournal screws up raw html source code so no text version here.
Also, my emacs and elisp tutorial is now downladable. Download link at bottom of http://xahlee.org/emacs/emacs.html |
|
|
| navigation |
| [ |
viewing |
| |
most recent entries |
] |
| [ |
go |
| |
earlier |
] |
| |
|
|