[Python-mode] evil underscore as word

Stephen J. Turnbull stephen at xemacs.org
Tue Dec 6 09:50:03 CET 2005


>>>>> "Ben" == Ben Wing <ben at 666.com> writes:

    Ben> btw is anyone maintaining python-mode?

Yes.

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



-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.


More information about the Python-mode mailing list