Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005727OCaml~DO NOT USE (was: OCaml general)public2012-08-14 19:452015-12-11 19:08
Assigned Todoligez 
PlatformOSOS Version
Product Version3.12.1 
Target Version4.00.1+devFixed in Version 
Summary0005727: emacs caml-mode indents shebang line in toplevel scripts
DescriptionWhen editing a toplevel script in emacs caml-mode,
auto-tabbing indents the shebang line and the directive
immediately following it if one is present.
Steps To ReproduceCreate and auto-indent a toplevel script with a shebang line,
using emacs and caml-mode.
Additional InformationThe following code is a patch for caml.el.
It seems to work, but I'm not an elisp expert,
so it may be slow or otherwise suboptimal :(

;small addition to caml-compute-basic-indent
(defun caml-compute-basic-indent (prio)
  (if (= 1 (line-beginning-position))
    <current body of caml-compute-basic-indent>))

;new function
(defun caml-in-shebang-line ()
    (and (= 1 (point)) (looking-at "#!"))))

;one-line insertion into the COND form in caml-in-expr-p
(defun caml-in-expr-p ()
  (let (...)
    (caml-find-kwop ...)
     ((caml-in-shebang-line) (setq in-expr nil)) ;; maybe reset pos?
     ; special case for ;;
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
doligez (administrator)
2012-09-27 18:03
edited on: 2012-09-28 18:56

I have applied a simplified version of your patch. There is one remaining problem (with or without the simplification): if the shebang line is already indented to any non-zero level, then emacs will indent it to two spaces.

Edit: I had forgotten to commit the change. It is now done in 4.00.1+dev (r 12973) and trunk (r 12974).

- Issue History
Date Modified Username Field Change
2012-08-14 19:45 Drakken New Issue
2012-09-06 16:43 doligez Target Version => 4.00.1+dev
2012-09-27 15:57 doligez Assigned To => doligez
2012-09-27 15:57 doligez Status new => assigned
2012-09-27 18:03 doligez Note Added: 0008173
2012-09-27 18:03 doligez Status assigned => resolved
2012-09-27 18:03 doligez Resolution open => fixed
2012-09-28 18:56 doligez Note Edited: 0008173 View Revisions
2015-12-11 19:08 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker