GNU bug report logs - #31289
madx mode for emacs

Previous Next

Package: emacs;

Reported by: Oscar Blanco <orblancog <at> gmail.com>

Date: Fri, 27 Apr 2018 15:20:01 UTC

Severity: wishlist

Tags: patch

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Oscar Blanco <orblancog <at> gmail.com>
Cc: 31289 <at> debbugs.gnu.org
Subject: bug#31289: madx mode for emacs
Date: Thu, 21 Jun 2018 20:50:52 -0400
Oscar Blanco <orblancog <at> 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?




This bug report was last modified 5 years and 186 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.