[Python-mode] evil underscore as word

Ben Wing ben at 666.com
Tue Dec 6 08:38:55 CET 2005


btw is anyone maintaining python-mode?

despite the following comment:

  ;; For historical reasons, underscore is word class instead of
  ;; symbol class.  GNU conventions say it should be symbol class, but
  ;; there's a natural conflict between what major mode authors want
  ;; and what users expect from `forward-word' and `backward-word'.
  ;; Guido and I have hashed this out and have decided to keep
  ;; underscore in word class.  If you're tempted to change it, try
  ;; binding M-f and M-b to py-forward-into-nomenclature and
  ;; py-backward-into-nomenclature instead.  This doesn't help in all
  ;; situations where you'd want the different behavior
  ;; (e.g. backward-kill-word).
  (modify-syntax-entry ?\_ "w"  py-mode-syntax-table)

imho it is *not* acceptable to have a random deviation like this.  
python is no different from c, perl, etc. in its treatment of 
underscores and should absolutely not have such a gratuitous 
incompatibility.  there's a reason why backward-word and backword-sexp 
don't do the same thing; if you want to move by entire identifier, use 
the latter.  with _ as symbol, you have a choice; with _ as word, 
there's no way to [e.g.] delete a single word of an identifier like 
`word_with_final_syllable'.

ben


More information about the Python-mode mailing list