Doing autosys / autorep searches in an emacs buffer
I'm going to need to start an emacs code page - It's actually quite easy once you get the hang of lisp. I'm surprised it took me so long to realise that if you think like TCL then you're half way there!
(defun arep (arep-job) "Lookup a JOB with autorep" (interactive "sJob: ") (setq arep-query (concat "%" arep-job "%")) (setq arep-buffer-name (concat "*autorep " arep-query "*")) (pop-to-buffer arep-buffer-name) (setq buffer-read-only nil) (erase-buffer) (call-process "autorep" nil arep-buffer-name t "-j" arep-query) (highlight-regexp "__+" 'hi-red-b) (call-process "autorep" nil arep-buffer-name t "-j" arep-query "-q") (highlight-regexp "----+" 'hi-red-b) (highlight-regexp "^ *[^#: ]+:" 'font-lock-builtin-face) (highlight-regexp "#.*$" 'font-lock-comment-face) (goto-line 1) (setq buffer-read-only t) (set-buffer-modified-p nil) )Update: If you like the above, you'll love jil-mode.el - I should be able to replace the bodgy highlight-regexp with it. I had to make the following change to correctly highlight lines preceded with spaces: (defconst jil-font-lock-keywords
'(("^[ \t]*\\(\\(\\sw\\|\\s_\\)+\\)\\>:" (1 font-lock-constant-face))
("<\\([^>\t ]+\\)\\([\t ]*\\([^=>]+\\)=\\([^>\t ]+\\)\\)*>"
(1 font-lock-builtin-face)
(3 font-lock-type-face nil t)
(4 font-lock-variable-name-face nil t))
("\\<\\(SUCCESS\\|FAIL\\|AND\\|EXITCODE\\)\\>" (1 font-lock-function-name-face)))
"Additional expressions to highlight in Assembler mode.")
12:54 PM, 13 Feb 2006 by Mark Aufflick Permalink | Comments (0) Search ruby docs (ri) in emacs
It's far from perfect, but it's a start and it applies ansi colors. My emacs lisp is pretty bad, so please feel free to provide enhancements.
Note one MAJOR bug is that if you have a buffer called *shell* it will switch there instead of your docs (so rename your shell buffers to something else). What I really need to do is figure out how to use ansi-color.el outside the interactive shell.
(defun ri (ruby-class-name)
"Lookup a class in ri and put it into a buffer"
(interactive "sClass: ")
(let* ((explicit-shell-file-name "ri")
(explicit-ri-args '("-T" "-f" "ansi"))
(rishell-buffer-name (concat "*ri " ruby-class-name "*")))
(comint-check-proc rishell-buffer-name) ; see shell.el
(if (not (get-buffer rishell-buffer-name))
(progn
(setq ansi-color-for-comint-mode t)
(add-to-list 'explicit-ri-args ruby-class-name)
(shell)
(rename-buffer rishell-buffer-name)
))
(pop-to-buffer (get-buffer rishell-buffer-name))
(setq buffer-read-only t)
(setq buffer-modified-p nil)
(goto-line '1)
))
01:45 AM, 13 Feb 2006 by Mark Aufflick Permalink | Comments (0) |
Archive
November 2008 October 2008 September 2008 August 2008 July 2008 June 2008 May 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 January 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 February 2005 January 2005 December 2004 November 2004 October 2004 September 2004 August 2004 July 2004 June 2004 May 2004 April 2004 March 2004 February 2004 January 2004 December 2003 November 2003 October 2003 September 2003 August 2003 Notifications Request notifications
Recent Comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Request notifications