Patch for Emacs erang-mode

Victor Ren <>
Mon Jul 20 05:25:22 CEST 2009


Hello,

When erlang-mode is loaded, the templates defined in erlang-mode is
added to tempo-tags (the default tags for all mode in Emacs). So
unexpected template expansions may happen in other mode.  

I bind "space" with a function which expand the template when a
tempo-tag is detected.   In Emacs erlang-mode, when I input "if ", the
if statement will be inserted automatically.  But this also happen in
other mode. 

I build a patch to fix this problem.   The solution is to add tempo tags
for elang-mode to a mode special taglist - erlang-tempo-tags and
activiate these tags only in erlang-mode.

*** /usr/lib/erlang/lib/tools-2.6.2/emacs/erlang.el     Mon Jul 20
11:07:41 2009
--- /usr/erlang.el    Mon Jul 20 11:07:45 2009
***************
*** 562,567 ****
--- 562,570 ----
  
  ;; Tempo skeleton templates:
  
+ (defvar erlang-tempo-tags nil
+   "Tempo tags for erlang mode")
+ 
  (defvar erlang-skel
    '(("If"            "if"            erlang-skel-if)
      ("Case"          "case"          erlang-skel-case)
***************
*** 2003,2008 ****
--- 2006,2012 ----
    (erlang-tags-init)
    (erlang-font-lock-init)
    (erlang-skel-init)
+   (tempo-use-tag-list 'erlang-tempo-tags)
    (run-hooks 'erlang-mode-hook)
    (if (zerop (buffer-size))
        (run-hooks 'erlang-new-file-hook)))
***************
*** 2888,2894 ****
  			  ;; variables describing the templates take
effect
  			  ;; immdiately.
  			  (list (list 'erlang-skel-include (nth 2 (car
skel))))
! 			  (nth 1 (car skel)))
  		 (setq menu (cons (erlang-skel-make-menu-item
  				   (car skel)) menu))))
  	  (setq skel (cdr skel)))
--- 2892,2900 ----
  			  ;; variables describing the templates take
effect
  			  ;; immdiately.
  			  (list (list 'erlang-skel-include (nth 2 (car
skel))))
! 			  (nth 1 (car skel))
!               (car skel)
!               'erlang-tempo-tags)
  		 (setq menu (cons (erlang-skel-make-menu-item
  				   (car skel)) menu))))
  	  (setq skel (cdr skel)))


More information about the erlang-patches mailing list