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: Noam Postavsky
Subject: bug#31289: madx mode for emacs
Date: Thu, 21 Jun 2018 20:50:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

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?





reply via email to

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