[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]

elisp question



Hi listers,

Our company wants to have on-line code reviews to increase productivity.
Want we need is a macro for emacs to open a blank line above the line where
point is currently, and insert a /* opening comment delimiter, 3 # signs and
the user's login name.  Then 2 blank lines and an ending comment delimiter
*/.  At the end the currsor will be placed on the line above the end comment
delim.  

Here is the macro and key binding I wrote:

;;; Provides a macro named code-review-comment to aid online code reviews. 

(fset 'code-review-comment
   [?\C-a ?\C-o ?/ ?* ?  ?# ?# ?# ?  ?- ?  escape ?1 escape ?! ?e ?c ?h ?o ?
?$ ?U ?S ?E ?R return ?\C-x ?\C-x return return ?* ?/ ?\C-p ?\C-a])

;;; Binds macro code-review-comment to control-c control-r.

(global-set-key "\C-c\C-r" 'code-review-comment)

	I recorded the macro with C-x ( and stopped it with C-x ).  Then I
named the macro code-review-comment.  Next I inserted it into a file with
the M-x insert-kbd-macro.  

This macro will be loaded from a shell script by invoking emacs with the -l
option and supplying the file which contains the macro and key binding.  It
can also be used by adding the line
(load "code_review_comment.el") 
in the .emacs file. 

The trouble is that not everyone uses the same shell.  The macro works fine
for me and I use c shell, but someone tried this out who used tcsh and had
problems.  

Should I set the value of shell-file-name to "/bin/csh" at the beginning of
the macro file?

In order to get the value of the users login name I'm recording escape !
echo $USER in the macro.  Is there a way in elisp to directly access the
value of environment variables?  

Any suggestions would be appreciated.   
Mo 


-----------------------------------------------------------------------------
       To unsubscribe or change your address send mail to
"emacspeak-request@xxxxxxxxxxx" with a subject of "unsubscribe" or "help"


Emacspeak Files | Subscribe | Unsubscribe