0

I'm trying to configure other programs to emulate Emacs.

I know Emacs' word delimiters are:

  1. User configurable
  2. Mode dependent

But I'd still like to know what the default word boundary characters are. Because they are configurable and variable, I haven't found any lists.

I would love a list of the default word separators in emacs-lisp-mode. Of course, a description of how the delimiters vary by mode would be awesome too.

2

1 Answer 1

3

As far as I understand, in emacs -- word boundary is when next to a "w" syntax class stands char of some other class. This is in contrast to things like sentence-end which is determined by matching a regexp (sentence-end returns regexp).

Emacs lisp mode inherits standard-syntax-table:

;; from lisp-mode.el:
(defvar emacs-lisp-mode-syntax-table
  (let ((table (make-syntax-table))
  ..

(make-syntax-table is default to standard-syntax-table.)

The easiest way to browse standard-syntax-table is to enter fundamental-mode and call describe-syntax (C-h s).

Emacs lisp mode makes some tweaks to standard-syntax-table, of which I understand the following:

  • `',@# are expression prefixes:

    (modify-syntax-entry ?` "'   " table)
    (modify-syntax-entry ?' "'   " table)
    (modify-syntax-entry ?, "'   " table)
    (modify-syntax-entry ?@ "'   " table)
    (modify-syntax-entry ?# "'   " table)
    
  • ; starts a comment, \n ends it:

    (modify-syntax-entry ?\; "<   " table)
    (modify-syntax-entry ?\n ">   " table)
    
  • \ is an escape char:

    (modify-syntax-entry ?\" "\"    " table)
    
1
  • A clear answer.
    – Drew
    Mar 21, 2015 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.