OCaml Forge
SCM

Detail: [#950] Underscores, Keywords and Tuareg mode.

Bugs: Browse | Download .csv | Monitor

[#950] Underscores, Keywords and Tuareg mode.

Date:
2011-04-07 22:19
Priority:
3
State:
Closed
Submitted by:
Andrew J. (andrew)
Assigned to:
Nobody (None)
Hardware:
None
Resolution:
Fixed
Severity:
None
Version:
None
Component:
Tuareg
Operating System:
All
Product:
Tuareg
 
URL:
Summary:
Underscores, Keywords and Tuareg mode.

Detailed description
Hi, and thanks for Tuareg mode!

I've noticed a somewhat annoying bug in Emacs Tuareg mode, but before reporting it as such I thought I'd better ask, to ensure that it's not a misconfiguration on my side. I posted in on the caml mailing list, and apparently others could reproduce it.

Basically, I can't use the do_list function at the beginning of a line. Whenever I type "do", and then press underscore, emacs emits a beep and the underscore is replaces by a white space. The same happens for keywords such as "then", "else", "done".

To reproduce, just try to input do_list in Emacs, with tuareg mode enabled, at the beginning of a line.

I imagine that this has to do with electric indenting, but, after carefully browsing tuareg source code, I couldn't locate the offending lines.

---- Here's an emacs stack trace.
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
looking-at(nil)
(let* ((looking-at-matching ...) (extra-unindent ...)) (+ (current-column) (tuareg-add-default-indent ...)))
tuareg-compute-kwop-indent-general("do" nil)
(cond ((string= kwop "|") (if real-pipe ... ... ...)) ((looking-at "[[{(][<|]?\\|\\.<") (tuareg-compute-paren-indent paren-match-p old-point)) ((string= kwop "with") (when ... ...) (while ... ... ...) (cond ... ... ...)) ((and ... ...) (tuareg-back-to-paren-or-indentation) (if ... ... ...)) ((or ... ...) (if ... ... ...)) ((string= kwop "in") (+ ... ...)) ((not ...) (tuareg-compute-kwop-indent-general kwop matching-kwop)) ((string= matching-kwop "with") (current-column)) (t (tuareg-paren-or-indentation-column)))
(let* ((old-point ...) (paren-match-p ...) (real-pipe ...) (matching-kwop ...)) (cond (... ...) (... ...) (... ... ... ...) (... ... ...) (... ...) (... ...) (... ...) (... ...) (t ...)))
tuareg-compute-kwop-indent("do")
(cond ((tuareg-in-comment-p) (cond ... ... ... ...)) ((tuareg-in-literal-p) (current-column)) ((or ... ...) (if ... ... ...)) ((or ... ...) (tuareg-find-phrase-indentation)) ((and tuareg-sig-struct-align ...) (if ... ... ...)) ((looking-at ";") (tuareg-find-semicolon-match t)) ((looking-at "|!") (tuareg-indent-to-code ... ...)) ((looking-at ">>[=>|]") (tuareg-indent-to-code ... ...)) ((or ... ... ...) 0) ((or ... ... ...) (tuareg-compute-kwop-indent ...)) (t (tuareg-compute-normal-indent)))
(save-excursion (cond (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... 0) (... ...) (t ...)))
tuareg-compute-indent()
(max 0 (tuareg-compute-indent))
(indent-line-to (max 0 (tuareg-compute-indent)))
(save-excursion (back-to-indentation) (indent-line-to (max 0 ...)))
(progn (save-excursion (back-to-indentation) (indent-line-to ...)) (when (tuareg-in-indentation-p) (back-to-indentation)))
(unwind-protect (progn (save-excursion ... ...) (when ... ...)) (modify-syntax-entry 46 "." tuareg-mode-syntax-table) (modify-syntax-entry 95 "_" tuareg-mode-syntax-table))
(progn (modify-syntax-entry 46 "w" tuareg-mode-syntax-table) (modify-syntax-entry 95 "w" tuareg-mode-syntax-table) (unwind-protect (progn ... ...) (modify-syntax-entry 46 "." tuareg-mode-syntax-table) (modify-syntax-entry 95 "_" tuareg-mode-syntax-table)))
(tuareg-with-internal-syntax (save-excursion (back-to-indentation) (indent-line-to ...)) (when (tuareg-in-indentation-p) (back-to-indentation)))
(let ((case-fold-search nil)) (tuareg-with-internal-syntax (save-excursion ... ...) (when ... ...)))
tuareg-indent-command(t)
(if point-leading-comment nil (tuareg-indent-command t))
(unless point-leading-comment (tuareg-indent-command t))
(progn (when (and ... ...) (unless ... ...) (setq return-leading t)) (unless point-leading-comment (tuareg-indent-command t)))
(if tuareg-electric-indent (progn (when ... ... ...) (unless point-leading-comment ...)))
(when tuareg-electric-indent (when (and ... ...) (unless ... ...) (setq return-leading t)) (unless point-leading-comment (tuareg-indent-command t)))
(save-excursion (back-to-indentation) (when tuareg-electric-indent (when ... ... ...) (unless point-leading-comment ...)))
(let ((point-leading-comment ...) (return-leading nil)) (save-excursion (back-to-indentation) (when tuareg-electric-indent ... ...)) return-leading)
tuareg-auto-fill-insert-leading-star()
(if from-leading-star nil (tuareg-auto-fill-insert-leading-star))
(unless from-leading-star (tuareg-auto-fill-insert-leading-star))
tuareg-indent-command()
indent-according-to-mode()
(progn (insert " ") (indent-according-to-mode) (backward-delete-char-untabify 1))
(if kw (progn (insert " ") (indent-according-to-mode) (backward-delete-char-untabify 1)))
(when kw (insert " ") (indent-according-to-mode) (backward-delete-char-untabify 1))
(let* ((bol ...) (kw ...)) (when kw (insert " ") (indent-according-to-mode) (backward-delete-char-untabify 1)))
(if (tuareg-in-literal-or-comment-p) nil (let* (... ...) (when kw ... ... ...)))
(unless (tuareg-in-literal-or-comment-p) (let* (... ...) (when kw ... ... ...)))
tuareg-abbrev-hook()
abbrev-insert(do #("do" 0 2 (fontified t face font-lock-keyword-face)) 1 3)
#[nil "\306 \211\211A@\211A@\211A@\211A@\203)

Followup

Message
Date: 2014-01-02 12:55
Sender: Christophe Troestler

SMIE is now enabled by default.
Date: 2011-11-29 03:17
Sender: Stefan Monnier

This bug is fixed in the SMIE indenter (i.e. if you use the tuareg.el from the repository and add (setq tuareg-use-smie t) in your .emacs).

Attached Files:

Changes:

Field Old Value Date By
status_idOpen2014-01-02 12:55chris
close_dateNone2014-01-02 12:55chris
ResolutionNone2014-01-02 12:55chris
ComponentNone2014-01-02 12:55chris
ProductNone2014-01-02 12:55chris