#297 recognize buffer properties in emacs format

None
open
nobody
3
2013-12-09
2012-05-14
Victor Engmark
No

It would be nice if jEdit could support Emacs mode strings for mode settings. A simple addition would be to include mode strings in the default first line globs. For example, to detect non-executable Perl files which have no extension but whose first line starts with a shebang or "# -*- mode: perl; -*-":

{#!/*perl*,*mode: *perl*}

A more difficult feature would be the support for overrides of the jEdit mode settings with strings like this:

; -*- mode: Lisp; tab-width: 4; -*-

This could make it easier to share files, especially since there is (AFAIK) no way to specify mode settings per directory tree.

Discussion

  • "Would be nice", so it is not a bug, but a feature request. I'm moving it to the correct tracker.

    I am not sure, but seems like part of the things is already supported. See "Writing edit modes / Installing edit modes" and "Using jedit / Customizing / Buffer-Local properties" chapters of the users guide.

    Let's have this report for a single thing. Please provide a short file that is not recognized by jedit as a perl file. We already track some regular expressions:
    FIRST_LINE_GLOB="#!/*perl*" />

    I am testing with daily built jedit.

     
    • summary: Support Emacs mode strings --> perl mode: recognize mode from emacs string
    • status: open --> pending-works-for-me
     
    • labels: 102669 -->
     
  • Victor Engmark
    Victor Engmark
    2012-05-14

    As already mentioned I work with files which have no shebang line (because they are not supposed to be executed on their own), and don't have a *.p[lm]{,.tdy} extension (for unknown reasons), but *do* have a mode line. These are not detected as Perl.

    Attaching an example file.

     
  • Victor Engmark
    Victor Engmark
    2012-05-14

    • status: pending-works-for-me --> open-works-for-me
     
  • Victor Engmark
    Victor Engmark
    2012-05-14

    Test file

     
    Attachments
  • Alan Ezust
    Alan Ezust
    2012-05-14

    in jedit we use = instead of colon (which is used by emacs).

    http://www.jedit.org/users-guide/buffer-local.html

    inserting a line like this:
    # :mode=perl:

    works for me.

     
    • summary: perl mode: recognize mode from emacs string --> recognize buffer properties in emacs format
    • priority: 5 --> 3
    • status: open-works-for-me --> open
     
  • Alan Ezust
    Alan Ezust
    2013-04-23

    I think this should be done in a plugin.
    Perhaps looking at how EditorConfig works can help a plugin author implement this feature in a new plugin or in editorconfig itself.

     
  • Alan Ezust
    Alan Ezust
    2013-12-09

    • labels: --> EditorConfig
    • Group: -->