bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31289: madx mode for emacs


From: Oscar Blanco
Subject: bug#31289: madx mode for emacs
Date: Fri, 5 Oct 2018 08:52:22 +0200

Hello,

I attached again the script with the corresponding modifications. I understand that an additional script called madx-autoloads.el is required.

Best regards,

o

Il giorno ven 22 giu 2018 alle ore 02:50 Noam Postavsky <npostavs@gmail.com> ha scritto:
Oscar Blanco <orblancog@gmail.com> writes:

> Dear emacs group,
>
> I attach a script that I would like you to consider for the ELPA
> repository.
> This script defines the mad-x mode that highlights buffers with the
> "Methodical Accelerator Design" syntax, by default loaded if the file name
> ends it ".madx".

> ;;; madx.el --- Major mode for editing MAD-X files in Emacs
>
> ;; Copyright (C) 2013, 2016 Oscar BLANCO
> ;;               2017, 2018 Oscar BLANCO, Istituto Nazionale di Fisica Nucleare

> ;; Licensed under the EUPL, Version 1.1

This would have to be changed.  I believe GNU ELPA packages must have
copyright assigned to the FSF and be under GPLv3+.

> ;(add-to-list 'auto-mode-alist '("\\.madx\\'" . madx-mode))

This should be uncommented and ;;;###autoloaded I guess.

> (defconst madx-font-lock-warning-face-all
>   ;; madx-font-lock-keywords-errordef
>   (list
>    '("\\<\\(E\\(?:ALIGN\\|FCOMP\\|RROR\\)\\|SETERR\\)\\>"
>      . font-lock-warning-face))
>   "Highlighting expressions for MAD-X mode (warning-all).")

It looks like this regexp and several others are the result of
regexp-opt; it's better to have the original _expression_ in the source,
e.g.,

`((,(regexp-opt '("EALIGN" "EFCOMP" "ERROR" "SETERR") 'words) . font-lock-builtin-face))


> ;;;###autoload
> (defun madx-mode ()
>   "Major mode for editing MAD-X script files."
>   (interactive)
>   (kill-all-local-variables)
>   (setq mode-name "MAD-X")
>   (setq major-mode 'madx-mode)

I think if you use `define-derived-mode', it would reduce the need for
some of the boilerplate.

>   ;; Set up search
>   (add-hook 'madx-mode-hook
>      (lambda ()  (setq case-fold-search t)))
>   (run-hooks 'madx-mode-hook))

Why not just plain (setq case-fold-search t) here?


--
Oscar BLANCO


Attachment: madx.el
Description: Text Data

Attachment: madx-autoloads.el
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]