Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Friday, February 8, 2008

Demo of w3m integrated with emacs

Following post about w3m in emacs for searching for help demo was recorded, using screen capture tools described in previous post.

gif without X, with description given

swf with KDE interface

Thursday, February 7, 2008

emacs save your desktop with some commands history

... and load it on startup;

ecb was switched off;
placed following at the end of my .emacs:


%<-----------------------------
;; save a list of open files in ~/.emacs.desktop
;; save the desktop file automatically if it already exists
(setq desktop-save 'if-exists)
(desktop-save-mode 1)

;; save a bunch of variables to the desktop file
;; for lists specify the len of the maximal saved data also
(setq desktop-globals-to-save
(append '((extended-command-history . 50)
(file-name-history . 100)
(grep-history . 50)
(compile-history . 50)
(minibuffer-history . 50)
(query-replace-history . 50)
(read-expression-history . 50)
(regexp-history . 50)
(regexp-search-ring . 30)
(search-ring . 30)
(shell-command-history . 50)
tags-file-name
register-alist)))
------------------------------>%

Wednesday, February 6, 2008

Emacs Config: Search for Unix function on Open Group site

At the moment I am developing in C, often referencing to Open Group Unix specification from their site for description of networking *nix functions.

To simplify searching, Ctrl-F1 accelerator have been added in .emacs for searching keyword in Open Group index.

Corresponding part of my emacs config is:


%<--------

;; Manually edited part
(require 'w3m-load)
(setq browse-url-browser-function 'w3m-browse-url)

(defun browse-url-other-buffer(x)
"browse url wrapper; switches to other buffer; than browses"
(interactive)
(progn
(switch-to-buffer-other-window(other-buffer))
(browse-url x)))

(defun lookup-producer (x)
"used to produce function for looking up the
word under cursor in a browser."
(interactive)
(browse-url-other-buffer
(concat x
(thing-at-point 'word))))

(defun search-current-word-opengroup()
"search current word definition in opengroup UNIX spec"
(interactive)
(mapcar (lambda(x) (lookup-producer x) )
(list "http://www.opengroup.org/cgi-bin/kman?value=")))

(global-set-key (kbd "< C-f1>") 'search-current-word-opengroup)
---------->%

prerequisites:

w3m have to be installed.
get tar.gz from site of w3m development, gunzip; tar -xf.

Install process is your configuration specific.
Read README from root of untared directory.

For me (emacs 21.2.4 under cygwin, winXP) installation was:
./configure
./make install

Wednesday, January 23, 2008

HOWTO: Install CUA mode for cygwin emacs

Emacs is not comfortable due to its strange shortcuts for copying and pasting among all.

There is solution for those who prefer windows like shortcuts in emacs. It is called CUA-mode. It enables Ctrl-c, Ctrl-x, Ctrl-z, Ctrl-v copy/cut/undo/paste behaviour for selected text.

Current stable distribution of emacs under cygwin, 21.2.1, does not contain cua-mode built-in.

You have to install CUA manually to enable this behaviour under your cygwin emacs.

The steps are following:

  • 2) Save cua.el from bottom of the page in to the /usr/share/emacs/21.2/lisp/ cygwin path. (For my box it is C:\cygwin\usr\share\emacs\21.2\lisp\ )
  • 3) Edit your ~/.emacs file (from emacs or other editor you have ). Add following lines at the end of file:
    (require 'cua)
    (CUA-mode t)
  • 4) Restart emacs.

Enjoy.