Home
Emacs [entries|archive|friends|userinfo]
Emacs

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

How To Define Templates In YASnippet [Feb. 18th, 2009|04:10 pm]

xah_lee
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... )
linkpost comment

Emacs Prolog Major Mode Fixed [Feb. 7th, 2009|11:28 pm]

jkndrkn
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.
linkpost comment

Updating Atom/RSS with Elisp [Jan. 21st, 2009|03:03 pm]

xah_lee
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
linkpost comment

A Emacs Frustration (blogger package) [Jan. 9th, 2009|01:05 pm]

xah_lee
A Emacs Frustration (blogger package)

perm url http://xahlee.org/UnixResource_dir/writ/emacs_blogger_package_pain.html

plain text version follows -----------------------

A Emacs Frustration (blogger package)

Xah Lee, 2009-01-09

Spent like 2 hours trying to get a emacs package to work, which would allow me to write my blog in emacs and upload it to blogger.com (aka blogspot.com) without going thru browser. I was mother fucking pissed by the fucking fuckface tech geekers.

The packages in question are: “blogger.el” by Mark Hershberger at “http://www.emacswiki.org/emacs/BloggerMode” and “weblogger.el” by Mark Hershberger at “http://www.emacswiki.org/emacs/WebloggerMode

Read more... )
link4 comments|post comment

Suggestions on Emacs's Line-Cutting Commands [Dec. 11th, 2008|12:57 pm]

xah_lee
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... )
linkpost comment

Suggestions on Emacs's mark-word Command [Dec. 9th, 2008|01:16 pm]

xah_lee
• 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... )
linkpost comment

How To Process A File Line By Line In Elisp [Dec. 6th, 2008|01:05 am]

xah_lee
• How To Process A File Line By Line In Elisp http://xahlee.org/emacs/elisp_process_lines.html

plain text version follows (formatting is screwed up)

Read more... )
linkpost comment

Problems with Emacs Prolog Major Mode [Dec. 3rd, 2008|01:14 pm]

jkndrkn
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:
Emacs Prolog Mode Syntax Coloring Issues

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?
link3 comments|post comment

How To Add “alt=” To Image Tags With Emacs Lisp [Dec. 2nd, 2008|03:08 pm]

xah_lee
• How To Add “alt=” To Image Tags With Emacs Lisp
http://xahlee.org/emacs/lisp_update_image_tag.html

plain text version follows (lisp code formatting is screwed up)
Read more... )
linkpost comment

How To Write A Emacs Major Mode For Syntax Coloring [Nov. 20th, 2008|01:59 pm]

xah_lee
• How To Write A Emacs Major Mode For Syntax Coloring http://xahlee.org/emacs/elisp_syntax_coloring.html

plain text version follows. (lisp code formatting may be screwed up)

-------------------

How To Write A Emacs Major Mode For Syntax Coloring

Xah Lee, 2008-11

This page gives a practical example of writing a emacs major mode to do syntax coloring of your own language. You should have at least few months experience of coding emacs lisp.

Read more... )
link3 comments|post comment

Emacs's Mode Line Modernization Suggestions [Nov. 15th, 2008|05:24 pm]

xah_lee
• 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... )
linkpost comment

Dictionary and Reference Lookup with Emacs [Nov. 2nd, 2008|01:11 am]

xah_lee
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... )
link6 comments|post comment

js-comint.el - an interactive javascript mode for use with js2-mode. [Oct. 31st, 2008|09:34 am]

phuff
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.
link4 comments|post comment

A Text Editor Feature: Extend Selection By Semantic Unit [Oct. 23rd, 2008|12:34 pm]

xah_lee
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... )
linkpost comment

Elisp Wrapper For Perl Scripts [Oct. 15th, 2008|05:50 pm]

xah_lee
Elisp Wrapper For Perl Scripts

This page shows a example of writing a emacs lisp function that process text on the current region, by calling a external perl script. So that you can use your existing knowledge in a scripting language for text processing as emacs commands.

perm url: http://xahlee.org/emacs/elisp_perl_wrapper.html

text version follows: Read more... )
linkpost comment

(no subject) [Oct. 7th, 2008|06:39 am]

xah_lee
Suggestions on Emacs's Scratch Buffer

Xah Lee, 2008-09

In the article The Modernization of Emacs, i suggested that emacs's “*scratch*” buffer be removed. In this article, i give some detail about it.

perm url: http://xahlee.org/emacs/modernization_scratch_buffer.html

text version follows: Read more... )
linkpost comment

(no subject) [Oct. 7th, 2008|06:35 am]

xah_lee
Usability Problems With Emacs's Letter-Case Commands

perm url: http://xahlee.org/emacs/modernization_upcase-word.html

Read more... )
linkpost comment

Macro Trouble [Sep. 8th, 2008|08:40 pm]

jkndrkn
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!
link5 comments|post comment

emacs logo in svg [Aug. 12th, 2008|08:06 am]

xah_lee
http://xahlee.org/emacs/emacs_logo.html
linkpost comment

generating sitemap with emacs lisp [Jul. 3rd, 2008|04:13 am]

xah_lee
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
linkpost comment

navigation
[ viewing | most recent entries ]
[ go | earlier ]

Advertisement