unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31289: madx mode for emacs
@ 2018-04-27 11:00 Oscar Blanco
  2018-06-22  0:50 ` Noam Postavsky
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Oscar Blanco @ 2018-04-27 11:00 UTC (permalink / raw)
  To: 31289


[-- Attachment #1.1: Type: text/plain, Size: 292 bytes --]

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".

Best regards,

o

-- 
Oscar BLANCO

[-- Attachment #1.2: Type: text/html, Size: 560 bytes --]

[-- Attachment #2: madx.el --]
[-- Type: text/x-emacs-lisp, Size: 16504 bytes --]

;;; 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

;; Author     : orblancog <orblancog@gmail.com>
;; Maintainer : orblancog
;; Created    : 18 Nov 2017
;; Keywords   : languages
;; Homepage   : https://github.com/orblancog/mad-x_syntax
;; Version    : 1.5

;; This file is not part of GNU Emacs

;; Licensed under the EUPL, Version 1.1 or - as soon they will be
;; approved by the European Commission - subsequent versions of the EUPL
;; (the "Licence"). You may not use this work except in compliance with
;; the Licence. You may obtain a copy of the Licence at:
;;
;; https://joinup.ec.europa.eu/software/page/eupl
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the Licence is distributed on an "AS IS" basis,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
;; implied.
;;
;; See the Licence for the specific language governing permissions and
;; limitations under the Licence.

;;; Commentary:
;; FEATURES in version 1.4
;; * Highlights commands, parameters and special operators in MAD-X 5
;; * If the file extension is '.madx' then the buffer is automatically highlighted,
;;   but any buffer can be highlighted by doing :
;;       `M+X madx-mode`
;;   where `M` is the **META** character in Emacs (`M` seems to be **ALT** in Linux)
;; * If the limit of 80 characters is desired, they could be highlighted differently
;;   by uncomment the line
;;       ;(require 'whitespace)
;;       ;(setq whitespace-line-column 80) ;; limit line length
;;       ;(setq whitespace-style '(face lines-tail))
;;       ;(add-hook 'madx-mode-hook 'whitespace-mode)
;;   in this (madx.el) file.
;; HOW TO INSTALL IT
;; For EMACS 2.4 and on it should be available in the EMACS elpa repository,
;; otherwise,
;; 1. Copy this file (madx.el) to the highlighting definition folder, e.g.
;;      a)  ~/.emacs.d/lisp/  ---> (Emacs v24.5.X)
;;      b)  ~/.emacs.d/       ---> (Emacs v23.X.X)
;;      c)  ~/                ---> (Emacs v21.X.X)
;;    i.e.
;;      $ cp madx.el ~/.emacs.d/lisp/
;; 2. Edit or create your .emacs file, typically in ~/
;;      adding the following block where the load-path must match point 1.
;;      ;;;; START OF BLOCK TO COPY AND UNCOMMENT
;;      (global-font-lock-mode t);; Enable syntax highlighting
;;      (setq font-lock-maximum-decoration t)
;;      (add-to-list 'load-path "~/.emacs.d");; <--- edit according to 1.
;;      (autoload 'madx-mode "madx" "MADX-mode" t)
;;      (setq auto-mode-alist (append '(("\\.madx$" . madx-mode))
;;        auto-mode-alist))
;;      ;;;; END OF BLOCK TO COPY AND UNCOMMENT
;; 3. You should now restart EMACS in order to reload the environment variables.
;; INFO
;; * For mad instructions, visit
;;   mad.web.cern.ch/mad/
;; * Other syntax highlightings could be found inside the
;;   mad sources.  Check the 'syntax' folder in the madx dir !
;;   Write me to the email address above about any bug including an example.

;;; History:
;; v 1.0 First release at CERN. File is also available in the
;;       MAD-X sources "syntax" folder.
;; v 1.1 Adding comments and changing some verbosed names
;; v 1.2 email update oscar.roberto.blanco.garcia@cern.ch deprecated
;; v 1.2 Adding some variables from MAD-X 5.02.10 manual
;;       Cleaning up faces 8D
;;       when exceeding 80 chars->extra chars in red
;; v 1.3 adding color to numbers and ;
;; v 1.4 Changes to put this file in the emacs elpa repository
;;       Changing email address to orblancog@gmail.com

;;; Code:
(defgroup madx nil
 "Major mode to edit MAD-X files in emacs."
 :group 'languages)

(defvar madx-mode-hook nil
  "Hook for madx-model initialize nil.")

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

;;;; add  80 characters line
;;;; (global-whitespace-mode +1)
;(require 'whitespace)
;(setq whitespace-line-column 80) ;; limit line length
;(setq whitespace-style '(face lines-tail))
;(add-hook 'madx-mode-hook 'whitespace-mode)

(defconst madx-font-lock-keywords-face-all
  ;; madx-font-lock-keywords-programflow
  (list
   '("\\<\\(ELSE\\(?:IF\\)?\\|IF\\|MACRO\\|WHILE\\)\\>"
   .  font-lock-keyword-face))
  "Highlighting expressions for MAD-X mode (keywords-all).")

(defconst madx-font-lock-builtin-face-all
  ;; madx-font-lock-keywords-tableaccs
  ;; madx-font-lock-keywords-simul
  ;; madx-font-lock-keywords-controlstm
  ;; madx-font-lock-keywords-filehandstm
  ;; madx-font-lock-keywords-tablehandstm
  ;; madx-font-lock-keywords-beamhandstm
  ;; madx-font-lock-keywords-seqediting
  ;; madx-font-lock-keywords-othrcmds
  ;; madx-font-lock-keywords-matchingmet
  ;; madx-font-lock-keywords-orbit_corr
  ;; madx-font-lock-keywords-plot
  ;; madx-font-lock-keywords-stringatt
  (list
  '("\\<\\(A\\(?:PERTURE\\|SSIGN\\)\\|BEAM\\|C\\(?:ALL\\|O\\(?:GUESS\\|NST\\(?:RAINT\\)?\\|P\\(?:TION\\|YFILE\\)\\|RRECT\\)\\|\\(?:REAT\\|SAV\\|YCL\\)E\\)\\|D\\(?:ELETE\\|UMPSEQU\\|YNAP\\)\\|E\\(?:MIT\\|ND\\(?:EDIT\\|MATCH\\|TRACK\\|_MATCH\\)\\|OPTION\\|PRINT\\|SAVE\\|X\\(?:EC\\|\\(?:I\\|TRAC\\)T\\)\\)\\|F\\(?:ILL\\|LATTEN\\)\\|G\\(?:LOBAL\\|WEIGHT\\)\\|HELP\\|I\\(?:BS\\|NSTALL\\)\\|JACOBIAN\\|L\\(?:INE\\|MDIF\\)\\|M\\(?:A\\(?:KETHIN\\|TCH\\(?: WITHPTCKNOBS\\)?\\)\\|IGRAD\\|OVE\\)\\|O\\(?:BSERVE\\|PTION\\)\\|P\\(?:LOT\\|RINTF?\\|TC_\\(?:ALIGN\\|CREATE_\\(?:LAYOUT\\|UNIVERSE\\)\\|DUMPMAPS\\|E\\(?:ND\\|PLACEMENT\\)\\|KNOB\\|MO\\(?:MENTS\\|VE_TO_LAYOUT\\)\\|NORMAL\\|OBSERVE\\|PRINT\\(?:FRAMES\\|PARAMETRIC\\)\\|READ_ERRORS\\|S\\(?:E\\(?:LECT\\(?:_MOMENT\\)?\\|T\\(?:ACCEL_METHOD\\|CAVITIES\\|DEBUGLEVEL\\|EXACTMIS\\|FRINGE\\|KNOBVALUE\\|RADIATION\\|SWITCH\\|T\\(?:IME\\|OTALPATH\\)\\)\\)\\|TART\\)\\|T\\(?:RACK\\(?:_\\(?:END\\|LINE\\)\\)?\\|WISS\\)\\|VARYKNOB\\)\\)\\|QUIT\\|R\\(?:E\\(?:A\\(?:D\\(?:\\(?:MY\\)?TABLE\\)\\|L\\)\\|FLECT\\|MOVE\\(?:FILE\\)?\\|NAMEFILE\\|PLACE\\|S\\(?:BEAM\\|PLOT\\)\\|TURN\\)\\|PLOT\\|TRACKSTORE\\|UN\\|VIEWER\\)\\|S\\(?:AVE\\(?:BETA\\)?\\|E\\(?:LECT\\(?:_PTC_NORMAL\\)?\\|QEDIT\\|T\\(?:CORR\\|PLOT\\|VARS\\(?:_LIN\\)?\\)?\\)\\|H\\(?:OW\\|RINK\\)\\|I\\(?:MPLEX\\|XTRACK\\)\\|ODD\\|T\\(?:ART\\|OP\\)\\|URVEY\\|XF\\(?:READ\\|WRITE\\)\\|YSTEM\\)\\|T\\(?:AB\\(?:INDEX\\|LE\\|STRING\\)\\|ITLE\\|OUSCHEK\\|RACK\\|WISS\\)\\|USE\\(?:KICK\\|MONITOR\\|_MACRO\\)?\\|VA\\(?:LUE\\|RY\\)\\|W\\(?:EIGHT\\|RITE\\)\\|system\\)\\>"
   . font-lock-builtin-face))
  "Highlighting expressions for MAD-X mode (builtin-all).")

(defconst madx-font-lock-type-face-all
  ;; madx-font-lock-keywords-elements
  (list
   '("\\<\\(BEAMBEAM\\|C\\(?:HANGEREF\\|OLLIMATOR\\|RABCAVITY\\)\\|D\\(?:IPEDGE\\|RIFT\\)\\|E\\(?:\\(?:COLLIM\\|LSEPAR\\)ATOR\\)\\|H\\(?:\\(?:KICKE\\|MONITO\\)R\\)\\|INSTRUMENT\\|KICKER\\|M\\(?:A\\(?:RKER\\|TRIX\\)\\|ONITOR\\|ULTIPOLE\\)\\|NLLENS\\|OCTUPOLE\\|PLACEHOLDER\\|QUADRUPOLE\\|R\\(?:BEND\\|COLLIMATOR\\|F\\(?:CAVITY\\|MULTIPOLE\\)\\)\\|S\\(?:BEND\\|EXTUPOLE\\|OLENOID\\|ROTATION\\)\\|T\\(?:KICKER\\|RANSLATION\\)\\|V\\(?:\\(?:KICKE\\|MONITO\\)R\\)\\|YROTATION\\)\\>"
     . font-lock-type-face))
  "Highlighting expressions for MAD-X mode (type-all).")

(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).")

(defconst madx-font-lock-special_operators
  ;; madx-font-lock-special_operators
  (list
   '("\\(;\\|->\\|:=\\)"
  . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (special-operators).")

(defconst madx-font-lock-constant-face-all
  ;; madx-font-lock-keywords-constants
  (list
   '("\\<\\(ANTIPROTON\\|C\\(?:ENTRE\\|IRCLE\\|LIGHT\\|OLLIM\\)\\|DEGRAD\\|E\\(?:L\\(?:ECTRON\\|LIPSE\\)\\|MASS\\|NTRY\\|RAD\\|XIT\\)?\\|FALSE\\|H\\(?:BAR\\|YBRID\\)\\|ION\\|LHCSCREEN\\|M\\(?:ARGUERITE\\|UMASS\\)\\|N\\(?:EGMUON\\|MASS\\)\\|OCTAGON\\|P\\(?:I\\|MASS\\|OS\\(?:\\(?:ITR\\|MU\\)ON\\)\\|R\\(?:AD\\|OTON\\)\\)\\|QELECT\\|R\\(?:A\\(?:CETRACK\\|DDEG\\)\\|ECT\\(?:\\(?:ANGL\\|ELLIPS\\)E\\)\\)\\|SIMPLE\\|T\\(?:EAPOT\\|RUE\\|WOPI\\)\\)\\>"
  . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (constant-all).")

(defconst madx-font-lock-special_constants
  ;; madx-font-lock-special_constants
  (list
   '("\\(#[es]\\)"
  . font-lock-constant-face)
  )
  "Highlighting expressions for MAD-X mode (special_constants).")

(defconst madx-font-lock-doc-face-all
  ;; madx-font-lock-keywords-parameters
  (list
   '("\\<\\(A\\(?:DD\\(?:_\\(?:ANGLE\\|PASS\\)\\)?\\|N\\(?:GLE\\|H[XY]\\)\\|P\\(?:ER\\(?:TYPE\\|_\\(?:OFFSET\\|TOL\\)\\)\\|PEND\\)\\|RE[XY]\\|SCALE\\|T\\|UTOPLACEDOWNSTREAM\\)\\|B\\(?:A\\(?:LANCE\\|R[ES]\\)\\|B\\(?:DIR\\|EAT\\|ORBIT\\|SHAPE\\)\\|CURRENT\\|E\\(?:AM\\(?:1TAB\\|2TAB\\|_ENVELOPE\\)\\|TA\\(?:0\\|QFX\\)?\\)\\|ISEC\\|RHO\\|UNCHED\\|[VY]\\)\\|C\\(?:A\\(?:LLS\\|VALL\\)\\|ENT\\(?:ER_MAGNETS\\|RE\\)\\|H\\(?:ARGE\\|ROM\\)\\|L\\(?:ASS\\|EAR\\|\\(?:IS\\|OSED_ORBI\\)T\\)\\|NLL\\|O\\(?:L\\(?:OUR\\|UMN\\)\\|MMAND\\|ND\\|OL\\|R\\(?:RLIM\\|ZERO\\)?\\|UPLE\\)\\|URRENT\\)\\|D\\(?:AMP\\|E\\(?:BUG\\(?:LEVEL\\)?\\|L\\(?:S\\|TA_DEPENDENCY\\)\\|TUNE\\)\\|ISTORT[12]\\|K\\(?:[NS]R\\|[NS]\\)\\|P\\(?:AR[XY]\\|[HS]I\\)\\|QF\\|THETA\\|UMP\\|[PS]\\)\\|E\\(?:CHO\\(?:MACRO\\)?\\|IGN\\|LEMENT\\(?:NAME\\|_BY_ELEMENT\\)?\\|N\\(?:DSEQUENCE\\|ERGY\\)\\|RRORS_\\(?:IN\\|OUT\\)\\|VE\\(?:N\\|RYSTEP\\)\\|X\\(?:ACT\\(?:MATCH\\|_MISS?\\)?\\|\\(?:TE\\(?:NSIO\\|R\\)\\)?N\\)\\|YN\\|[12TXY]\\)\\|F\\(?:ASTUNE\\|FILE\\|I\\(?:LE\\|NTX?\\)\\|LAG\\|O\\(?:\\(?:N\\|RMA\\)T\\)\\|R\\(?:EQ\\|INGE\\|OM\\)\\|ULL\\|[TXY]\\)\\|G\\(?:AMMA\\|CS\\|N\\(?:FU\\|UF\\)\\)\\|H\\(?:A\\(?:LO\\(?:FILE\\)?\\|ML\\|RMON\\|XIS\\)\\|COEFF[NS]\\|GAP\\|KICK\\|M\\(?:AX\\|IN\\)\\|YSTER\\|[12]\\)\\|I\\(?:CASE\\|GNORE_MAP_ORBIT\\|N\\(?:DEX\\|FO\\|ITIAL\\(?:_MA\\(?:P_MANUAL\\|TRIX_\\(?:MANUAL\\|TABLE\\)\\)\\)?\\|TER\\(?:POLATE\\|VAL\\)\\)\\)\\|K\\(?:0S\\|1S\\|2S\\|3S\\|BUNCH\\|E\\(?:EPORBIT\\|YWORD\\)\\|ICK\\|NLL?\\|S[IL]\\|[0-3NS]\\)\\|L\\(?:A\\(?:BEL\\|G\\)\\|E\\(?:NGTH\\|VEL\\)\\|OWER\\|RAD\\|S\\(?:CALE\\|Q\\)\\|WIDTH\\|YAPUNOV\\)\\|M\\(?:A\\(?:D8\\|GNET_NAME\\|KEDIPEDGE\\|PTABLE\\|RKER_PLOT\\|SS\\|TRIX_MANUAL\\|X\\(?:A\\(?:CCELERATION\\|PER\\)\\|_MULT_ORD\\)\\)\\|ETHOD\\|ICADO\\|LIST\\|O\\(?:DEL?\\|MENT\\(?:_?S\\)?\\|N\\(?:ERROR\\|O\\(?:MIAL\\|N\\)\\|SCALE\\)\\)\\|RE[XY]\\|SCAL[XY]\\|ULT\\(?:IP\\(?:\\(?:L\\|OLE_ORDER_RANG\\)E\\)\\|_AUTO_OFF\\)\\)\\|N\\(?:AME_COL\\|CO\\(?:RR\\)?\\|E\\(?:WNAME\\|XT_SEQU\\)\\|O\\(?:EXPR\\|LINE\\|PRINT\\|RM\\(?:_\\(?:NO\\|OUT\\)\\)?\\|SIXTRACK\\|T\\(?:\\(?:IT\\|SIMP\\)LE\\)\\|VERSION\\|_\\(?:CAVITY_TOTALPATH\\|FATAL_\\(?:ERROR\\|STOP\\)\\)\\)?\\|PART\\|ST\\|TPSA\\|_BESSEL\\)\\|O\\(?:FFSET\\(?:ELEM\\|_DELTAP\\)\\|N\\(?:E\\(?:PASS\\|TABLE\\)\\|LY\\(?:\\(?:ORIENTA\\|POSI\\)TION\\)\\)\\|PT\\|R\\(?:BIT\\|DER\\)\\|VERWRITE\\)\\|P\\(?:A\\(?:R\\(?:AM\\(?:ETRIC\\)?\\|ENT\\|TICLE\\)\\|T\\(?:CH_\\(?:ANG\\|TRANS\\)\\|TERN\\)\\)\\|C\\|ERIOD\\|HI0\\|IPEFILE\\|LA\\(?:CE\\|NEX?\\)\\|NL\\|O\\(?:LYNOMIAL\\|ST?\\)\\|RINT_A\\(?:LL\\|T_END\\)\\|S\\(?:I0\\|L\\)\\|TC\\(?:_TABLE\\)?\\)\\|QUANT\\(?:ITY\\|UM\\)\\|R\\(?:A\\(?:DI\\(?:AT\\(?:E\\|ION\\(?:_\\(?:ENERGY_LOSS\\|MODEL1\\|QUADr\\)\\)?\\)\\|US\\)\\|N\\(?:DOM\\|GE\\(?:_PLOT\\)?\\)\\)\\|BARC\\|E\\(?:CLOSS\\|F\\(?:ER\\|FRAME\\|POS\\)\\|\\(?:PEA\\|S\\(?:E\\|OU\\|PLI\\)\\)T\\)\\|I\\(?:NG_PARAMETERS\\|PKEN\\)\\|MATRIX\\|O\\(?:OT\\(?:MACRO\\|NTUPLE\\)\\|W1?\\)\\|SCALE\\)\\|S\\(?:E\\(?:CTOR\\(?:FILE\\|MAP\\|_\\(?:NMUL_MAX\\|nMUL\\)\\)\\|ED\\|LECTED\\|QUENCE\\)\\|I\\(?:G[ETXY]\\|N\\(?:KICK\\|P\\(?:EAK\\|HASE\\)\\|TUNE\\)\\)\\|L\\(?:ICE\\(?:_MAGNETS\\)?\\|O\\(?:PE\\|W\\)\\)\\|NG\\(?:CUT\\|VAL\\)\\|P\\(?:ACE_CHARGE\\|EC\\|LIT\\)\\|SCALE\\|T\\(?:A\\(?:RT_STOP\\|TUS\\)\\|EP\\|RATEGY\\|YLE\\)\\|U\\(?:MM\\(?:ARY_\\(?:\\(?:FI\\|TAB\\)LE\\)\\)?\\|RVEYALL\\)\\|VD\\|YM\\(?:BOL\\|P\\(?:L\\|RINT\\)\\)\\)\\|T\\(?:A\\(?:BLEALLSTEPS\\|RGET\\)\\|E\\(?:LL\\|XT\\)\\|H\\(?:ETA0\\|I\\(?:CK\\|N\\(?:_FOC\\)?\\)\\|READER\\)\\|I\\(?:LT\\|ME\\)\\|LI\\|O\\(?:L\\(?:ERANCE\\)?\\|TALPATH\\)?\\|R\\(?:\\(?:AC\\(?:KFIL\\)?\\|U\\(?:EPROFIL\\|NCAT\\|STRANG\\)\\)E\\)\\|URNS\\|W\\(?:ISS\\(?:UM\\|_PRINT\\)\\|ORING\\)\\|XI\\|Y\\(?:I\\|PE\\)\\)\\|U\\(?:NITS\\|P\\(?:DATE\\|PER\\)\\|SE\\(?:ORBIT\\|_PTCKNOBS\\)\\)\\|V\\(?:AXIS[1-4]?\\|E\\(?:CTOR\\|R\\(?:BOSE\\|IFY\\)\\)\\|KICK\\|LENGTH\\|M\\(?:AX\\|IN\\)\\|OLT\\)\\|W\\(?:ARN\\(?:ING\\)?\\|IDTH\\)\\|X\\(?:0\\|BEND\\|DISTR\\|MA\\|SIZE\\|_COL\\)\\|Y\\(?:0\\|DISTR\\|MA\\|SIZE\\|_COL\\)\\|Z\\(?:0\\|\\(?:DIST\\|ERO_SUPP\\)R\\)\\|expr\\|lagf\\|r\\(?:ph[12]\\|v[1-4]\\)\\|[HL]\\)\\>"
    . font-lock-doc-face))
  "Highlighting expressions for MAD-X mode (doc-all).")

(defconst madx-font-lock-function-name-face-all
  ;; madx-font-lock-keywords-functions
  (list
   '("\\<\\(A\\(?:BS\\|COS\\|\\(?:SI\\|TA\\)N\\)\\|C\\(?:EIL\\|OSH?\\)\\|E\\(?:RFC?\\|XP\\)\\|FL\\(?:AT56?\\|OOR\\)\\|GAUSS\\|LOG\\(?:10\\)?\\|R\\(?:ANF\\|OUND\\)\\|S\\(?:IN[CH]?\\|QRT\\)\\|T\\(?:ANH?\\|GAUSS\\)\\)\\>"
     . font-lock-function-name-face))
  "Highlighting expressions for MAD-X mode (name-all)." )

(defconst madx-font-lock-variable-name-face-all
  ;; madx-font-lock-keywords-variables_madx
  (list
   '("\\<\\(A\\(?:LF\\(?:A[1-3][1-3]P?\\|[AXY]\\)\\|PER_[1-4]\\|RAD\\)\\|BET\\(?:A[1-3][1-3]P?\\|[XY]MAX\\|[XY]\\)\\|CIRC\\|D\\(?:D\\(?:P[XY]\\|Q[12]\\|[XY]\\)\\|ELTAP\\|\IS\\(?:P\\(?:[1-4]P[1-3]\\|[1-4]\\)\\|TANCE\\)\\|MU[XY]\\|P[XY]\\|Q[12]\\|TBYDS\\|X\\(?:MAX\\|RMS\\)\\|Y\\(?:MAX\\|RMS\\)\\|[XY]\\)\\|E\\(?:IGN[1-6][1-6]\\|NERGY\\)\\\|FREQ0\\|GAM\\(?:A\\(?:[1-3][1-3]P?\\|[XY]\\)\\|MA\\(?:[1-3][1-3]\\|TR\\)\\)\\|K\\(?:1L\\|2L\\|3L\\|4L\\|5L\\|6L\\|ICK[1-6]\\|[1-6]\\)\\|L\\(?:ENGTH\\|OG\\(?:DIST\\\|TURNS\\)\\|YAPUNOV\\)\\|MU[123XY]\\|N\\(?:1\\(?:MIN\\|[XY]_M\\)?\\|AME\\)\\|O\\(?:N_\\(?:AP\\|ELEM\\)\\|RBIT5\\)\\|P\\(?:DAMP\\|HI[TXY]?\\|SI\\|[TXY\]N\\|[TXY]\\)\\|Q[12S]\\|R\\(?:[1-6][1-6]\\|E\\(?:[1-6][1-6]\\)?\\|M[1-6][1-6]\\|TOL\\)\\|SYNCH_[1-5]\\|T\\(?:[1-6][1-6][1-6]\\|HETA\\|M[1-6][1-6][1-6]\\|N\\)\\|U0\\|W[TXY]\\|X\\(?:COMAX\\|N\\|RMS\\\|TOL\\)\\|Y\\(?:CO\\(?:MAX\\|RMS\\)\\|N\\|TOL\\)\\|k\\(?:[0-4]l\\)\\|mvar[1-4]\\|[RSTXYZ]\\)\\>"
     . font-lock-variable-name-face))
  "Highlighting expressions for MAD-X mode (variable-name-all).")

(defconst madx-font-lock-intfp-name-face-all
  ;; madx- fonts for integers and floating point numbers
  (list
   '("\\<\\(\\([0-9]+\\.?[0-9]*\\|\\.[0-9]+\\)\\([eE][+-]?\\([0-9]+\\.?[0-9]*\\|[0-9]*\\.[0-9]+\\)\\)?\\)\\>"
     . font-lock-keyword-face))
  "Highlighting expresssions for MAD-X mode (integers and floats).")

(defconst madx-font-lock-keywords-4
  (append
   madx-font-lock-special_constants
   madx-font-lock-special_operators
   madx-font-lock-keywords-face-all
   madx-font-lock-constant-face-all
   madx-font-lock-function-name-face-all
   madx-font-lock-type-face-all
   madx-font-lock-variable-name-face-all
   madx-font-lock-builtin-face-all
   madx-font-lock-warning-face-all
   madx-font-lock-doc-face-all
   madx-font-lock-intfp-name-face-all)
 "Balls-out highlighting in MAD-X mode.")

(defvar madx-font-lock-keywords madx-font-lock-keywords-4
  "Default highlighting expressions for MAD-X mode.")

(defvar madx-mode-syntax-table
  (let ((madx-mode-syntax-table (make-syntax-table)))
	
  ;; This is added so entity names with underscores and dots can be more easily parsed
  (modify-syntax-entry ?_ "w" madx-mode-syntax-table)
  (modify-syntax-entry ?. "w" madx-mode-syntax-table)
	
  ;;  Comment styles are similar to C++
  (modify-syntax-entry ?/ ". 124 b" madx-mode-syntax-table)
  (modify-syntax-entry ?* ". 23" madx-mode-syntax-table)
  (modify-syntax-entry ?\n "> b" madx-mode-syntax-table)
  (modify-syntax-entry ?! "< b" madx-mode-syntax-table)
  (modify-syntax-entry ?' "|" madx-mode-syntax-table)
     madx-mode-syntax-table)
  "Syntax table for `madx-mode'.")

;;;###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)
  ;;  (use-local-map madx-mode-map)
  (set-syntax-table madx-mode-syntax-table)
  (make-local-variable 'font-lock-defaults)
  (setq font-lock-defaults '(madx-font-lock-keywords nil t))
  ;; Setting up Imenu
  (setq imenu-generic-expression nil)
  (setq imenu-prev-index-position-function nil)
  (setq imenu-extract-index-name-function nil)
  ;;  (imenu-create-index-function)
  ;; Set up search
  (add-hook 'madx-mode-hook
     (lambda ()  (setq case-fold-search t)))
  (run-hooks 'madx-mode-hook))
(provide 'madx-mode)
;;; madx.el ends here

^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-04-27 11:00 bug#31289: madx mode for emacs Oscar Blanco
@ 2018-06-22  0:50 ` Noam Postavsky
  2018-10-05  6:52   ` Oscar Blanco
  2018-10-25 22:56 ` Noam Postavsky
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Noam Postavsky @ 2018-06-22  0:50 UTC (permalink / raw)
  To: Oscar Blanco; +Cc: 31289

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?





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-06-22  0:50 ` Noam Postavsky
@ 2018-10-05  6:52   ` Oscar Blanco
  2018-10-24 22:30     ` Noam Postavsky
  0 siblings, 1 reply; 15+ messages in thread
From: Oscar Blanco @ 2018-10-05  6:52 UTC (permalink / raw)
  To: npostavs; +Cc: 31289


[-- Attachment #1.1: Type: text/plain, Size: 2136 bytes --]

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 #1.2: Type: text/html, Size: 3122 bytes --]

[-- Attachment #2: madx.el --]
[-- Type: text/x-emacs-lisp, Size: 22439 bytes --]

;;; madx.el --- Major mode for editing MAD-X files in Emacs

;; Copyright (C) 2013, 2016 Oscar BLANCO
;;               2017, 2018 FSF

;; Author     : orblancog <orblancog@gmail.com>
;; Maintainer : orblancog
;; Created    : 18 Nov 2017
;; Keywords   : languages
;; Homepage   : https://github.com/orblancog/mad-x_syntax
;; Version    : 1.7

;; This file is not part of GNU Emacs

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;; FEATURES in version 1.7
;; * Highlights commands, parameters and special operators in MAD-X 5
;; * If the file extension is '.madx' or '.seq' then the buffer is automatically
;;   highlighted, but any buffer can be highlighted by doing :
;;       `M+X madx-mode`
;;   where `M` is the **META** character in Emacs (`M` seems to be **ALT** in Linux)
;; * If the limit of 80 characters is desired, they could be highlighted differently
;;   by uncomment the line
;;       ;(require 'whitespace)
;;       ;(setq whitespace-line-column 80) ;; limit line length
;;       ;(setq whitespace-style '(face lines-tail))
;;       ;(add-hook 'madx-mode-hook 'whitespace-mode)
;;   in this (madx.el) file.
;; HOW TO INSTALL IT
;; For EMACS 2.4 and on it should be available in the EMACS elpa repository,
;; otherwise,
;; 1. Copy this file (madx.el) to the highlighting definition folder, e.g.
;;      a)  ~/.emacs.d/lisp/  ---> (Emacs v24.5.X or v25)
;;      b)  ~/.emacs.d/       ---> (Emacs v23.X.X)
;;      c)  ~/                ---> (Emacs v21.X.X)
;;    i.e.
;;      $ cp madx.el ~/.emacs.d/lisp/
;; 2. Edit or create your .emacs file, typically in ~/
;;      adding the following block where the load-path must match point 1.
;;      ;;;; START OF BLOCK TO COPY AND UNCOMMENT
;;      (global-font-lock-mode t);; Enable syntax highlighting
;;      (setq font-lock-maximum-decoration t)
;;      (add-to-list 'load-path "~/.emacs.d");; <--- edit according to 1.
;;      (autoload 'madx-mode "madx" "MADX-mode" t)
;;      (setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" . madx-mode))
;;        auto-mode-alist))
;;      ;;;; END OF BLOCK TO COPY AND UNCOMMENT
;; 3. You should now restart EMACS in order to reload the environment variables.
;; INFO
;; * For mad instructions, visit
;;   mad.web.cern.ch/mad/
;; * Other syntax highlightings could be found inside the
;;   mad sources.  Check the 'syntax' folder in the madx dir !
;;   Write me to the email address above about any bug including an example.

;;; History:
;; v 1.0 First release at CERN. File is also available in the
;;       MAD-X sources "syntax" folder.
;; v 1.1 Adding comments and changing some verbosed names
;; v 1.2 email update oscar.roberto.blanco.garcia@cern.ch deprecated
;;       Adding some variables from MAD-X 5.02.10 manual
;;       Cleaning up faces 8D
;;       when exceeding 80 chars->extra chars in red
;; v 1.3 adding color to numbers and ;
;; v 1.4 Changes to put this file in the emacs elpa repository
;;       Changing email address to orblancog@gmail.com
;; v 1.5 Changing licence
;; v 1.6 Adding automatic syntax highlighting for ".seq"
;; v 1.7 Chaging licence to gpl3 and code-checking following GNU ELPA suggestions

;;; Code:
(defgroup madx nil
  "Major mode to edit MAD-X files in emacs."
  :group 'languages)

(defvar madx-mode-hook nil
  "Hook for madx-model initialize nil.")

;;;; add  80 characters line
;;;; (global-whitespace-mode +1)
;(require 'whitespace)
;(setq whitespace-line-column 80) ;; limit line length
;(setq whitespace-style '(face lines-tail))
;(add-hook 'madx-mode-hook 'whitespace-mode)

(defconst madx-font-lock-keywords-face-all
  ;; madx-font-lock-keywords-programflow
  `((,(regexp-opt '(;; font-lock-keyword-face
		    ;; madx-font-lock-keywords-programflow
		   "IF"
		   "ELSEIF"
		   "ELSE"
		   "WHILE"
		   "MACRO"
		   ) 'words)
     .  font-lock-keyword-face))
  "Highlighting expressions for MAD-X mode (keywords-all).")

(defconst madx-font-lock-builtin-face-all
  ;; madx-font-lock-keywords-tableaccs
  ;; madx-font-lock-keywords-simul
  ;; madx-font-lock-keywords-controlstm
  ;; madx-font-lock-keywords-filehandstm
  ;; madx-font-lock-keywords-tablehandstm
  ;; madx-font-lock-keywords-beamhandstm
  ;; madx-font-lock-keywords-seqediting
  ;; madx-font-lock-keywords-othrcmds
  ;; madx-font-lock-keywords-matchingmet
  ;; madx-font-lock-keywords-orbit_corr
  ;; madx-font-lock-keywords-plot
  ;; madx-font-lock-keywords-stringatt
  `((,(regexp-opt '(;; font-lock-builtin-face
		   ;;  madx-font-lock-keywords-tableaccs
		   "TABLE"
		   "TABINDEX"
		   "TABSTRING"
		   ;; madx-font-lock-keywords-simul
		   "TWISS"
		   "IBS"
		   "LINE"
		   "MAKETHIN"
		   "APERTURE"
		   "SIXTRACK"
		   "DYNAP"
		   "EMIT"
		   "MATCH"
		   "ENDMATCH"
		   "VARY"
		   "CONSTRAINT"
		   "WEIGHT"
		   "GLOBAL"
		   "GWEIGHT"
		   "PTC_TWISS"
		   "PTC_PRINTPARAMETRIC"
		   "PTC_NORMAL"
		   "SELECT_PTC_NORMAL"
		   "PTC_TRACK"
		   "PTC_TRACK_LINE"
		   "PTC_CREATE_UNIVERSE"
		   "PTC_CREATE_LAYOUT"
		   "PTC_READ_ERRORS"
		   "PTC_MOVE_TO_LAYOUT"
		   "PTC_ALIGN"
		   "PTC_END"
		   "PTC_TRACK_END"
		   "START"
		   "RUN"
		   "PTC_OBSERVE"
		   "OBSERVE"
		   "PTC_START"
		   "PTC_SETSWITCH"
		   "PTC_KNOB"
		   "PTC_SETKNOBVALUE"
		   "MATCH WITHPTCKNOBS"
		   "PTC_PRINTFRAMES"
		   "PTC_SELECT"
		   "PTC_SELECT_MOMENT"
		   "PTC_DUMPMAPS"
		   "PTC_EPLACEMENT"
		   "PTC_VARYKNOB"
		   "END_MATCH"
		   "PTC_MOMENTS"
		   "PTC_SETCAVITIES"
		   "PTC_SETDEBUGLEVEL"
		   "PTC_SETACCEL_METHOD"
		   "PTC_SETEXACTMIS"
		   "PTC_SETRADIATION"
		   "PTC_SETTOTALPATH"
		   "PTC_SETTIME"
		   "PTC_SETFRINGE"
		   ;; madx-font-lock-keywords-controlstm              
		   "EXIT"
		   "QUIT"
		   "STOP"
		   "HELP"
		   "SHOW"
		   "VALUE"
		   "OPTION"
		   "EXEC"
		   "SET"
		   "SYSTEM"
		   "TITLE"
		   "USE"
		   "SELECT"
		   ;;  madx-font-lock-keywords-filehandstm
		   "ASSIGN"
		   "CALL"
		   "RETURN"
		   "PRINT"
		   "PRINTF"
		   "RENAMEFILE"
		   "COPYFILE"
		   "REMOVEFILE"
		   ;;  madx-font-lock-keywords-tablehandstm
		   "CREATE"
		   "DELETE"
		   "READTABLE"
		   "READMYTABLE"
		   "WRITE"
		   "SETVARS"
		   "SETVARS_LIN"
		   "FILL"
		   "SHRINK"
		   ;;  madx-font-lock-keywords-beamhandstm
		   "BEAM"
		   "RESBEAM"
		   ;; madx-font-lock-keywords-seqediting
		   "SEQEDIT"
		   "FLATTEN"
		   "CYCLE"
		   "REFLECT"
		   "INSTALL"
		   "MOVE"
		   "REMOVE"
		   "REPLACE"
		   "EXTRACT"
		   "ENDEDIT"
		   "SAVE"        
		   "DUMPSEQU"
		   ;; madx-font-lock-keywords-othrcmds
		   "SAVEBETA"
		   "COGUESS"
		   "CONST"
		   "EOPTION"
		   "ESAVE"
		   "REAL"
		   ;; madx-font-lock-keywords-matchingmet
		   "LMDIF"
		   "MIGRAD"
		   "SIMPLEX"
		   "JACOBIAN"
		   "USE_MACRO"
		   ;; madx-font-lock-keywords-orbit_corr
		   "CORRECT"
		   "USEMONITOR"
		   "USEKICK"
		   "CSAVE"
		   "SETCORR"
		   "COPTION"
		   "SODD"
		   "SURVEY"
		   "SXFREAD"
		   "SXFWRITE"
		   "TOUSCHEK"
		   "TRACK"
		   "ENDTRACK"
		   ;; madx-font-lock-keywords-plot
		   "PLOT"
		   "RPLOT"
		   "RVIEWER"
		   "RTRACKSTORE"
		   "RESPLOT"
		   "SETPLOT"
		   "EPRINT"
		   ;; madx-font-lock-keywords-stringatt
		   "TITLE"
		   "system"
		   ) 'words)
     . font-lock-builtin-face))
  "Highlighting expressions for MAD-X mode (builtin-all).")

(defconst madx-font-lock-type-face-all
  ;; madx-font-lock-keywords-elements
  `((,(regexp-opt '(; font-lock-type-face
		   ;; madx-font-lock-keywords-elements
		   "DRIFT"
		   "QUADRUPOLE"
		   "SEXTUPOLE"
		   "OCTUPOLE"
		   "SOLENOID"
		   "CRABCAVITY"
		   "RFCAVITY"
		   "DIPEDGE"
		   "MULTIPOLE"
		   "COLLIMATOR"
		   "ECOLLIMATOR"
		   "RCOLLIMATOR"
		   "YROTATION"
		   "SROTATION"
		   "TRANSLATION"
		   "CHANGEREF"
		   "MARKER"
		   "RBEND"
		   "SBEND"
		   "DIPEDGE"
		   "HKICKER"
		   "VKICKER"
		   "KICKER"
		   "TKICKER"
		   "ELSEPARATOR"
		   "HMONITOR"
		   "VMONITOR"
		   "MONITOR"
		   "INSTRUMENT"
		   "PLACEHOLDER"
		   "BEAMBEAM"
		   "MATRIX"
		   "NLLENS"
		   "RFMULTIPOLE"
		   "ELSEPARATOR"
		   ) 'words)
     . font-lock-type-face))
  "Highlighting expressions for MAD-X mode (type-all).")

(defconst madx-font-lock-warning-face-all
  ;; madx-font-lock-keywords-errordef
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-keywords-errordef
		   "ERROR"
		   "EALIGN"
		   "EFCOMP"
		   "SETERR"
		   ) 'words)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (warning-all).")

(defconst madx-font-lock-special_operators
  ;; madx-font-lock-special_operators
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-special_operators
		   ":="
		   "->"
		   ) t)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (special-operators).")

(defconst madx-font-lock-constant-face-all
  ;; madx-font-lock-keywords-constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-keywords-constants
		   "POSITRON"
		   "ELECTRON"
		   "PROTON"
		   "ANTIPROTON"
		   "POSMUON"
		   "NEGMUON"
		   "ION"
		   "PI"
		   "TWOPI"
		   "DEGRAD"
		   "RADDEG"
		   "E"
		   "EMASS"
		   "PMASS"
		   "NMASS"
		   "MUMASS"
		   "CLIGHT"
		   "QELECT"
		   "HBAR"
		   "ERAD"
		   "PRAD"
		   "TRUE"
		   "FALSE"
		   "SIMPLE"
		   "COLLIM"
		   "TEAPOT"
		   "HYBRID"
		   "ENTRY"
		   "CENTRE"
		   "EXIT"
		   "CIRCLE"
		   "RECTANGLE"
		   "ELLIPSE"
		   "LHCSCREEN"
		   "MARGUERITE"
		   "RECTELLIPSE"
		   "RACETRACK"
		   "OCTAGON"
		   "TERMINAL"
		   ) 'words)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (constant-all).")

(defconst madx-font-lock-special_constants
  ;; madx-font-lock-special_constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-special_constants
		   "#e"
		   "#s"
		   ) t)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (special_constants).")

(defconst madx-font-lock-doc-face-all
  ;; madx-font-lock-keywords-parameters
  `((,(regexp-opt '(;; font-lock-doc-face
		   ;; madx-font-lock-keywords-parameters
		   "NOEXPR" ;2016.08
		   "KNLL" ;2016.08
		   "CNLL" ;2016.08
		   "ROOTMACRO"
		   "MOMENT_S"
		   "MOMENT"
		   "SURVEYALL"
		   "DELTA_DEPENDENCY"
		   "IGNORE_MAP_ORBIT"
		   "RING_PARAMETERS"
		   "CENTER_MAGNETS"
		   "SUMMARY_FILE"
		   "SUMMARY_TABLE"
		   "MAPTABLE"
		   "DELS"
		   "TXI"
		   "TYI"
		   "TLI"
		   "UPDATE"
		   "NCORR"
		   "SNGVAL"
		   "SNGCUT"
		   "CORRLIM"
		   "TWORING"
		   "UNITS"
		   "CORZERO"
		   "BEAM1TAB"
		   "BEAM2TAB"
		   "EXTERN"
		   "NAME_COL"
		   "X_COL"
		   "Y_COL"
		   "TWISSUM"
		   "LSQ"
		   "MICADO"
		   "SVD"
		   "THICK"
		   "VECTOR"
		   "expr"
		   "VLENGTH"
		   "SLOW"
		   "PATCH_ANG"
		   "PATCH_TRANS"
		   "ADD_ANGLE"
		   "ADD_PASS"
		   "NEXT_SEQU"
		   "ZERO_SUPPR"
		   "N_BESSEL"
		   "RIPKEN"
		   "NO_CAVITY_TOTALPATH"
		   "PNL"
		   "PSL"
		   "MAKEDIPEDGE"
		   "TRUNCATE"
		   "APPEND"
		   "ROW1"
		   "ROW1"
		   "PARAM"
		   "SINKICK"
		   "SINPEAK"
		   "SINTUNE"
		   "SINPHASE"
		   "L"
		   "K1"
		   "K1S"
		   "TILT"
		   "K2"
		   "K2S"
		   "K3"
		   "K3S"
		   "KS"
		   "K3S"
		   "KSI"
		   "VOLT"
		   "LAG"
		   "FREQ"
		   "HARMON"
		   "rv1"
		   "rv2"
		   "rv3"
		   "rv4"
		   "rph1"
		   "rph2"
		   "lagf"
		   "PARTICLE"
		   "MASS"
		   "CHARGE"
		   "ENERGY"
		   "PC"
		   "GAMMA"
		   "BETA"
		   "BRHO"
		   "EX"
		   "EXN"
		   "EY"
		   "EYN"
		   "ET"
		   "SIGT"
		   "SIGE"
		   "KBUNCH"
		   "NPART"
		   "PLANE"
		   "BCURRENT"
		   "CURRENT"
		   "BUNCHED"
		   "RADIATE"
		   "NORM_NO"
		   "BV"
		   "SEQUENCE"
		   "ENDSEQUENCE"
		   "REFER"
		   "MAD8"
		   "GNFU"
		   "KICK"
		   "HKICK"
		   "VKICK"
		   "ANGLE"
		   "K0"
		   "K0S"
		   "RESPLIT"
		   "DAMP"
		   "QUANTUM"
		   "RECLOSS"
		   "ELEMENT_BY_ELEMENT"
		   "NORM"
		   "NORM_OUT"
		   "RADIATION_MODEL1"
		   "RADIATION_ENERGY_LOSS"
		   "RADIATION_QUADr"
		   "BEAM_ENVELOPE"
		   "SPACE_CHARGE"
		   "FX"
		   "FY"
		   "FT"
		   "FFILE"
		   "E1"
		   "E2"
		   "FINT"
		   "FINTX"
		   "HGAP"
		   "H1"
		   "H2"
		   "FLAG"
		   "RANGE"
		   "PLACE"
		   "PARENT"
		   "KEYWORD"
		   "FROM"
		   "AT"
		   "REFPOS"
		   "LENGTH"
		   "EXACT_MIS"
		   "CLASS"
		   "PATTERN"
		   "FILE"
		   "FORMAT"
		   "RBARC"
		   "TWISS_PRINT"
		   "THREADER"
		   "THIN_FOC"
		   "NO_FATAL_STOP"
		   "TEXT"
		   "BARE"
		   "SLICE"
		   "THICK"
		   "COMMAND"
		   "TO"
		   "NEWNAME"
		   "BY"
		   "SELECTED"
		   "H"
		   "LRAD"
		   "KNL"
		   "KSL"
		   "TYPE"
		   "SIGX"
		   "SIGY"
		   "XMA"
		   "YMA"
		   "BBSHAPE"
		   "WIDTH"
		   "BBDIR"
		   "ECHO"
		   "ECHOMACRO"
		   "TRACE"
		   "VERIFY"
		   "PERIOD"
		   "SECTORMAP"
		   "SECTORFILE"
		   "KEEPORBIT"
		   "USEORBIT"
		   "COUPLE"
		   "FULL"
		   "COLUMN"
		   "MOMENTS"
		   "PARAMETRIC"
		   "CLEAR"
		   "POS"
		   "POLYNOMIAL"
		   "MONOMIAL"
		   "PARAMETRIC"
		   "QUANTITY"
		   "ROW"
		   "SEED"
		   "ADD"
		   "INFO"
		   "DEBUG"
		   "VERBOSE"
		   "TELL"
		   "RESET"
		   "WARN"
		   "LABEL"
		   "APERTYPE"
		   "HAXIS"
		   "HMIN"
		   "HMAX"
		   "VAXIS"
		   "VAXIS1"
		   "VAXIS2"
		   "VAXIS3"
		   "VAXIS4"
		   "VMIN"
		   "VMAX"
		   "BARS"
		   "SYMBOL"
		   "NOVERSION"
		   "NO_FATAL_ERROR"
		   "NO_FATAL_STOP"
		   "INTERPOLATE"
		   "NOLINE"
		   "NOTITLE"
		   "MARKER_PLOT"
		   "RANGE_PLOT"
		   "MULTIPLE"
		   "PTC"
		   "PTC_TABLE"
		   "TRACKFILE"
		   "CAVALL"
		   "MULT_AUTO_OFF"
		   "MAX_MULT_ORD"
		   "SPLIT"
		   "RADIUS"
		   "WARNING"
		   "STYLE"
		   "COLOUR"
		   "TURNS"
		   "EVERYSTEP"
		   "ONETABLE"
		   "TABLEALLSTEPS"
		   "GCS"
		   "ROOTNTUPLE"
		   "EXTENSION"
		   "FASTUNE"
		   "MAXAPER"
		   "LYAPUNOV"
		   "ORBIT"
		   "TOL"
		   "DS"
		   "DPHI"
		   "DTHETA"
		   "DPSI"
		   "MREX"
		   "MREY"
		   "MSCALX"
		   "MSCALY"
		   "AREX"
		   "AREY"
		   "ORDER"
		   "DKN"
		   "DKS"
		   "DKNR"
		   "DKSR"
		   "HYSTER"
		   "HCOEFFN"
		   "HCOEFFS"
		   "BETA0"
		   "RMATRIX"
		   "STEP"
		   "CHROM"
		   "LOWER"
		   "UPPER"
		   "SLOPE"
		   "OPT"
		   "CALLS"
		   "NO"
		   "XDISTR"
		   "YDISTR"
		   "ZDISTR"
		   "TOLERANCE"
		   "STRATEGY"
		   "REPEAT"
		   "BISEC"
		   "COOL"
		   "BALANCE"
		   "RANDOM"
		   "MODEL"
		   "TARGET"
		   "MODE"
		   "MONERROR"
		   "MONON"
		   "MONSCALE"
		   "PLANEX"
		   "COND"
		   "RESOUT"
		   "CLIST"
		   "MLIST"
		   "STATUS"
		   "POST"
		   "FONT"
		   "LWIDTH"
		   "APER_TOL"
		   "APER_OFFSET"
		   "HALOFILE"
		   "PIPEFILE"
		   "DQF"
		   "BETAQFX"
		   "DP"
		   "DPARX"
		   "DPARY"
		   "COR"
		   "BBEAT"
		   "NCO"
		   "HALO"
		   "INTERVAL"
		   "SPEC"
		   "NOTSIMPLE"
		   "TRUEPROFILE"
		   "OFFSETELEM"
		   "XSIZE"
		   "YSIZE"
		   "ASCALE"
		   "LSCALE"
		   "SSCALE"
		   "RSCALE"
		   "DETUNE"
		   "DISTORT1"
		   "DISTORT2"
		   "START_STOP"
		   "MULTIPOLE_ORDER_RANGE"
		   "NOPRINT"
		   "PRINT_ALL"
		   "PRINT_AT_END"
		   "NOSIXTRACK"
		   "X0"
		   "Y0"
		   "Z0"
		   "THETA0"
		   "PHI0"
		   "PSI0"
		   "SUMM"
		   "CENTRE"
		   "SECTOR_NMUL_MAX"
		   "SECTOR_nMUL"
		   "NTPSA"
		   "SYMPRINT"
		   "TIME"
		   "METHOD"
		   "NST"
		   "EXACT"
		   "OFFSET_DELTAP"
		   "ERRORS_OUT"
		   "ERRORS_IN"
		   "MAGNET_NAME"
		   "RESPLIT"
		   "THIN"
		   "XBEND"
		   "EVEN"
		   "OVERWRITE"
		   "INDEX"
		   "ONEPASS"
		   "DUMP"
		   "DEBUGLEVEL"
		   "LEVEL"
		   "BBORBIT"
		   "SYMPL"
		   "MAXACCELERATION"
		   "EXACT_MISS"
		   "TOTALPATH"
		   "RADIATION"
		   "FRINGE"
		   "ICASE"
		   "CLOSED_ORBIT"
		   "SLICE_MAGNETS"
		   "INITIAL_MATRIX_TABLE"
		   "MATRIX_MANUAL"
		   "INITIAL_MAP_MANUAL"
		   "INITIAL"
		   "ELEMENT"
		   "TRUSTRANGE"
		   "ANHX"
		   "ANHY"
		   "GNUF"
		   "HAML"
		   "EIGN"
		   "INITIAL_MATRIX_MANUAL"
		   "ELEMENTNAME"
		   "KN"
		   "KS"
		   "EXACTMATCH"
		   "ONLYPOSITION"
		   "ONLYORIENTATION"
		   "AUTOPLACEDOWNSTREAM"
		   "REFFRAME"
		   "USE_PTCKNOBS"
		   ) 'words)
     . font-lock-doc-face))
  "Highlighting expressions for MAD-X mode (doc-all).")

(defconst madx-font-lock-function-name-face-all
  ;; madx-font-lock-keywords-functions
  `((,(regexp-opt '(;;  font-lock-function-name-face
		   ;; madx-font-lock-keywords-functions
		   "SQRT"
		   "LOG"
		   "LOG10"
		   "EXP"
		   "SIN"
		   "COS"
		   "TAN"
		   "ASIN"
		   "ACOS"
		   "ATAN"
		   "SINH"
		   "COSH"
		   "TANH"
		   "SINC"
		   "ABS"
		   "ERF"
		   "ERFC"
		   "FLOOR"
		   "CEIL"
		   "ROUND"
		   "RANF"
		   "GAUSS"
		   "TGAUSS"
		   "FLAT5"
		   "FLAT56"
		   ) 'words)
     . font-lock-function-name-face))
  "Highlighting expressions for MAD-X mode (name-all)." )

(defconst madx-font-lock-variable-name-face-all
  ;; madx-font-lock-keywords-variables_madx
  `((,(concat (regexp-opt '(;; font-lock-variable-name-face
		    ;; madx-font-lock-keywords-variables_madx
		    "mvar1"
		    "mvar2"
		    "mvar3"
		    "mvar4"
		    "CIRC"
		    "FREQ0"
		    "DTBYDS"
		    "U0"
		    "QS"
		    "ARAD"
		    "PDAMP"
		    "N1MIN"
		    "Z"
		    "PHI"
		    "PSI"
		    "X"
		    "Y"
		    "BETX"
		    "BETY"
		    "NAME"
		    "S"
		    "k0l"
		    "k1l"
		    "k2l"
		    "k3l"
		    "k4l"
		    "K1"
		    "K2"
		    "K3"
		    "K4"
		    "K5"
		    "K6"
		    "K1L"
		    "K2L"
		    "K3L"
		    "K4L"
		    "K5L"
		    "K6L"       
		    "KICK1"
		    "KICK2"
		    "KICK3"
		    "KICK4"
		    "KICK5"
		    "KICK6"
		    "MU1"
		    "MU2"
		    "MU3"
		    "MUX"
		    "MUY"
		    "PX"
		    "PY"
		    "PT"
		    "DELTAP"
		    "XN"
		    "PXN"
		    "WX"
		    "PHI"
		    "THETA"
		    "PHIX"
		    "YN"
		    "PYN"
		    "WY"
		    "PHIY"
		    "TN"
		    "PTN"
		    "WT"
		    "PHIT"
		    "ALFX"
		    "DX"
		    "DPX"
		    "ALFY"
		    "DY"
		    "DPY"
		    "ENERGY"
		    "DMUX"
		    "DDX"
		    "DDPX"
		    "DMUY"
		    "DDY"
		    "DDPY"
		    "Q1"
		    "Q2"
		    "DQ1"
		    "DQ2"
		    "DDQ1"
		    "DDQ2"
		    "N1"
		    "N1X_M"
		    "N1Y_M"
		    "APER_1"
		    "APER_2"
		    "APER_3"
		    "APER_4"
		    "RTOL"
		    "XTOL"
		    "YTOL"
		    "ON_AP"
		    "ON_ELEM"
		    "LENGTH"
		    "ORBIT5"
		    "BETXMAX"
		    "DXMAX"
		    "DXRMS"
		    "XCOMAX"
		    "XRMS"
		    "BETYMAX"
		    "DYMAX"
		    "DYRMS"
		    "YCOMAX"
		    "YCORMS"
		    "SYNCH_1"
		    "SYNCH_2"
		    "SYNCH_3"
		    "SYNCH_4"
		    "SYNCH_5"
		    "DISTANCE"
		    "LYAPUNOV"
		    "LOGDIST"
		    "LOGTURNS"
		    "RE"
;		    "RE11";REPLACE BY RE[1-6][1-6]
		    "T"
;		    "T111";; REPLACE BY T[1-6][1-6][1-6]
;		    "TM111";; REPLACE BY TM[1-6][1-6][1-6]
;		    "BETA11"; REPLACE BY BETA[1-3][1-3]
;		    "BETA11P"; REPLACE BY BETA[1-3][1-3]P
		    "ALFA"
;		    "ALFA11"; REPLACE BY ALFA[1-3][1-3]
;		    "ALFA11P"; REPLACE BY ALFA[1-3][1-3]P
		    "GAMMATR"
		    "GAMAX"
		    "GAMAY"
;		    "GAMA11"; REPLACE BY GAMA[1-3][1-3]
;		    "GAMA11P"; REPLACE BY GAMA[1-3][1-3]P
;		    "GAMMA11"; REPLACE BY GAMA[1-3][1-3]
		    "DISP1"
		    "DISP2"
		    "DISP3"
		    "DISP4"
;		    "DISP1P1"; REPLACE BY DISP[1-4]P[1-3]
;		    "EIGN11"; REPLACE BY EIGN[1-6][1-6]
		    "R"
;		    "R11";; REPLACE BY R[1-6][1-6] AFTER REGEXP-OPT
;		    "RM11";; REPLACE BY RM[1-6][1-6] AFTER REGEXP-OPT		    
		    ) 'words)
	      ;; some variables already optimized
	      "\\|RE[1-6][1-6]"
	      "\\|T[1-6][1-6][1-6]"
	      "\\|TM[1-6][1-6][1-6]"
	      "\\||BETA[1-3][1-3]"
	      "\\|BETA[1-3][1-3]P"
	      "\\|ALFA[1-3][1-3]"
	      "\\|ALFA[1-3][1-3]P"
	      "\\|GAMA[1-3][1-3]"
	      "\\|GAMA[1-3][1-3]P"
	      "\\|GAMA[1-3][1-3]"
	      "\\|DISP[1-4]P[1-3]"
	      "\\|EIGN[1-6][1-6]"
	      "\\|R[1-6][1-6]"
	      "\\|RM[1-6][1-6]")
     . font-lock-variable-name-face))
  "Highlighting expressions for MAD-X mode (variable-name-all).")

(defconst madx-font-lock-intfp-name-face-all
  ;; madx- fonts for integers and floating point numbers
  (list
   '("\\<\\(\\([0-9]+\\.?[0-9]*\\|\\.[0-9]+\\)\\([eE][+-]?\\([0-9]+\\.?[0-9]*\\|[0-9]*\\.[0-9]+\\)\\)?\\)\\>"
     . font-lock-keyword-face))
  "Highlighting expresssions for MAD-X mode (integers and floats).")

(defconst madx-font-lock-keywords-4
  (append
   madx-font-lock-special_constants
   madx-font-lock-special_operators
   madx-font-lock-keywords-face-all
   madx-font-lock-constant-face-all
   madx-font-lock-function-name-face-all
   madx-font-lock-type-face-all
   madx-font-lock-variable-name-face-all
   madx-font-lock-builtin-face-all
   madx-font-lock-warning-face-all
   madx-font-lock-doc-face-all
   madx-font-lock-intfp-name-face-all)
 "Balls-out highlighting in MAD-X mode.")

(defvar madx-font-lock-keywords madx-font-lock-keywords-4
  "Default highlighting expressions for MAD-X mode.")

(defvar madx-mode-syntax-table
  (let ((madx-mode-syntax-table (make-syntax-table)))
	
  ;; This is added so entity names with underscores and dots can be more easily parsed
  (modify-syntax-entry ?_ "w" madx-mode-syntax-table)
  (modify-syntax-entry ?. "w" madx-mode-syntax-table)
	
  ;;  Comment styles are similar to C++
  (modify-syntax-entry ?/ ". 124 b" madx-mode-syntax-table)
  (modify-syntax-entry ?* ". 23" madx-mode-syntax-table)
  (modify-syntax-entry ?\n "> b" madx-mode-syntax-table)
  (modify-syntax-entry ?! "< b" madx-mode-syntax-table)
  (modify-syntax-entry ?' "|" madx-mode-syntax-table)
     madx-mode-syntax-table)
  "Syntax table for `madx-mode'.")

(define-derived-mode madx-mode fundamental-mode "madx"
  "Major mode for editing Methodical Accelerator Design X script files."
  (kill-all-local-variables)
  ;;  (use-local-map madx-mode-map)
  (set-syntax-table madx-mode-syntax-table)
  (make-local-variable 'font-lock-defaults)
  (setq font-lock-defaults '(madx-font-lock-keywords nil t))
  ;; Setting up Imenu
  (setq imenu-generic-expression nil)
  (setq imenu-prev-index-position-function nil)
  (setq imenu-extract-index-name-function nil)
  ;;  (imenu-create-index-function)
  ;; Set up search
  (setq case-fold-search t)
  )
(provide 'madx-mode)
;;; madx.el ends here

[-- Attachment #3: madx-autoloads.el --]
[-- Type: text/x-emacs-lisp, Size: 1415 bytes --]

;;; madx-autoloads.el --- loads madx-mode


;; Copyright (C) 2013, 2016 Oscar BLANCO
;;               2017, 2018 FSF

;; Maintainer : orblancog
;; Created    : 18 Nov 2017
;; Keywords   : languages
;; Homepage   : https://github.com/orblancog/mad-x_syntax
;; Version    : 1.7

;; This file is not part of GNU Emacs

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU Affero General Public License for more details.

;; You should have received a copy of the GNU Affero General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;; madx-mode autoload

;;; Code:
(global-font-lock-mode t); Enable syntax highlighting
(setq font-lock-maximum-decoration t)
;; edit accordingly to madx.el location
;(add-to-list 'load-path "~/.emacs.d")
(autoload 'madx-mode "madx" "madx-mode" t)
(setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" . madx-mode))			      
   auto-mode-alist))

(provide 'madx-autoloads)
;;; madx-autoloads.el ends here

^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-10-05  6:52   ` Oscar Blanco
@ 2018-10-24 22:30     ` Noam Postavsky
  0 siblings, 0 replies; 15+ messages in thread
From: Noam Postavsky @ 2018-10-24 22:30 UTC (permalink / raw)
  To: Oscar Blanco; +Cc: 31289

Oscar Blanco <orblancog@gmail.com> writes:

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

The madx-autoloads.el will be generated when installing the package from
forms that are prefix with

    ;;;###autoload

See `(elisp) Autoload'.  You can test it out using M-x package-install-file. 

> ;;; madx.el --- Major mode for editing MAD-X files in Emacs

> ;; Copyright (C) 2013, 2016 Oscar BLANCO
> ;;               2017, 2018 FSF

You don't seem to be listed in copyright assignment file; to officially
assign copyright to the FSF you need to sign some legal papers.
Instructions to begin the process are at
https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future

> (defconst madx-font-lock-keywords-face-all
>   ;; madx-font-lock-keywords-programflow
>   `((,(regexp-opt '(;; font-lock-keyword-face
> 		    ;; madx-font-lock-keywords-programflow
> 		   "IF"
> 		   "ELSEIF"
> 		   "ELSE"
> 		   "WHILE"
> 		   "MACRO"
> 		   ) 'words)

I would prefer the close paren grouped with the sexp it closes, as in

    `((,(regexp-opt '(;; font-lock-keyword-face
                      ;; madx-font-lock-keywords-programflow
                      "IF"
                      "ELSEIF"
                      "ELSE"
                      "WHILE"
                      "MACRO")
                    'words)
       .  font-lock-keyword-face))

> 	      ;; some variables already optimized
> 	      "\\|RE[1-6][1-6]"
> 	      "\\|T[1-6][1-6][1-6]"
> 	      "\\|TM[1-6][1-6][1-6]"

These two could be written as just "\\|TM?[1-6][1-6][1-6]"

> 	      "\\||BETA[1-3][1-3]"
> 	      "\\|BETA[1-3][1-3]P"

I guess that extra "|" is a typo; again you could coalesce these into
"\\|BETA[1-3][1-3]P?", similar for the following ones.

> 	      "\\|ALFA[1-3][1-3]"
> 	      "\\|ALFA[1-3][1-3]P"
> 	      "\\|GAMA[1-3][1-3]"
> 	      "\\|GAMA[1-3][1-3]P"
> 	      "\\|GAMA[1-3][1-3]"
> 	      "\\|DISP[1-4]P[1-3]"
> 	      "\\|EIGN[1-6][1-6]"
> 	      "\\|R[1-6][1-6]"
> 	      "\\|RM[1-6][1-6]")
>      . font-lock-variable-name-face))
>   "Highlighting expressions for MAD-X mode (variable-name-all).")

> (define-derived-mode madx-mode fundamental-mode "madx"
>   "Major mode for editing Methodical Accelerator Design X script files."
>   (kill-all-local-variables)
>   ;;  (use-local-map madx-mode-map)
>   (set-syntax-table madx-mode-syntax-table)

define-derived-mode already does kill-all-local-variables,
use-local-map, and set-syntax-table, so you don't need to put them here.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-04-27 11:00 bug#31289: madx mode for emacs Oscar Blanco
  2018-06-22  0:50 ` Noam Postavsky
@ 2018-10-25 22:56 ` Noam Postavsky
  2018-10-25 23:18   ` Noam Postavsky
  2018-10-26 10:41 ` Noam Postavsky
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Noam Postavsky @ 2018-10-25 22:56 UTC (permalink / raw)
  To: 31289; +Cc: Oscar Blanco

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

[forwarding to list, minus copyright assignment; no need to publish that]


[-- Attachment #2: Type: message/rfc822, Size: 31093 bytes --]

[-- Attachment #2.1.1.1: Type: text/plain, Size: 3133 bytes --]

Hello,

I have made the modifications to madx.el, and I am attaching the copyright
assignment that I signed in February.

o

Il giorno gio 25 ott 2018 alle ore 00:30 Noam Postavsky <npostavs@gmail.com>
ha scritto:

> Oscar Blanco <orblancog@gmail.com> writes:
>
> > I attached again the script with the corresponding modifications. I
> > understand that an additional script called madx-autoloads.el is
> required.
>
> The madx-autoloads.el will be generated when installing the package from
> forms that are prefix with
>
>     ;;;###autoload
>
> See `(elisp) Autoload'.  You can test it out using M-x
> package-install-file.
>
> > ;;; madx.el --- Major mode for editing MAD-X files in Emacs
>
> > ;; Copyright (C) 2013, 2016 Oscar BLANCO
> > ;;               2017, 2018 FSF
>
> You don't seem to be listed in copyright assignment file; to officially
> assign copyright to the FSF you need to sign some legal papers.
> Instructions to begin the process are at
>
> https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future
>
> > (defconst madx-font-lock-keywords-face-all
> >   ;; madx-font-lock-keywords-programflow
> >   `((,(regexp-opt '(;; font-lock-keyword-face
> >                   ;; madx-font-lock-keywords-programflow
> >                  "IF"
> >                  "ELSEIF"
> >                  "ELSE"
> >                  "WHILE"
> >                  "MACRO"
> >                  ) 'words)
>
> I would prefer the close paren grouped with the sexp it closes, as in
>
>     `((,(regexp-opt '(;; font-lock-keyword-face
>                       ;; madx-font-lock-keywords-programflow
>                       "IF"
>                       "ELSEIF"
>                       "ELSE"
>                       "WHILE"
>                       "MACRO")
>                     'words)
>        .  font-lock-keyword-face))
>
> >             ;; some variables already optimized
> >             "\\|RE[1-6][1-6]"
> >             "\\|T[1-6][1-6][1-6]"
> >             "\\|TM[1-6][1-6][1-6]"
>
> These two could be written as just "\\|TM?[1-6][1-6][1-6]"
>
> >             "\\||BETA[1-3][1-3]"
> >             "\\|BETA[1-3][1-3]P"
>
> I guess that extra "|" is a typo; again you could coalesce these into
> "\\|BETA[1-3][1-3]P?", similar for the following ones.
>
> >             "\\|ALFA[1-3][1-3]"
> >             "\\|ALFA[1-3][1-3]P"
> >             "\\|GAMA[1-3][1-3]"
> >             "\\|GAMA[1-3][1-3]P"
> >             "\\|GAMA[1-3][1-3]"
> >             "\\|DISP[1-4]P[1-3]"
> >             "\\|EIGN[1-6][1-6]"
> >             "\\|R[1-6][1-6]"
> >             "\\|RM[1-6][1-6]")
> >      . font-lock-variable-name-face))
> >   "Highlighting expressions for MAD-X mode (variable-name-all).")
>
> > (define-derived-mode madx-mode fundamental-mode "madx"
> >   "Major mode for editing Methodical Accelerator Design X script files."
> >   (kill-all-local-variables)
> >   ;;  (use-local-map madx-mode-map)
> >   (set-syntax-table madx-mode-syntax-table)
>
> define-derived-mode already does kill-all-local-variables,
> use-local-map, and set-syntax-table, so you don't need to put them here.
>


-- 
Oscar BLANCO

[-- Attachment #2.1.1.2: Type: text/html, Size: 4089 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1.2: madx.el --]
[-- Type: text/x-emacs-lisp; name=madx.el, Size: 22937 bytes --]

;;; madx.el --- Major mode for editing MAD-X files in Emacs

;; Copyright (C) 2013, 2016 Oscar BLANCO
;;               2017, 2018 FSF

;; Author     : orblancog <orblancog@gmail.com>
;; Maintainer : orblancog
;; Created    : 18 Nov 2017
;; Keywords   : languages
;; Homepage   : https://github.com/orblancog/mad-x_syntax
;; Version    : 1.8

;; This file is not part of GNU Emacs

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;; FEATURES in version 1.8
;; * Highlights commands, parameters and special operators in MAD-X 5
;; * If the file extension is '.madx' or '.seq' then the buffer is automatically
;;   highlighted, but any buffer can be highlighted by doing :
;;       `M+X madx-mode` RET
;;   where `M` is the **META** character in Emacs (`M` seems to be **ALT** in Linux)
;;   and RET means press RETURN key
;; * If the limit of 80 characters is desired, they could be highlighted differently
;;   by uncomment the line
;;       ;(require 'whitespace)
;;       ;(setq whitespace-line-column 80) ;; limit line length
;;       ;(setq whitespace-style '(face lines-tail))
;;       ;(add-hook 'madx-mode-hook 'whitespace-mode)
;;   in this (madx.el) file.
;; HOW TO INSTALL IT
;; a) Open this file in emacs and execute
;;      `M+X package-install-file` RET `madx.el` RET
;; b)
;; 1. Copy this file (madx.el) to the highlighting definition folder, e.g.
;;      a)  ~/.emacs.d/lisp/  ---> (Emacs v24.5.X or v25)
;;      b)  ~/.emacs.d/       ---> (Emacs v23.X.X)
;;      c)  ~/                ---> (Emacs v21.X.X)
;;    i.e.
;;      $ cp madx.el ~/.emacs.d/lisp/
;; 2. Edit or create your .emacs file, typically in ~/
;;      adding the following block where the load-path must match point 1.
;;      ;;;; START OF BLOCK TO COPY AND UNCOMMENT
;;      (global-font-lock-mode t);; Enable syntax highlighting
;;      (setq font-lock-maximum-decoration t)
;;      (add-to-list 'load-path "~/.emacs.d");; <--- edit according to 1.
;;      (autoload 'madx-mode "madx" "MADX-mode" t)
;;      (setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" . madx-mode))
;;        auto-mode-alist))
;;      ;;;; END OF BLOCK TO COPY AND UNCOMMENT
;; You should now restart EMACS in order to reload the environment variables.
;; INFO
;; * For mad instructions, visit
;;   mad.web.cern.ch/mad/
;; * Other syntax highlightings could be found inside the
;;   mad sources.  Check the 'syntax' folder in the madx dir !
;;   Write me to the email address above about any bug including an example.

;;; History:
;; v 1.0 First release at CERN. File is also available in the
;;       MAD-X sources "syntax" folder.
;; v 1.1 Adding comments and changing some verbosed names
;; v 1.2 email update oscar.roberto.blanco.garcia@cern.ch deprecated
;;       Adding some variables from MAD-X 5.02.10 manual
;;       Cleaning up faces 8D
;;       when exceeding 80 chars->extra chars in red
;; v 1.3 adding color to numbers and ;
;; v 1.4 Changes to put this file in the emacs elpa repository
;;       Changing email address to orblancog@gmail.com
;; v 1.5 Changing licence
;; v 1.6 Adding automatic syntax highlighting for ".seq"
;; v 1.7 Chaging licence to gpl3 and code-checking following GNU ELPA suggestions
;; v 1.8 Code changes following GNU suggestions
;;       Adding comments about package-install-file

;;; Code:
(defgroup madx nil
  "Major mode to edit MAD-X files in emacs."
  :group 'languages)

(defvar madx-mode-hook nil
  "Hook for madx-model initialize nil.")

;;;; add  80 characters line
;;;; (global-whitespace-mode +1)
;(require 'whitespace)
;(setq whitespace-line-column 80) ;; limit line length
;(setq whitespace-style '(face lines-tail))
;(add-hook 'madx-mode-hook 'whitespace-mode)

(defconst madx-font-lock-keywords-face-all
  ;; madx-font-lock-keywords-programflow
  `((,(regexp-opt '(;; font-lock-keyword-face
		    ;; madx-font-lock-keywords-programflow
		   "IF"
		   "ELSEIF"
		   "ELSE"
		   "WHILE"
		   "MACRO"
		   )
		  'words)
     .  font-lock-keyword-face))
  "Highlighting expressions for MAD-X mode (keywords-all).")

(defconst madx-font-lock-builtin-face-all
  ;; madx-font-lock-keywords-tableaccs
  ;; madx-font-lock-keywords-simul
  ;; madx-font-lock-keywords-controlstm
  ;; madx-font-lock-keywords-filehandstm
  ;; madx-font-lock-keywords-tablehandstm
  ;; madx-font-lock-keywords-beamhandstm
  ;; madx-font-lock-keywords-seqediting
  ;; madx-font-lock-keywords-othrcmds
  ;; madx-font-lock-keywords-matchingmet
  ;; madx-font-lock-keywords-orbit_corr
  ;; madx-font-lock-keywords-plot
  ;; madx-font-lock-keywords-stringatt
  `((,(regexp-opt '(;; font-lock-builtin-face
		   ;;  madx-font-lock-keywords-tableaccs
		   "TABLE"
		   "TABINDEX"
		   "TABSTRING"
		   ;; madx-font-lock-keywords-simul
		   "TWISS"
		   "IBS"
		   "LINE"
		   "MAKETHIN"
		   "APERTURE"
		   "SIXTRACK"
		   "DYNAP"
		   "EMIT"
		   "MATCH"
		   "ENDMATCH"
		   "VARY"
		   "CONSTRAINT"
		   "WEIGHT"
		   "GLOBAL"
		   "GWEIGHT"
		   "PTC_TWISS"
		   "PTC_PRINTPARAMETRIC"
		   "PTC_NORMAL"
		   "SELECT_PTC_NORMAL"
		   "PTC_TRACK"
		   "PTC_TRACK_LINE"
		   "PTC_CREATE_UNIVERSE"
		   "PTC_CREATE_LAYOUT"
		   "PTC_READ_ERRORS"
		   "PTC_MOVE_TO_LAYOUT"
		   "PTC_ALIGN"
		   "PTC_END"
		   "PTC_TRACK_END"
		   "START"
		   "RUN"
		   "PTC_OBSERVE"
		   "OBSERVE"
		   "PTC_START"
		   "PTC_SETSWITCH"
		   "PTC_KNOB"
		   "PTC_SETKNOBVALUE"
		   "MATCH WITHPTCKNOBS"
		   "PTC_PRINTFRAMES"
		   "PTC_SELECT"
		   "PTC_SELECT_MOMENT"
		   "PTC_DUMPMAPS"
		   "PTC_EPLACEMENT"
		   "PTC_VARYKNOB"
		   "END_MATCH"
		   "PTC_MOMENTS"
		   "PTC_SETCAVITIES"
		   "PTC_SETDEBUGLEVEL"
		   "PTC_SETACCEL_METHOD"
		   "PTC_SETEXACTMIS"
		   "PTC_SETRADIATION"
		   "PTC_SETTOTALPATH"
		   "PTC_SETTIME"
		   "PTC_SETFRINGE"
		   ;; madx-font-lock-keywords-controlstm              
		   "EXIT"
		   "QUIT"
		   "STOP"
		   "HELP"
		   "SHOW"
		   "VALUE"
		   "OPTION"
		   "EXEC"
		   "SET"
		   "SYSTEM"
		   "TITLE"
		   "USE"
		   "SELECT"
		   ;;  madx-font-lock-keywords-filehandstm
		   "ASSIGN"
		   "CALL"
		   "RETURN"
		   "PRINT"
		   "PRINTF"
		   "RENAMEFILE"
		   "COPYFILE"
		   "REMOVEFILE"
		   ;;  madx-font-lock-keywords-tablehandstm
		   "CREATE"
		   "DELETE"
		   "READTABLE"
		   "READMYTABLE"
		   "WRITE"
		   "SETVARS"
		   "SETVARS_LIN"
		   "FILL"
		   "SHRINK"
		   ;;  madx-font-lock-keywords-beamhandstm
		   "BEAM"
		   "RESBEAM"
		   ;; madx-font-lock-keywords-seqediting
		   "SEQEDIT"
		   "FLATTEN"
		   "CYCLE"
		   "REFLECT"
		   "INSTALL"
		   "MOVE"
		   "REMOVE"
		   "REPLACE"
		   "EXTRACT"
		   "ENDEDIT"
		   "SAVE"        
		   "DUMPSEQU"
		   ;; madx-font-lock-keywords-othrcmds
		   "SAVEBETA"
		   "COGUESS"
		   "CONST"
		   "EOPTION"
		   "ESAVE"
		   "REAL"
		   ;; madx-font-lock-keywords-matchingmet
		   "LMDIF"
		   "MIGRAD"
		   "SIMPLEX"
		   "JACOBIAN"
		   "USE_MACRO"
		   ;; madx-font-lock-keywords-orbit_corr
		   "CORRECT"
		   "USEMONITOR"
		   "USEKICK"
		   "CSAVE"
		   "SETCORR"
		   "COPTION"
		   "SODD"
		   "SURVEY"
		   "SXFREAD"
		   "SXFWRITE"
		   "TOUSCHEK"
		   "TRACK"
		   "ENDTRACK"
		   ;; madx-font-lock-keywords-plot
		   "PLOT"
		   "RPLOT"
		   "RVIEWER"
		   "RTRACKSTORE"
		   "RESPLOT"
		   "SETPLOT"
		   "EPRINT"
		   ;; madx-font-lock-keywords-stringatt
		   "TITLE"
		   "system"
		   )
		  'words)
     . font-lock-builtin-face))
  "Highlighting expressions for MAD-X mode (builtin-all).")

(defconst madx-font-lock-type-face-all
  ;; madx-font-lock-keywords-elements
  `((,(regexp-opt '(; font-lock-type-face
		   ;; madx-font-lock-keywords-elements
		   "DRIFT"
		   "QUADRUPOLE"
		   "SEXTUPOLE"
		   "OCTUPOLE"
		   "SOLENOID"
		   "CRABCAVITY"
		   "RFCAVITY"
		   "DIPEDGE"
		   "MULTIPOLE"
		   "COLLIMATOR"
		   "ECOLLIMATOR"
		   "RCOLLIMATOR"
		   "YROTATION"
		   "SROTATION"
		   "TRANSLATION"
		   "CHANGEREF"
		   "MARKER"
		   "RBEND"
		   "SBEND"
		   "DIPEDGE"
		   "HKICKER"
		   "VKICKER"
		   "KICKER"
		   "TKICKER"
		   "ELSEPARATOR"
		   "HMONITOR"
		   "VMONITOR"
		   "MONITOR"
		   "INSTRUMENT"
		   "PLACEHOLDER"
		   "BEAMBEAM"
		   "MATRIX"
		   "NLLENS"
		   "RFMULTIPOLE"
		   "ELSEPARATOR"
		   )
		  'words)
     . font-lock-type-face))
  "Highlighting expressions for MAD-X mode (type-all).")

(defconst madx-font-lock-warning-face-all
  ;; madx-font-lock-keywords-errordef
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-keywords-errordef
		   "ERROR"
		   "EALIGN"
		   "EFCOMP"
		   "SETERR"
		   )
		  'words)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (warning-all).")

(defconst madx-font-lock-special_operators
  ;; madx-font-lock-special_operators
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-special_operators
		   ":="
		   "->"
		   )
		  t)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (special-operators).")

(defconst madx-font-lock-constant-face-all
  ;; madx-font-lock-keywords-constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-keywords-constants
		   "POSITRON"
		   "ELECTRON"
		   "PROTON"
		   "ANTIPROTON"
		   "POSMUON"
		   "NEGMUON"
		   "ION"
		   "PI"
		   "TWOPI"
		   "DEGRAD"
		   "RADDEG"
		   "E"
		   "EMASS"
		   "PMASS"
		   "NMASS"
		   "MUMASS"
		   "CLIGHT"
		   "QELECT"
		   "HBAR"
		   "ERAD"
		   "PRAD"
		   "TRUE"
		   "FALSE"
		   "SIMPLE"
		   "COLLIM"
		   "TEAPOT"
		   "HYBRID"
		   "ENTRY"
		   "CENTRE"
		   "EXIT"
		   "CIRCLE"
		   "RECTANGLE"
		   "ELLIPSE"
		   "LHCSCREEN"
		   "MARGUERITE"
		   "RECTELLIPSE"
		   "RACETRACK"
		   "OCTAGON"
		   "TERMINAL"
		   )
		  'words)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (constant-all).")

(defconst madx-font-lock-special_constants
  ;; madx-font-lock-special_constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-special_constants
		   "#e"
		   "#s"
		   )
		  t)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (special_constants).")

(defconst madx-font-lock-doc-face-all
  ;; madx-font-lock-keywords-parameters
  `((,(regexp-opt '(;; font-lock-doc-face
		   ;; madx-font-lock-keywords-parameters
		   "NOEXPR" ;2016.08
		   "KNLL" ;2016.08
		   "CNLL" ;2016.08
		   "ROOTMACRO"
		   "MOMENT_S"
		   "MOMENT"
		   "SURVEYALL"
		   "DELTA_DEPENDENCY"
		   "IGNORE_MAP_ORBIT"
		   "RING_PARAMETERS"
		   "CENTER_MAGNETS"
		   "SUMMARY_FILE"
		   "SUMMARY_TABLE"
		   "MAPTABLE"
		   "DELS"
		   "TXI"
		   "TYI"
		   "TLI"
		   "UPDATE"
		   "NCORR"
		   "SNGVAL"
		   "SNGCUT"
		   "CORRLIM"
		   "TWORING"
		   "UNITS"
		   "CORZERO"
		   "BEAM1TAB"
		   "BEAM2TAB"
		   "EXTERN"
		   "NAME_COL"
		   "X_COL"
		   "Y_COL"
		   "TWISSUM"
		   "LSQ"
		   "MICADO"
		   "SVD"
		   "THICK"
		   "VECTOR"
		   "expr"
		   "VLENGTH"
		   "SLOW"
		   "PATCH_ANG"
		   "PATCH_TRANS"
		   "ADD_ANGLE"
		   "ADD_PASS"
		   "NEXT_SEQU"
		   "ZERO_SUPPR"
		   "N_BESSEL"
		   "RIPKEN"
		   "NO_CAVITY_TOTALPATH"
		   "PNL"
		   "PSL"
		   "MAKEDIPEDGE"
		   "TRUNCATE"
		   "APPEND"
		   "ROW1"
		   "ROW1"
		   "PARAM"
		   "SINKICK"
		   "SINPEAK"
		   "SINTUNE"
		   "SINPHASE"
		   "L"
		   "K1"
		   "K1S"
		   "TILT"
		   "K2"
		   "K2S"
		   "K3"
		   "K3S"
		   "KS"
		   "K3S"
		   "KSI"
		   "VOLT"
		   "LAG"
		   "FREQ"
		   "HARMON"
		   "rv1"
		   "rv2"
		   "rv3"
		   "rv4"
		   "rph1"
		   "rph2"
		   "lagf"
		   "PARTICLE"
		   "MASS"
		   "CHARGE"
		   "ENERGY"
		   "PC"
		   "GAMMA"
		   "BETA"
		   "BRHO"
		   "EX"
		   "EXN"
		   "EY"
		   "EYN"
		   "ET"
		   "SIGT"
		   "SIGE"
		   "KBUNCH"
		   "NPART"
		   "PLANE"
		   "BCURRENT"
		   "CURRENT"
		   "BUNCHED"
		   "RADIATE"
		   "NORM_NO"
		   "BV"
		   "SEQUENCE"
		   "ENDSEQUENCE"
		   "REFER"
		   "MAD8"
		   "GNFU"
		   "KICK"
		   "HKICK"
		   "VKICK"
		   "ANGLE"
		   "K0"
		   "K0S"
		   "RESPLIT"
		   "DAMP"
		   "QUANTUM"
		   "RECLOSS"
		   "ELEMENT_BY_ELEMENT"
		   "NORM"
		   "NORM_OUT"
		   "RADIATION_MODEL1"
		   "RADIATION_ENERGY_LOSS"
		   "RADIATION_QUADr"
		   "BEAM_ENVELOPE"
		   "SPACE_CHARGE"
		   "FX"
		   "FY"
		   "FT"
		   "FFILE"
		   "E1"
		   "E2"
		   "FINT"
		   "FINTX"
		   "HGAP"
		   "H1"
		   "H2"
		   "FLAG"
		   "RANGE"
		   "PLACE"
		   "PARENT"
		   "KEYWORD"
		   "FROM"
		   "AT"
		   "REFPOS"
		   "LENGTH"
		   "EXACT_MIS"
		   "CLASS"
		   "PATTERN"
		   "FILE"
		   "FORMAT"
		   "RBARC"
		   "TWISS_PRINT"
		   "THREADER"
		   "THIN_FOC"
		   "NO_FATAL_STOP"
		   "TEXT"
		   "BARE"
		   "SLICE"
		   "THICK"
		   "COMMAND"
		   "TO"
		   "NEWNAME"
		   "BY"
		   "SELECTED"
		   "H"
		   "LRAD"
		   "KNL"
		   "KSL"
		   "TYPE"
		   "SIGX"
		   "SIGY"
		   "XMA"
		   "YMA"
		   "BBSHAPE"
		   "WIDTH"
		   "BBDIR"
		   "ECHO"
		   "ECHOMACRO"
		   "TRACE"
		   "VERIFY"
		   "PERIOD"
		   "SECTORMAP"
		   "SECTORFILE"
		   "KEEPORBIT"
		   "USEORBIT"
		   "COUPLE"
		   "FULL"
		   "COLUMN"
		   "MOMENTS"
		   "PARAMETRIC"
		   "CLEAR"
		   "POS"
		   "POLYNOMIAL"
		   "MONOMIAL"
		   "PARAMETRIC"
		   "QUANTITY"
		   "ROW"
		   "SEED"
		   "ADD"
		   "INFO"
		   "DEBUG"
		   "VERBOSE"
		   "TELL"
		   "RESET"
		   "WARN"
		   "LABEL"
		   "APERTYPE"
		   "HAXIS"
		   "HMIN"
		   "HMAX"
		   "VAXIS"
		   "VAXIS1"
		   "VAXIS2"
		   "VAXIS3"
		   "VAXIS4"
		   "VMIN"
		   "VMAX"
		   "BARS"
		   "SYMBOL"
		   "NOVERSION"
		   "NO_FATAL_ERROR"
		   "NO_FATAL_STOP"
		   "INTERPOLATE"
		   "NOLINE"
		   "NOTITLE"
		   "MARKER_PLOT"
		   "RANGE_PLOT"
		   "MULTIPLE"
		   "PTC"
		   "PTC_TABLE"
		   "TRACKFILE"
		   "CAVALL"
		   "MULT_AUTO_OFF"
		   "MAX_MULT_ORD"
		   "SPLIT"
		   "RADIUS"
		   "WARNING"
		   "STYLE"
		   "COLOUR"
		   "TURNS"
		   "EVERYSTEP"
		   "ONETABLE"
		   "TABLEALLSTEPS"
		   "GCS"
		   "ROOTNTUPLE"
		   "EXTENSION"
		   "FASTUNE"
		   "MAXAPER"
		   "LYAPUNOV"
		   "ORBIT"
		   "TOL"
		   "DS"
		   "DPHI"
		   "DTHETA"
		   "DPSI"
		   "MREX"
		   "MREY"
		   "MSCALX"
		   "MSCALY"
		   "AREX"
		   "AREY"
		   "ORDER"
		   "DKN"
		   "DKS"
		   "DKNR"
		   "DKSR"
		   "HYSTER"
		   "HCOEFFN"
		   "HCOEFFS"
		   "BETA0"
		   "RMATRIX"
		   "STEP"
		   "CHROM"
		   "LOWER"
		   "UPPER"
		   "SLOPE"
		   "OPT"
		   "CALLS"
		   "NO"
		   "XDISTR"
		   "YDISTR"
		   "ZDISTR"
		   "TOLERANCE"
		   "STRATEGY"
		   "REPEAT"
		   "BISEC"
		   "COOL"
		   "BALANCE"
		   "RANDOM"
		   "MODEL"
		   "TARGET"
		   "MODE"
		   "MONERROR"
		   "MONON"
		   "MONSCALE"
		   "PLANEX"
		   "COND"
		   "RESOUT"
		   "CLIST"
		   "MLIST"
		   "STATUS"
		   "POST"
		   "FONT"
		   "LWIDTH"
		   "APER_TOL"
		   "APER_OFFSET"
		   "HALOFILE"
		   "PIPEFILE"
		   "DQF"
		   "BETAQFX"
		   "DP"
		   "DPARX"
		   "DPARY"
		   "COR"
		   "BBEAT"
		   "NCO"
		   "HALO"
		   "INTERVAL"
		   "SPEC"
		   "NOTSIMPLE"
		   "TRUEPROFILE"
		   "OFFSETELEM"
		   "XSIZE"
		   "YSIZE"
		   "ASCALE"
		   "LSCALE"
		   "SSCALE"
		   "RSCALE"
		   "DETUNE"
		   "DISTORT1"
		   "DISTORT2"
		   "START_STOP"
		   "MULTIPOLE_ORDER_RANGE"
		   "NOPRINT"
		   "PRINT_ALL"
		   "PRINT_AT_END"
		   "NOSIXTRACK"
		   "X0"
		   "Y0"
		   "Z0"
		   "THETA0"
		   "PHI0"
		   "PSI0"
		   "SUMM"
		   "CENTRE"
		   "SECTOR_NMUL_MAX"
		   "SECTOR_nMUL"
		   "NTPSA"
		   "SYMPRINT"
		   "TIME"
		   "METHOD"
		   "NST"
		   "EXACT"
		   "OFFSET_DELTAP"
		   "ERRORS_OUT"
		   "ERRORS_IN"
		   "MAGNET_NAME"
		   "RESPLIT"
		   "THIN"
		   "XBEND"
		   "EVEN"
		   "OVERWRITE"
		   "INDEX"
		   "ONEPASS"
		   "DUMP"
		   "DEBUGLEVEL"
		   "LEVEL"
		   "BBORBIT"
		   "SYMPL"
		   "MAXACCELERATION"
		   "EXACT_MISS"
		   "TOTALPATH"
		   "RADIATION"
		   "FRINGE"
		   "ICASE"
		   "CLOSED_ORBIT"
		   "SLICE_MAGNETS"
		   "INITIAL_MATRIX_TABLE"
		   "MATRIX_MANUAL"
		   "INITIAL_MAP_MANUAL"
		   "INITIAL"
		   "ELEMENT"
		   "TRUSTRANGE"
		   "ANHX"
		   "ANHY"
		   "GNUF"
		   "HAML"
		   "EIGN"
		   "INITIAL_MATRIX_MANUAL"
		   "ELEMENTNAME"
		   "KN"
		   "KS"
		   "EXACTMATCH"
		   "ONLYPOSITION"
		   "ONLYORIENTATION"
		   "AUTOPLACEDOWNSTREAM"
		   "REFFRAME"
		   "USE_PTCKNOBS"
		   )
		  'words)
     . font-lock-doc-face))
  "Highlighting expressions for MAD-X mode (doc-all).")

(defconst madx-font-lock-function-name-face-all
  ;; madx-font-lock-keywords-functions
  `((,(regexp-opt '(;;  font-lock-function-name-face
		   ;; madx-font-lock-keywords-functions
		   "SQRT"
		   "LOG"
		   "LOG10"
		   "EXP"
		   "SIN"
		   "COS"
		   "TAN"
		   "ASIN"
		   "ACOS"
		   "ATAN"
		   "SINH"
		   "COSH"
		   "TANH"
		   "SINC"
		   "ABS"
		   "ERF"
		   "ERFC"
		   "FLOOR"
		   "CEIL"
		   "ROUND"
		   "RANF"
		   "GAUSS"
		   "TGAUSS"
		   "FLAT5"
		   "FLAT56"
		   )
		  'words)
     . font-lock-function-name-face))
  "Highlighting expressions for MAD-X mode (name-all)." )

(defconst madx-font-lock-variable-name-face-all
  ;; madx-font-lock-keywords-variables_madx
  `((,(concat (regexp-opt '(;; font-lock-variable-name-face
			    ;; madx-font-lock-keywords-variables_madx
			    "mvar1"
			    "mvar2"
			    "mvar3"
			    "mvar4"
			    "CIRC"
			    "FREQ0"
			    "DTBYDS"
			    "U0"
			    "QS"
			    "ARAD"
			    "PDAMP"
			    "N1MIN"
			    "Z"
			    "PHI"
			    "PSI"
			    "X"
			    "Y"
			    "BETX"
			    "BETY"
			    "NAME"
			    "S"
			    "k0l"
			    "k1l"
			    "k2l"
			    "k3l"
			    "k4l"
			    "K1"
			    "K2"
			    "K3"
			    "K4"
			    "K5"
			    "K6"
			    "K1L"
			    "K2L"
			    "K3L"
			    "K4L"
			    "K5L"
			    "K6L"       
			    "KICK1"
			    "KICK2"
			    "KICK3"
			    "KICK4"
			    "KICK5"
			    "KICK6"
			    "MU1"
			    "MU2"
			    "MU3"
			    "MUX"
			    "MUY"
			    "PX"
			    "PY"
			    "PT"
			    "DELTAP"
			    "XN"
			    "PXN"
			    "WX"
			    "PHI"
			    "THETA"
			    "PHIX"
			    "YN"
			    "PYN"
			    "WY"
			    "PHIY"
			    "TN"
			    "PTN"
			    "WT"
			    "PHIT"
			    "ALFX"
			    "DX"
			    "DPX"
			    "ALFY"
			    "DY"
			    "DPY"
			    "ENERGY"
			    "DMUX"
			    "DDX"
			    "DDPX"
			    "DMUY"
			    "DDY"
			    "DDPY"
			    "Q1"
			    "Q2"
			    "DQ1"
			    "DQ2"
			    "DDQ1"
			    "DDQ2"
			    "N1"
			    "N1X_M"
			    "N1Y_M"
			    "APER_1"
			    "APER_2"
			    "APER_3"
			    "APER_4"
			    "RTOL"
			    "XTOL"
			    "YTOL"
			    "ON_AP"
			    "ON_ELEM"
			    "LENGTH"
			    "ORBIT5"
			    "BETXMAX"
			    "DXMAX"
			    "DXRMS"
			    "XCOMAX"
			    "XRMS"
			    "BETYMAX"
			    "DYMAX"
			    "DYRMS"
			    "YCOMAX"
			    "YCORMS"
			    "SYNCH_1"
			    "SYNCH_2"
			    "SYNCH_3"
			    "SYNCH_4"
			    "SYNCH_5"
			    "DISTANCE"
			    "LYAPUNOV"
			    "LOGDIST"
			    "LOGTURNS"
			    "RE"
					;		    "RE11";REPLACE BY RE[1-6][1-6]
			    "T"
					;		    "T111";; REPLACE BY T[1-6][1-6][1-6]
					;		    "TM111";; REPLACE BY TM[1-6][1-6][1-6]
					;		    "BETA11"; REPLACE BY BETA[1-3][1-3]
					;		    "BETA11P"; REPLACE BY BETA[1-3][1-3]P
			    "ALFA"
					;		    "ALFA11"; REPLACE BY ALFA[1-3][1-3]
					;		    "ALFA11P"; REPLACE BY ALFA[1-3][1-3]P
			    "GAMMATR"
			    "GAMAX"
			    "GAMAY"
					;		    "GAMA11"; REPLACE BY GAMA[1-3][1-3]
					;		    "GAMA11P"; REPLACE BY GAMA[1-3][1-3]P
					;		    "GAMMA11"; REPLACE BY GAMA[1-3][1-3]
			    "DISP1"
			    "DISP2"
			    "DISP3"
			    "DISP4"
					;		    "DISP1P1"; REPLACE BY DISP[1-4]P[1-3]
					;		    "EIGN11"; REPLACE BY EIGN[1-6][1-6]
			    "R"
					;		    "R11";; REPLACE BY R[1-6][1-6] AFTER REGEXP-OPT
					;		    "RM11";; REPLACE BY RM[1-6][1-6] AFTER REGEXP-OPT		    
			    )
			  'words)
	      ;; some variables already optimized
	      "\\|\\<RE[1-6][1-6]\\>"
	      "\\|\\<TM?[1-6][1-6][1-6]\\>"
	      "\\|\\<BETA[1-3][1-3]P?\\>"
	      "\\|\\<ALFA[1-3][1-3]P?\\>"
	      "\\|\\<GAMA[1-3][1-3]P?\\>"
	      "\\|\\<DISP[1-4]P[1-3]\\>"
	      "\\|\\<EIGN[1-6][1-6]\\>"
	      "\\|\\<RM?[1-6][1-6]\\>")
     . font-lock-variable-name-face))
  "Highlighting expressions for MAD-X mode (variable-name-all).")

(defconst madx-font-lock-intfp-name-face-all
  ;; madx- fonts for integers and floating point numbers
  (list
   '("\\<\\(\\([0-9]+\\.?[0-9]*\\|\\.[0-9]+\\)\\([eE][+-]?\\([0-9]+\\.?[0-9]*\\|[0-9]*\\.[0-9]+\\)\\)?\\)\\>"
     . font-lock-keyword-face))
  "Highlighting expresssions for MAD-X mode (integers and floats).")

(defconst madx-font-lock-keywords-4
  (append
   madx-font-lock-special_constants
   madx-font-lock-special_operators
   madx-font-lock-keywords-face-all
   madx-font-lock-constant-face-all
   madx-font-lock-function-name-face-all
   madx-font-lock-type-face-all
   madx-font-lock-variable-name-face-all
   madx-font-lock-builtin-face-all
   madx-font-lock-warning-face-all
   madx-font-lock-doc-face-all
   madx-font-lock-intfp-name-face-all)
 "Balls-out highlighting in MAD-X mode.")

(defvar madx-font-lock-keywords madx-font-lock-keywords-4
  "Default highlighting expressions for MAD-X mode.")

(defvar madx-mode-syntax-table
  (let ((madx-mode-syntax-table (make-syntax-table)))
	
  ;; This is added so entity names with underscores and dots can be more easily parsed
  (modify-syntax-entry ?_ "w" madx-mode-syntax-table)
  (modify-syntax-entry ?. "w" madx-mode-syntax-table)
	
  ;;  Comment styles are similar to C++
  (modify-syntax-entry ?/ ". 124 b" madx-mode-syntax-table)
  (modify-syntax-entry ?* ". 23" madx-mode-syntax-table)
  (modify-syntax-entry ?\n "> b" madx-mode-syntax-table)
  (modify-syntax-entry ?! "< b" madx-mode-syntax-table)
  (modify-syntax-entry ?' "|" madx-mode-syntax-table)
     madx-mode-syntax-table)
  "Syntax table for `madx-mode'.")

;;;###autoload
(define-derived-mode madx-mode fundamental-mode "madx"
  "Major mode for editing Methodical Accelerator Design X script files."
  (make-local-variable 'font-lock-defaults)
  (setq font-lock-defaults '(madx-font-lock-keywords nil t))
  ;; Setting up Imenu
  (setq imenu-generic-expression nil)
  (setq imenu-prev-index-position-function nil)
  (setq imenu-extract-index-name-function nil)
  ;;  (imenu-create-index-function)
  ;; Set up search
  (setq case-fold-search t)
  )
;; Enable syntax highlighting
;;;###autoload
(global-font-lock-mode t)
;;;###autoload
(setq font-lock-maximum-decoration t)
;; Highlighting .madx and .seq buffers
;;;###autoload
(setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" . madx-mode))			      
			      auto-mode-alist))
;;;###autoload
(provide 'madx-mode)
;;; madx.el ends here

^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-10-25 22:56 ` Noam Postavsky
@ 2018-10-25 23:18   ` Noam Postavsky
  2018-10-26  6:42     ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Noam Postavsky @ 2018-10-25 23:18 UTC (permalink / raw)
  To: 31289; +Cc: Oscar Blanco

> the copyright assignment that I signed in February.

Hmm, something has gone wrong then, I don't see it listed.  Eli, what's
the procedure for resolving this?

> ;;;###autoload
> (define-derived-mode madx-mode fundamental-mode "madx"
>   "Major mode for editing Methodical Accelerator Design X script files."
>   (make-local-variable 'font-lock-defaults)
>   (setq font-lock-defaults '(madx-font-lock-keywords nil t))

The make-local-variable isn't needed since font-lock-defaults
"Automatically becomes buffer-local when set".

> ;; Enable syntax highlighting
> ;;;###autoload
> (global-font-lock-mode t)
> ;;;###autoload
> (setq font-lock-maximum-decoration t)

These shouldn't go in a library file, they're user preferences (and
already the default anyway).

> ;; Highlighting .madx and .seq buffers
> ;;;###autoload
> (setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" . madx-mode))			      
> 			      auto-mode-alist))

It's better to use add-to-list here, so that loading the file multiple
times won't keep adding entries to auto-mode-alist.  Also, the regex has
some redundant grouping and you should use \\' (end of string) rather
than $ (end of line).

    (add-to-list 'auto-mode-alist '("\\.\\(madx\\|seq\\)\\'" . madx-mode))





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-10-25 23:18   ` Noam Postavsky
@ 2018-10-26  6:42     ` Eli Zaretskii
  2018-10-27  3:27       ` Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2018-10-26  6:42 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 31289, orblancog

> From: Noam Postavsky <npostavs@gmail.com>
> Date: Thu, 25 Oct 2018 19:18:18 -0400
> Cc: Oscar Blanco <orblancog@gmail.com>
> 
> > the copyright assignment that I signed in February.
> 
> Hmm, something has gone wrong then, I don't see it listed.

Indeed.

> Eli, what's the procedure for resolving this?

Ping the FSF clerk.

However, Oscar's assignment process isn't complete yet: the last email
I have on that (from Feb 14) just says he was given the PDF form of
the assignment, which he needed to sign and send back to the FSF.  I
didn't see an announcement that the process is complete, which might
explain why his assignment is not yet on file.

Pinging the clerk is TRT anyway, since Feb 14 is too long ago to be
reasonable.  I'm guessing this fell through the cracks when the-then
copyright clerk stepped down.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-04-27 11:00 bug#31289: madx mode for emacs Oscar Blanco
  2018-06-22  0:50 ` Noam Postavsky
  2018-10-25 22:56 ` Noam Postavsky
@ 2018-10-26 10:41 ` Noam Postavsky
  2018-10-26 10:53   ` Noam Postavsky
  2018-10-27 10:53 ` Noam Postavsky
  2019-09-28 18:13 ` Stefan Kangas
  4 siblings, 1 reply; 15+ messages in thread
From: Noam Postavsky @ 2018-10-26 10:41 UTC (permalink / raw)
  To: 31289; +Cc: Oscar Blanco

[-- Attachment #1: Type: text/plain, Size: 82 bytes --]

[forwarding to list, please use "Reply All" to keep 31289@debbugs.gnu.org on Cc]


[-- Attachment #2: Type: message/rfc822, Size: 27724 bytes --]

From: Oscar Blanco <orblancog@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Subject: Re: bug#31289: madx mode for emacs
Date: Fri, 26 Oct 2018 08:58:06 +0200
Message-ID: <CAEUbmsryWOLDeGVgE8OzDB5=KLixtjSq3V_BMfbPY0brsSfuSA@mail.gmail.com>

--=====-=-=
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=====-=-="

--======-=-=
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

Dear Noam, I attached again the file madx.el.
With respect to the licence, I have to look back on my mails to check if I
have any other document apart from the one I sent yesterday.

Il giorno ven 26 ott 2018 alle ore 01:18 Noam Postavsky <npostavs@gmail.com>
ha scritto:

> > the copyright assignment that I signed in February.
>
> Hmm, something has gone wrong then, I don't see it listed.  Eli, what's
> the procedure for resolving this?
>
> > ;;;###autoload
> > (define-derived-mode madx-mode fundamental-mode "madx"
> >   "Major mode for editing Methodical Accelerator Design X script files."
> >   (make-local-variable 'font-lock-defaults)
> >   (setq font-lock-defaults '(madx-font-lock-keywords nil t))
>
> The make-local-variable isn't needed since font-lock-defaults
> "Automatically becomes buffer-local when set".
>
> > ;; Enable syntax highlighting
> > ;;;###autoload
> > (global-font-lock-mode t)
> > ;;;###autoload
> > (setq font-lock-maximum-decoration t)
>
> These shouldn't go in a library file, they're user preferences (and
> already the default anyway).
>
> > ;; Highlighting .madx and .seq buffers
> > ;;;###autoload
> > (setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" .
> madx-mode))
> >                             auto-mode-alist))
>
> It's better to use add-to-list here, so that loading the file multiple
> times won't keep adding entries to auto-mode-alist.  Also, the regex has
> some redundant grouping and you should use \\' (end of string) rather
> than $ (end of line).
>
>     (add-to-list 'auto-mode-alist '("\\.\\(madx\\|seq\\)\\'" . madx-mode))
>


-- 
Oscar BLANCO

--======-=-=
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Dear Noam, I attached again the file madx.el.<div>With res=
pect to the licence, I have to look back on my mails to check if I have any=
 other document apart from the one I sent yesterday.</div></div><br><div cl=
ass=3D"gmail_quote"><div dir=3D"ltr">Il giorno ven 26 ott 2018 alle ore 01:=
18 Noam Postavsky &lt;<a href=3D"mailto:npostavs@gmail.com">npostavs@gmail.=
com</a>&gt; ha scritto:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&gt; the co=
pyright assignment that I signed in February.<br>
<br>
Hmm, something has gone wrong then, I don&#39;t see it listed.=C2=A0 Eli, w=
hat&#39;s<br>
the procedure for resolving this?<br>
<br>
&gt; ;;;###autoload<br>
&gt; (define-derived-mode madx-mode fundamental-mode &quot;madx&quot;<br>
&gt;=C2=A0 =C2=A0&quot;Major mode for editing Methodical Accelerator Design=
 X script files.&quot;<br>
&gt;=C2=A0 =C2=A0(make-local-variable &#39;font-lock-defaults)<br>
&gt;=C2=A0 =C2=A0(setq font-lock-defaults &#39;(madx-font-lock-keywords nil=
 t))<br>
<br>
The make-local-variable isn&#39;t needed since font-lock-defaults<br>
&quot;Automatically becomes buffer-local when set&quot;.<br>
<br>
&gt; ;; Enable syntax highlighting<br>
&gt; ;;;###autoload<br>
&gt; (global-font-lock-mode t)<br>
&gt; ;;;###autoload<br>
&gt; (setq font-lock-maximum-decoration t)<br>
<br>
These shouldn&#39;t go in a library file, they&#39;re user preferences (and=
<br>
already the default anyway).<br>
<br>
&gt; ;; Highlighting .madx and .seq buffers<br>
&gt; ;;;###autoload<br>
&gt; (setq auto-mode-alist (append &#39;((&quot;\\.\\(\\(madx\\)\\|\\(seq\\=
)\\)$&quot; . madx-mode))=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0auto-mode-alist))<br>
<br>
It&#39;s better to use add-to-list here, so that loading the file multiple<=
br>
times won&#39;t keep adding entries to auto-mode-alist.=C2=A0 Also, the reg=
ex has<br>
some redundant grouping and you should use \\&#39; (end of string) rather<b=
r>
than $ (end of line).<br>
<br>
=C2=A0 =C2=A0 (add-to-list &#39;auto-mode-alist &#39;(&quot;\\.\\(madx\\|se=
q\\)\\&#39;&quot; . madx-mode))<br>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"l=
tr">Oscar BLANCO<div><br><br></div></div></div>

--======-=-=--

--=====-=-=
Content-Type: text/x-emacs-lisp; name=madx.el
Content-ID: <f_jnpnxkn50>
Content-Disposition: attachment; filename=madx.el

;;; madx.el --- Major mode for editing MAD-X files in Emacs

;; Copyright (C) 2013, 2016 Oscar BLANCO
;;               2017, 2018 FSF

;; Author     : orblancog <orblancog@gmail.com>
;; Maintainer : orblancog
;; Created    : 18 Nov 2017
;; Keywords   : languages
;; Homepage   : https://github.com/orblancog/mad-x_syntax
;; Version    : 1.8

;; This file is not part of GNU Emacs

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;; FEATURES in version 1.8
;; * Highlights commands, parameters and special operators in MAD-X 5
;; * If the file extension is '.madx' or '.seq' then the buffer is automatically
;;   highlighted, but any buffer can be highlighted by doing :
;;       `M+X madx-mode` RET
;;   where `M` is the **META** character in Emacs (`M` seems to be **ALT** in Linux)
;;   and RET means press RETURN key
;; * If the limit of 80 characters is desired, they could be highlighted differently
;;   by uncomment the line
;;       ;(require 'whitespace)
;;       ;(setq whitespace-line-column 80) ;; limit line length
;;       ;(setq whitespace-style '(face lines-tail))
;;       ;(add-hook 'madx-mode-hook 'whitespace-mode)
;;   in this (madx.el) file.
;; HOW TO INSTALL IT
;; a) Open this file in emacs and execute
;;      `M+X package-install-file` RET `madx.el` RET
;; b)
;; 1. Copy this file (madx.el) to the highlighting definition folder, e.g.
;;      a)  ~/.emacs.d/lisp/  ---> (Emacs v24.5.X or v25)
;;      b)  ~/.emacs.d/       ---> (Emacs v23.X.X)
;;      c)  ~/                ---> (Emacs v21.X.X)
;;    i.e.
;;      $ cp madx.el ~/.emacs.d/lisp/
;; 2. Edit or create your .emacs file, typically in ~/
;;      adding the following block where the load-path must match point 1.
;;      ;;;; START OF BLOCK TO COPY AND UNCOMMENT
;;      (global-font-lock-mode t);; Enable syntax highlighting
;;      (setq font-lock-maximum-decoration t)
;;      (add-to-list 'load-path "~/.emacs.d");; <--- edit according to 1.
;;      (autoload 'madx-mode "madx" "MADX-mode" t)
;;      (setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" . madx-mode))
;;        auto-mode-alist))
;;      ;;;; END OF BLOCK TO COPY AND UNCOMMENT
;; You should now restart EMACS in order to reload the environment variables.
;; INFO
;; * For mad instructions, visit
;;   mad.web.cern.ch/mad/
;; * Other syntax highlightings could be found inside the
;;   mad sources.  Check the 'syntax' folder in the madx dir !
;;   Write me to the email address above about any bug including an example.

;;; History:
;; v 1.0 First release at CERN. File is also available in the
;;       MAD-X sources "syntax" folder.
;; v 1.1 Adding comments and changing some verbosed names
;; v 1.2 email update oscar.roberto.blanco.garcia@cern.ch deprecated
;;       Adding some variables from MAD-X 5.02.10 manual
;;       Cleaning up faces 8D
;;       when exceeding 80 chars->extra chars in red
;; v 1.3 adding color to numbers and ;
;; v 1.4 Changes to put this file in the emacs elpa repository
;;       Changing email address to orblancog@gmail.com
;; v 1.5 Changing licence
;; v 1.6 Adding automatic syntax highlighting for ".seq"
;; v 1.7 Chaging licence to gpl3 and code-checking following GNU ELPA suggestions
;; v 1.8 Code changes following GNU suggestions
;;       Adding comments about package-install-file

;;; Code:
(defgroup madx nil
  "Major mode to edit MAD-X files in emacs."
  :group 'languages)

(defvar madx-mode-hook nil
  "Hook for madx-model initialize nil.")

;;;; add  80 characters line
;;;; (global-whitespace-mode +1)
;(require 'whitespace)
;(setq whitespace-line-column 80) ;; limit line length
;(setq whitespace-style '(face lines-tail))
;(add-hook 'madx-mode-hook 'whitespace-mode)

(defconst madx-font-lock-keywords-face-all
  ;; madx-font-lock-keywords-programflow
  `((,(regexp-opt '(;; font-lock-keyword-face
		    ;; madx-font-lock-keywords-programflow
		   "IF"
		   "ELSEIF"
		   "ELSE"
		   "WHILE"
		   "MACRO"
		   )
		  'words)
     .  font-lock-keyword-face))
  "Highlighting expressions for MAD-X mode (keywords-all).")

(defconst madx-font-lock-builtin-face-all
  ;; madx-font-lock-keywords-tableaccs
  ;; madx-font-lock-keywords-simul
  ;; madx-font-lock-keywords-controlstm
  ;; madx-font-lock-keywords-filehandstm
  ;; madx-font-lock-keywords-tablehandstm
  ;; madx-font-lock-keywords-beamhandstm
  ;; madx-font-lock-keywords-seqediting
  ;; madx-font-lock-keywords-othrcmds
  ;; madx-font-lock-keywords-matchingmet
  ;; madx-font-lock-keywords-orbit_corr
  ;; madx-font-lock-keywords-plot
  ;; madx-font-lock-keywords-stringatt
  `((,(regexp-opt '(;; font-lock-builtin-face
		   ;;  madx-font-lock-keywords-tableaccs
		   "TABLE"
		   "TABINDEX"
		   "TABSTRING"
		   ;; madx-font-lock-keywords-simul
		   "TWISS"
		   "IBS"
		   "LINE"
		   "MAKETHIN"
		   "APERTURE"
		   "SIXTRACK"
		   "DYNAP"
		   "EMIT"
		   "MATCH"
		   "ENDMATCH"
		   "VARY"
		   "CONSTRAINT"
		   "WEIGHT"
		   "GLOBAL"
		   "GWEIGHT"
		   "PTC_TWISS"
		   "PTC_PRINTPARAMETRIC"
		   "PTC_NORMAL"
		   "SELECT_PTC_NORMAL"
		   "PTC_TRACK"
		   "PTC_TRACK_LINE"
		   "PTC_CREATE_UNIVERSE"
		   "PTC_CREATE_LAYOUT"
		   "PTC_READ_ERRORS"
		   "PTC_MOVE_TO_LAYOUT"
		   "PTC_ALIGN"
		   "PTC_END"
		   "PTC_TRACK_END"
		   "START"
		   "RUN"
		   "PTC_OBSERVE"
		   "OBSERVE"
		   "PTC_START"
		   "PTC_SETSWITCH"
		   "PTC_KNOB"
		   "PTC_SETKNOBVALUE"
		   "MATCH WITHPTCKNOBS"
		   "PTC_PRINTFRAMES"
		   "PTC_SELECT"
		   "PTC_SELECT_MOMENT"
		   "PTC_DUMPMAPS"
		   "PTC_EPLACEMENT"
		   "PTC_VARYKNOB"
		   "END_MATCH"
		   "PTC_MOMENTS"
		   "PTC_SETCAVITIES"
		   "PTC_SETDEBUGLEVEL"
		   "PTC_SETACCEL_METHOD"
		   "PTC_SETEXACTMIS"
		   "PTC_SETRADIATION"
		   "PTC_SETTOTALPATH"
		   "PTC_SETTIME"
		   "PTC_SETFRINGE"
		   ;; madx-font-lock-keywords-controlstm              
		   "EXIT"
		   "QUIT"
		   "STOP"
		   "HELP"
		   "SHOW"
		   "VALUE"
		   "OPTION"
		   "EXEC"
		   "SET"
		   "SYSTEM"
		   "TITLE"
		   "USE"
		   "SELECT"
		   ;;  madx-font-lock-keywords-filehandstm
		   "ASSIGN"
		   "CALL"
		   "RETURN"
		   "PRINT"
		   "PRINTF"
		   "RENAMEFILE"
		   "COPYFILE"
		   "REMOVEFILE"
		   ;;  madx-font-lock-keywords-tablehandstm
		   "CREATE"
		   "DELETE"
		   "READTABLE"
		   "READMYTABLE"
		   "WRITE"
		   "SETVARS"
		   "SETVARS_LIN"
		   "FILL"
		   "SHRINK"
		   ;;  madx-font-lock-keywords-beamhandstm
		   "BEAM"
		   "RESBEAM"
		   ;; madx-font-lock-keywords-seqediting
		   "SEQEDIT"
		   "FLATTEN"
		   "CYCLE"
		   "REFLECT"
		   "INSTALL"
		   "MOVE"
		   "REMOVE"
		   "REPLACE"
		   "EXTRACT"
		   "ENDEDIT"
		   "SAVE"        
		   "DUMPSEQU"
		   ;; madx-font-lock-keywords-othrcmds
		   "SAVEBETA"
		   "COGUESS"
		   "CONST"
		   "EOPTION"
		   "ESAVE"
		   "REAL"
		   ;; madx-font-lock-keywords-matchingmet
		   "LMDIF"
		   "MIGRAD"
		   "SIMPLEX"
		   "JACOBIAN"
		   "USE_MACRO"
		   ;; madx-font-lock-keywords-orbit_corr
		   "CORRECT"
		   "USEMONITOR"
		   "USEKICK"
		   "CSAVE"
		   "SETCORR"
		   "COPTION"
		   "SODD"
		   "SURVEY"
		   "SXFREAD"
		   "SXFWRITE"
		   "TOUSCHEK"
		   "TRACK"
		   "ENDTRACK"
		   ;; madx-font-lock-keywords-plot
		   "PLOT"
		   "RPLOT"
		   "RVIEWER"
		   "RTRACKSTORE"
		   "RESPLOT"
		   "SETPLOT"
		   "EPRINT"
		   ;; madx-font-lock-keywords-stringatt
		   "TITLE"
		   "system"
		   )
		  'words)
     . font-lock-builtin-face))
  "Highlighting expressions for MAD-X mode (builtin-all).")

(defconst madx-font-lock-type-face-all
  ;; madx-font-lock-keywords-elements
  `((,(regexp-opt '(; font-lock-type-face
		   ;; madx-font-lock-keywords-elements
		   "DRIFT"
		   "QUADRUPOLE"
		   "SEXTUPOLE"
		   "OCTUPOLE"
		   "SOLENOID"
		   "CRABCAVITY"
		   "RFCAVITY"
		   "DIPEDGE"
		   "MULTIPOLE"
		   "COLLIMATOR"
		   "ECOLLIMATOR"
		   "RCOLLIMATOR"
		   "YROTATION"
		   "SROTATION"
		   "TRANSLATION"
		   "CHANGEREF"
		   "MARKER"
		   "RBEND"
		   "SBEND"
		   "DIPEDGE"
		   "HKICKER"
		   "VKICKER"
		   "KICKER"
		   "TKICKER"
		   "ELSEPARATOR"
		   "HMONITOR"
		   "VMONITOR"
		   "MONITOR"
		   "INSTRUMENT"
		   "PLACEHOLDER"
		   "BEAMBEAM"
		   "MATRIX"
		   "NLLENS"
		   "RFMULTIPOLE"
		   "ELSEPARATOR"
		   )
		  'words)
     . font-lock-type-face))
  "Highlighting expressions for MAD-X mode (type-all).")

(defconst madx-font-lock-warning-face-all
  ;; madx-font-lock-keywords-errordef
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-keywords-errordef
		   "ERROR"
		   "EALIGN"
		   "EFCOMP"
		   "SETERR"
		   )
		  'words)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (warning-all).")

(defconst madx-font-lock-special_operators
  ;; madx-font-lock-special_operators
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-special_operators
		   ":="
		   "->"
		   )
		  t)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (special-operators).")

(defconst madx-font-lock-constant-face-all
  ;; madx-font-lock-keywords-constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-keywords-constants
		   "POSITRON"
		   "ELECTRON"
		   "PROTON"
		   "ANTIPROTON"
		   "POSMUON"
		   "NEGMUON"
		   "ION"
		   "PI"
		   "TWOPI"
		   "DEGRAD"
		   "RADDEG"
		   "E"
		   "EMASS"
		   "PMASS"
		   "NMASS"
		   "MUMASS"
		   "CLIGHT"
		   "QELECT"
		   "HBAR"
		   "ERAD"
		   "PRAD"
		   "TRUE"
		   "FALSE"
		   "SIMPLE"
		   "COLLIM"
		   "TEAPOT"
		   "HYBRID"
		   "ENTRY"
		   "CENTRE"
		   "EXIT"
		   "CIRCLE"
		   "RECTANGLE"
		   "ELLIPSE"
		   "LHCSCREEN"
		   "MARGUERITE"
		   "RECTELLIPSE"
		   "RACETRACK"
		   "OCTAGON"
		   "TERMINAL"
		   )
		  'words)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (constant-all).")

(defconst madx-font-lock-special_constants
  ;; madx-font-lock-special_constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-special_constants
		   "#e"
		   "#s"
		   )
		  t)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (special_constants).")

(defconst madx-font-lock-doc-face-all
  ;; madx-font-lock-keywords-parameters
  `((,(regexp-opt '(;; font-lock-doc-face
		   ;; madx-font-lock-keywords-parameters
		   "NOEXPR" ;2016.08
		   "KNLL" ;2016.08
		   "CNLL" ;2016.08
		   "ROOTMACRO"
		   "MOMENT_S"
		   "MOMENT"
		   "SURVEYALL"
		   "DELTA_DEPENDENCY"
		   "IGNORE_MAP_ORBIT"
		   "RING_PARAMETERS"
		   "CENTER_MAGNETS"
		   "SUMMARY_FILE"
		   "SUMMARY_TABLE"
		   "MAPTABLE"
		   "DELS"
		   "TXI"
		   "TYI"
		   "TLI"
		   "UPDATE"
		   "NCORR"
		   "SNGVAL"
		   "SNGCUT"
		   "CORRLIM"
		   "TWORING"
		   "UNITS"
		   "CORZERO"
		   "BEAM1TAB"
		   "BEAM2TAB"
		   "EXTERN"
		   "NAME_COL"
		   "X_COL"
		   "Y_COL"
		   "TWISSUM"
		   "LSQ"
		   "MICADO"
		   "SVD"
		   "THICK"
		   "VECTOR"
		   "expr"
		   "VLENGTH"
		   "SLOW"
		   "PATCH_ANG"
		   "PATCH_TRANS"
		   "ADD_ANGLE"
		   "ADD_PASS"
		   "NEXT_SEQU"
		   "ZERO_SUPPR"
		   "N_BESSEL"
		   "RIPKEN"
		   "NO_CAVITY_TOTALPATH"
		   "PNL"
		   "PSL"
		   "MAKEDIPEDGE"
		   "TRUNCATE"
		   "APPEND"
		   "ROW1"
		   "ROW1"
		   "PARAM"
		   "SINKICK"
		   "SINPEAK"
		   "SINTUNE"
		   "SINPHASE"
		   "L"
		   "K1"
		   "K1S"
		   "TILT"
		   "K2"
		   "K2S"
		   "K3"
		   "K3S"
		   "KS"
		   "K3S"
		   "KSI"
		   "VOLT"
		   "LAG"
		   "FREQ"
		   "HARMON"
		   "rv1"
		   "rv2"
		   "rv3"
		   "rv4"
		   "rph1"
		   "rph2"
		   "lagf"
		   "PARTICLE"
		   "MASS"
		   "CHARGE"
		   "ENERGY"
		   "PC"
		   "GAMMA"
		   "BETA"
		   "BRHO"
		   "EX"
		   "EXN"
		   "EY"
		   "EYN"
		   "ET"
		   "SIGT"
		   "SIGE"
		   "KBUNCH"
		   "NPART"
		   "PLANE"
		   "BCURRENT"
		   "CURRENT"
		   "BUNCHED"
		   "RADIATE"
		   "NORM_NO"
		   "BV"
		   "SEQUENCE"
		   "ENDSEQUENCE"
		   "REFER"
		   "MAD8"
		   "GNFU"
		   "KICK"
		   "HKICK"
		   "VKICK"
		   "ANGLE"
		   "K0"
		   "K0S"
		   "RESPLIT"
		   "DAMP"
		   "QUANTUM"
		   "RECLOSS"
		   "ELEMENT_BY_ELEMENT"
		   "NORM"
		   "NORM_OUT"
		   "RADIATION_MODEL1"
		   "RADIATION_ENERGY_LOSS"
		   "RADIATION_QUADr"
		   "BEAM_ENVELOPE"
		   "SPACE_CHARGE"
		   "FX"
		   "FY"
		   "FT"
		   "FFILE"
		   "E1"
		   "E2"
		   "FINT"
		   "FINTX"
		   "HGAP"
		   "H1"
		   "H2"
		   "FLAG"
		   "RANGE"
		   "PLACE"
		   "PARENT"
		   "KEYWORD"
		   "FROM"
		   "AT"
		   "REFPOS"
		   "LENGTH"
		   "EXACT_MIS"
		   "CLASS"
		   "PATTERN"
		   "FILE"
		   "FORMAT"
		   "RBARC"
		   "TWISS_PRINT"
		   "THREADER"
		   "THIN_FOC"
		   "NO_FATAL_STOP"
		   "TEXT"
		   "BARE"
		   "SLICE"
		   "THICK"
		   "COMMAND"
		   "TO"
		   "NEWNAME"
		   "BY"
		   "SELECTED"
		   "H"
		   "LRAD"
		   "KNL"
		   "KSL"
		   "TYPE"
		   "SIGX"
		   "SIGY"
		   "XMA"
		   "YMA"
		   "BBSHAPE"
		   "WIDTH"
		   "BBDIR"
		   "ECHO"
		   "ECHOMACRO"
		   "TRACE"
		   "VERIFY"
		   "PERIOD"
		   "SECTORMAP"
		   "SECTORFILE"
		   "KEEPORBIT"
		   "USEORBIT"
		   "COUPLE"
		   "FULL"
		   "COLUMN"
		   "MOMENTS"
		   "PARAMETRIC"
		   "CLEAR"
		   "POS"
		   "POLYNOMIAL"
		   "MONOMIAL"
		   "PARAMETRIC"
		   "QUANTITY"
		   "ROW"
		   "SEED"
		   "ADD"
		   "INFO"
		   "DEBUG"
		   "VERBOSE"
		   "TELL"
		   "RESET"
		   "WARN"
		   "LABEL"
		   "APERTYPE"
		   "HAXIS"
		   "HMIN"
		   "HMAX"
		   "VAXIS"
		   "VAXIS1"
		   "VAXIS2"
		   "VAXIS3"
		   "VAXIS4"
		   "VMIN"
		   "VMAX"
		   "BARS"
		   "SYMBOL"
		   "NOVERSION"
		   "NO_FATAL_ERROR"
		   "NO_FATAL_STOP"
		   "INTERPOLATE"
		   "NOLINE"
		   "NOTITLE"
		   "MARKER_PLOT"
		   "RANGE_PLOT"
		   "MULTIPLE"
		   "PTC"
		   "PTC_TABLE"
		   "TRACKFILE"
		   "CAVALL"
		   "MULT_AUTO_OFF"
		   "MAX_MULT_ORD"
		   "SPLIT"
		   "RADIUS"
		   "WARNING"
		   "STYLE"
		   "COLOUR"
		   "TURNS"
		   "EVERYSTEP"
		   "ONETABLE"
		   "TABLEALLSTEPS"
		   "GCS"
		   "ROOTNTUPLE"
		   "EXTENSION"
		   "FASTUNE"
		   "MAXAPER"
		   "LYAPUNOV"
		   "ORBIT"
		   "TOL"
		   "DS"
		   "DPHI"
		   "DTHETA"
		   "DPSI"
		   "MREX"
		   "MREY"
		   "MSCALX"
		   "MSCALY"
		   "AREX"
		   "AREY"
		   "ORDER"
		   "DKN"
		   "DKS"
		   "DKNR"
		   "DKSR"
		   "HYSTER"
		   "HCOEFFN"
		   "HCOEFFS"
		   "BETA0"
		   "RMATRIX"
		   "STEP"
		   "CHROM"
		   "LOWER"
		   "UPPER"
		   "SLOPE"
		   "OPT"
		   "CALLS"
		   "NO"
		   "XDISTR"
		   "YDISTR"
		   "ZDISTR"
		   "TOLERANCE"
		   "STRATEGY"
		   "REPEAT"
		   "BISEC"
		   "COOL"
		   "BALANCE"
		   "RANDOM"
		   "MODEL"
		   "TARGET"
		   "MODE"
		   "MONERROR"
		   "MONON"
		   "MONSCALE"
		   "PLANEX"
		   "COND"
		   "RESOUT"
		   "CLIST"
		   "MLIST"
		   "STATUS"
		   "POST"
		   "FONT"
		   "LWIDTH"
		   "APER_TOL"
		   "APER_OFFSET"
		   "HALOFILE"
		   "PIPEFILE"
		   "DQF"
		   "BETAQFX"
		   "DP"
		   "DPARX"
		   "DPARY"
		   "COR"
		   "BBEAT"
		   "NCO"
		   "HALO"
		   "INTERVAL"
		   "SPEC"
		   "NOTSIMPLE"
		   "TRUEPROFILE"
		   "OFFSETELEM"
		   "XSIZE"
		   "YSIZE"
		   "ASCALE"
		   "LSCALE"
		   "SSCALE"
		   "RSCALE"
		   "DETUNE"
		   "DISTORT1"
		   "DISTORT2"
		   "START_STOP"
		   "MULTIPOLE_ORDER_RANGE"
		   "NOPRINT"
		   "PRINT_ALL"
		   "PRINT_AT_END"
		   "NOSIXTRACK"
		   "X0"
		   "Y0"
		   "Z0"
		   "THETA0"
		   "PHI0"
		   "PSI0"
		   "SUMM"
		   "CENTRE"
		   "SECTOR_NMUL_MAX"
		   "SECTOR_nMUL"
		   "NTPSA"
		   "SYMPRINT"
		   "TIME"
		   "METHOD"
		   "NST"
		   "EXACT"
		   "OFFSET_DELTAP"
		   "ERRORS_OUT"
		   "ERRORS_IN"
		   "MAGNET_NAME"
		   "RESPLIT"
		   "THIN"
		   "XBEND"
		   "EVEN"
		   "OVERWRITE"
		   "INDEX"
		   "ONEPASS"
		   "DUMP"
		   "DEBUGLEVEL"
		   "LEVEL"
		   "BBORBIT"
		   "SYMPL"
		   "MAXACCELERATION"
		   "EXACT_MISS"
		   "TOTALPATH"
		   "RADIATION"
		   "FRINGE"
		   "ICASE"
		   "CLOSED_ORBIT"
		   "SLICE_MAGNETS"
		   "INITIAL_MATRIX_TABLE"
		   "MATRIX_MANUAL"
		   "INITIAL_MAP_MANUAL"
		   "INITIAL"
		   "ELEMENT"
		   "TRUSTRANGE"
		   "ANHX"
		   "ANHY"
		   "GNUF"
		   "HAML"
		   "EIGN"
		   "INITIAL_MATRIX_MANUAL"
		   "ELEMENTNAME"
		   "KN"
		   "KS"
		   "EXACTMATCH"
		   "ONLYPOSITION"
		   "ONLYORIENTATION"
		   "AUTOPLACEDOWNSTREAM"
		   "REFFRAME"
		   "USE_PTCKNOBS"
		   )
		  'words)
     . font-lock-doc-face))
  "Highlighting expressions for MAD-X mode (doc-all).")

(defconst madx-font-lock-function-name-face-all
  ;; madx-font-lock-keywords-functions
  `((,(regexp-opt '(;;  font-lock-function-name-face
		   ;; madx-font-lock-keywords-functions
		   "SQRT"
		   "LOG"
		   "LOG10"
		   "EXP"
		   "SIN"
		   "COS"
		   "TAN"
		   "ASIN"
		   "ACOS"
		   "ATAN"
		   "SINH"
		   "COSH"
		   "TANH"
		   "SINC"
		   "ABS"
		   "ERF"
		   "ERFC"
		   "FLOOR"
		   "CEIL"
		   "ROUND"
		   "RANF"
		   "GAUSS"
		   "TGAUSS"
		   "FLAT5"
		   "FLAT56"
		   )
		  'words)
     . font-lock-function-name-face))
  "Highlighting expressions for MAD-X mode (name-all)." )

(defconst madx-font-lock-variable-name-face-all
  ;; madx-font-lock-keywords-variables_madx
  `((,(concat (regexp-opt '(;; font-lock-variable-name-face
			    ;; madx-font-lock-keywords-variables_madx
			    "mvar1"
			    "mvar2"
			    "mvar3"
			    "mvar4"
			    "CIRC"
			    "FREQ0"
			    "DTBYDS"
			    "U0"
			    "QS"
			    "ARAD"
			    "PDAMP"
			    "N1MIN"
			    "Z"
			    "PHI"
			    "PSI"
			    "X"
			    "Y"
			    "BETX"
			    "BETY"
			    "NAME"
			    "S"
			    "k0l"
			    "k1l"
			    "k2l"
			    "k3l"
			    "k4l"
			    "K1"
			    "K2"
			    "K3"
			    "K4"
			    "K5"
			    "K6"
			    "K1L"
			    "K2L"
			    "K3L"
			    "K4L"
			    "K5L"
			    "K6L"       
			    "KICK1"
			    "KICK2"
			    "KICK3"
			    "KICK4"
			    "KICK5"
			    "KICK6"
			    "MU1"
			    "MU2"
			    "MU3"
			    "MUX"
			    "MUY"
			    "PX"
			    "PY"
			    "PT"
			    "DELTAP"
			    "XN"
			    "PXN"
			    "WX"
			    "PHI"
			    "THETA"
			    "PHIX"
			    "YN"
			    "PYN"
			    "WY"
			    "PHIY"
			    "TN"
			    "PTN"
			    "WT"
			    "PHIT"
			    "ALFX"
			    "DX"
			    "DPX"
			    "ALFY"
			    "DY"
			    "DPY"
			    "ENERGY"
			    "DMUX"
			    "DDX"
			    "DDPX"
			    "DMUY"
			    "DDY"
			    "DDPY"
			    "Q1"
			    "Q2"
			    "DQ1"
			    "DQ2"
			    "DDQ1"
			    "DDQ2"
			    "N1"
			    "N1X_M"
			    "N1Y_M"
			    "APER_1"
			    "APER_2"
			    "APER_3"
			    "APER_4"
			    "RTOL"
			    "XTOL"
			    "YTOL"
			    "ON_AP"
			    "ON_ELEM"
			    "LENGTH"
			    "ORBIT5"
			    "BETXMAX"
			    "DXMAX"
			    "DXRMS"
			    "XCOMAX"
			    "XRMS"
			    "BETYMAX"
			    "DYMAX"
			    "DYRMS"
			    "YCOMAX"
			    "YCORMS"
			    "SYNCH_1"
			    "SYNCH_2"
			    "SYNCH_3"
			    "SYNCH_4"
			    "SYNCH_5"
			    "DISTANCE"
			    "LYAPUNOV"
			    "LOGDIST"
			    "LOGTURNS"
			    "RE"
					;		    "RE11";REPLACE BY RE[1-6][1-6]
			    "T"
					;		    "T111";; REPLACE BY T[1-6][1-6][1-6]
					;		    "TM111";; REPLACE BY TM[1-6][1-6][1-6]
					;		    "BETA11"; REPLACE BY BETA[1-3][1-3]
					;		    "BETA11P"; REPLACE BY BETA[1-3][1-3]P
			    "ALFA"
					;		    "ALFA11"; REPLACE BY ALFA[1-3][1-3]
					;		    "ALFA11P"; REPLACE BY ALFA[1-3][1-3]P
			    "GAMMATR"
			    "GAMAX"
			    "GAMAY"
					;		    "GAMA11"; REPLACE BY GAMA[1-3][1-3]
					;		    "GAMA11P"; REPLACE BY GAMA[1-3][1-3]P
					;		    "GAMMA11"; REPLACE BY GAMA[1-3][1-3]
			    "DISP1"
			    "DISP2"
			    "DISP3"
			    "DISP4"
					;		    "DISP1P1"; REPLACE BY DISP[1-4]P[1-3]
					;		    "EIGN11"; REPLACE BY EIGN[1-6][1-6]
			    "R"
					;		    "R11";; REPLACE BY R[1-6][1-6] AFTER REGEXP-OPT
					;		    "RM11";; REPLACE BY RM[1-6][1-6] AFTER REGEXP-OPT		    
			    )
			  'words)
	      ;; some variables already optimized
	      "\\|\\<RE[1-6][1-6]\\>"
	      "\\|\\<TM?[1-6][1-6][1-6]\\>"
	      "\\|\\<BETA[1-3][1-3]P?\\>"
	      "\\|\\<ALFA[1-3][1-3]P?\\>"
	      "\\|\\<GAMA[1-3][1-3]P?\\>"
	      "\\|\\<DISP[1-4]P[1-3]\\>"
	      "\\|\\<EIGN[1-6][1-6]\\>"
	      "\\|\\<RM?[1-6][1-6]\\>")
     . font-lock-variable-name-face))
  "Highlighting expressions for MAD-X mode (variable-name-all).")

(defconst madx-font-lock-intfp-name-face-all
  ;; madx- fonts for integers and floating point numbers
  (list
   '("\\<\\(\\([0-9]+\\.?[0-9]*\\|\\.[0-9]+\\)\\([eE][+-]?\\([0-9]+\\.?[0-9]*\\|[0-9]*\\.[0-9]+\\)\\)?\\)\\>"
     . font-lock-keyword-face))
  "Highlighting expresssions for MAD-X mode (integers and floats).")

(defconst madx-font-lock-keywords-4
  (append
   madx-font-lock-special_constants
   madx-font-lock-special_operators
   madx-font-lock-keywords-face-all
   madx-font-lock-constant-face-all
   madx-font-lock-function-name-face-all
   madx-font-lock-type-face-all
   madx-font-lock-variable-name-face-all
   madx-font-lock-builtin-face-all
   madx-font-lock-warning-face-all
   madx-font-lock-doc-face-all
   madx-font-lock-intfp-name-face-all)
 "Balls-out highlighting in MAD-X mode.")

(defvar madx-font-lock-keywords madx-font-lock-keywords-4
  "Default highlighting expressions for MAD-X mode.")

(defvar madx-mode-syntax-table
  (let ((madx-mode-syntax-table (make-syntax-table)))
	
  ;; This is added so entity names with underscores and dots can be more easily parsed
  (modify-syntax-entry ?_ "w" madx-mode-syntax-table)
  (modify-syntax-entry ?. "w" madx-mode-syntax-table)
	
  ;;  Comment styles are similar to C++
  (modify-syntax-entry ?/ ". 124 b" madx-mode-syntax-table)
  (modify-syntax-entry ?* ". 23" madx-mode-syntax-table)
  (modify-syntax-entry ?\n "> b" madx-mode-syntax-table)
  (modify-syntax-entry ?! "< b" madx-mode-syntax-table)
  (modify-syntax-entry ?' "|" madx-mode-syntax-table)
     madx-mode-syntax-table)
  "Syntax table for `madx-mode'.")

;;;###autoload
(define-derived-mode madx-mode fundamental-mode "madx"
  "Major mode for editing Methodical Accelerator Design X script files."
  (setq font-lock-defaults '(madx-font-lock-keywords nil t))
  ;; Setting up Imenu
  (setq imenu-generic-expression nil)
  (setq imenu-prev-index-position-function nil)
  (setq imenu-extract-index-name-function nil)
  ;;  (imenu-create-index-function)
  ;; Set up search
  (setq case-fold-search t)
  )
;; Highlighting .madx and .seq buffers
;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.\\(madx\\|seq\\)\\'" . madx-mode))
;;;###autoload
(provide 'madx-mode)
;;; madx.el ends here

--=====-=-=--

^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-10-26 10:41 ` Noam Postavsky
@ 2018-10-26 10:53   ` Noam Postavsky
  0 siblings, 0 replies; 15+ messages in thread
From: Noam Postavsky @ 2018-10-26 10:53 UTC (permalink / raw)
  To: 31289; +Cc: Oscar Blanco

Noam Postavsky <npostavs@gmail.com> writes:

> Dear Noam, I attached again the file madx.el.
> With respect to the licence, I have to look back on my mails to check if I
> have any other document apart from the one I sent yesterday.

I've sent a message to the copyright-clerk@fsf.org, so we'll see what happens.

> ;;;###autoload
> (provide 'madx-mode)
> ;;; madx.el ends here

The provide statement should specifically not be autoloaded.  Otherwise
I think this is ready to upload, as soon as the copyright issue is
resolved.






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-10-26  6:42     ` Eli Zaretskii
@ 2018-10-27  3:27       ` Richard Stallman
  0 siblings, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2018-10-27  3:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 31289, npostavs, orblancog

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I asked the FSF staff to DTRT.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-04-27 11:00 bug#31289: madx mode for emacs Oscar Blanco
                   ` (2 preceding siblings ...)
  2018-10-26 10:41 ` Noam Postavsky
@ 2018-10-27 10:53 ` Noam Postavsky
  2019-09-28 18:13 ` Stefan Kangas
  4 siblings, 0 replies; 15+ messages in thread
From: Noam Postavsky @ 2018-10-27 10:53 UTC (permalink / raw)
  To: 31289; +Cc: Oscar Blanco

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

tags 31289 + pending
quit

[forwarding to list, please use "Reply All" to keep 31289@debbugs.gnu.org on Cc]

I've nothing more to say about the code, so (assuming no one else has
any comments either) we're just waiting until you resolve the copyright
stuff.


[-- Attachment #2: Type: message/rfc822, Size: 25746 bytes --]

[-- Attachment #2.1.1.1: Type: text/plain, Size: 724 bytes --]

Thank you Noam,

I attach the madx.el file again.

o

Il giorno ven 26 ott 2018 alle ore 12:53 Noam Postavsky <npostavs@gmail.com>
ha scritto:

> Noam Postavsky <npostavs@gmail.com> writes:
>
> > Dear Noam, I attached again the file madx.el.
> > With respect to the licence, I have to look back on my mails to check if
> I
> > have any other document apart from the one I sent yesterday.
>
> I've sent a message to the copyright-clerk@fsf.org, so we'll see what
> happens.
>
> > ;;;###autoload
> > (provide 'madx-mode)
> > ;;; madx.el ends here
>
> The provide statement should specifically not be autoloaded.  Otherwise
> I think this is ready to upload, as soon as the copyright issue is
> resolved.
>
>

-- 
Oscar BLANCO

[-- Attachment #2.1.1.2: Type: text/html, Size: 1363 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1.2: madx.el --]
[-- Type: text/x-emacs-lisp; name=madx.el, Size: 22707 bytes --]

;;; madx.el --- Major mode for editing MAD-X files in Emacs

;; Copyright (C) 2013, 2016 Oscar BLANCO
;;               2017, 2018 FSF

;; Author     : orblancog <orblancog@gmail.com>
;; Maintainer : orblancog
;; Created    : 18 Nov 2017
;; Keywords   : languages
;; Homepage   : https://github.com/orblancog/mad-x_syntax
;; Version    : 1.8

;; This file is not part of GNU Emacs

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;; FEATURES in version 1.8
;; * Highlights commands, parameters and special operators in MAD-X 5
;; * If the file extension is '.madx' or '.seq' then the buffer is automatically
;;   highlighted, but any buffer can be highlighted by doing :
;;       `M+X madx-mode` RET
;;   where `M` is the **META** character in Emacs (`M` seems to be **ALT** in Linux)
;;   and RET means press RETURN key
;; * If the limit of 80 characters is desired, they could be highlighted differently
;;   by uncomment the line
;;       ;(require 'whitespace)
;;       ;(setq whitespace-line-column 80) ;; limit line length
;;       ;(setq whitespace-style '(face lines-tail))
;;       ;(add-hook 'madx-mode-hook 'whitespace-mode)
;;   in this (madx.el) file.
;; HOW TO INSTALL IT
;; a) Open this file in emacs and execute
;;      `M+X package-install-file` RET `madx.el` RET
;; b)
;; 1. Copy this file (madx.el) to the highlighting definition folder, e.g.
;;      a)  ~/.emacs.d/lisp/  ---> (Emacs v24.5.X or v25)
;;      b)  ~/.emacs.d/       ---> (Emacs v23.X.X)
;;      c)  ~/                ---> (Emacs v21.X.X)
;;    i.e.
;;      $ cp madx.el ~/.emacs.d/lisp/
;; 2. Edit or create your .emacs file, typically in ~/
;;      adding the following block where the load-path must match point 1.
;;      ;;;; START OF BLOCK TO COPY AND UNCOMMENT
;;      (global-font-lock-mode t);; Enable syntax highlighting
;;      (setq font-lock-maximum-decoration t)
;;      (add-to-list 'load-path "~/.emacs.d");; <--- edit according to 1.
;;      (autoload 'madx-mode "madx" "MADX-mode" t)
;;      (setq auto-mode-alist (append '(("\\.\\(\\(madx\\)\\|\\(seq\\)\\)$" . madx-mode))
;;        auto-mode-alist))
;;      ;;;; END OF BLOCK TO COPY AND UNCOMMENT
;; You should now restart EMACS in order to reload the environment variables.
;; INFO
;; * For mad instructions, visit
;;   mad.web.cern.ch/mad/
;; * Other syntax highlightings could be found inside the
;;   mad sources.  Check the 'syntax' folder in the madx dir !
;;   Write me to the email address above about any bug including an example.

;;; History:
;; v 1.0 First release at CERN. File is also available in the
;;       MAD-X sources "syntax" folder.
;; v 1.1 Adding comments and changing some verbosed names
;; v 1.2 email update oscar.roberto.blanco.garcia@cern.ch deprecated
;;       Adding some variables from MAD-X 5.02.10 manual
;;       Cleaning up faces 8D
;;       when exceeding 80 chars->extra chars in red
;; v 1.3 adding color to numbers and ;
;; v 1.4 Changes to put this file in the emacs elpa repository
;;       Changing email address to orblancog@gmail.com
;; v 1.5 Changing licence
;; v 1.6 Adding automatic syntax highlighting for ".seq"
;; v 1.7 Chaging licence to gpl3 and code-checking following GNU ELPA suggestions
;; v 1.8 Code changes following GNU suggestions
;;       Adding comments about package-install-file

;;; Code:
(defgroup madx nil
  "Major mode to edit MAD-X files in emacs."
  :group 'languages)

(defvar madx-mode-hook nil
  "Hook for madx-model initialize nil.")

;;;; add  80 characters line
;;;; (global-whitespace-mode +1)
;(require 'whitespace)
;(setq whitespace-line-column 80) ;; limit line length
;(setq whitespace-style '(face lines-tail))
;(add-hook 'madx-mode-hook 'whitespace-mode)

(defconst madx-font-lock-keywords-face-all
  ;; madx-font-lock-keywords-programflow
  `((,(regexp-opt '(;; font-lock-keyword-face
		    ;; madx-font-lock-keywords-programflow
		   "IF"
		   "ELSEIF"
		   "ELSE"
		   "WHILE"
		   "MACRO"
		   )
		  'words)
     .  font-lock-keyword-face))
  "Highlighting expressions for MAD-X mode (keywords-all).")

(defconst madx-font-lock-builtin-face-all
  ;; madx-font-lock-keywords-tableaccs
  ;; madx-font-lock-keywords-simul
  ;; madx-font-lock-keywords-controlstm
  ;; madx-font-lock-keywords-filehandstm
  ;; madx-font-lock-keywords-tablehandstm
  ;; madx-font-lock-keywords-beamhandstm
  ;; madx-font-lock-keywords-seqediting
  ;; madx-font-lock-keywords-othrcmds
  ;; madx-font-lock-keywords-matchingmet
  ;; madx-font-lock-keywords-orbit_corr
  ;; madx-font-lock-keywords-plot
  ;; madx-font-lock-keywords-stringatt
  `((,(regexp-opt '(;; font-lock-builtin-face
		   ;;  madx-font-lock-keywords-tableaccs
		   "TABLE"
		   "TABINDEX"
		   "TABSTRING"
		   ;; madx-font-lock-keywords-simul
		   "TWISS"
		   "IBS"
		   "LINE"
		   "MAKETHIN"
		   "APERTURE"
		   "SIXTRACK"
		   "DYNAP"
		   "EMIT"
		   "MATCH"
		   "ENDMATCH"
		   "VARY"
		   "CONSTRAINT"
		   "WEIGHT"
		   "GLOBAL"
		   "GWEIGHT"
		   "PTC_TWISS"
		   "PTC_PRINTPARAMETRIC"
		   "PTC_NORMAL"
		   "SELECT_PTC_NORMAL"
		   "PTC_TRACK"
		   "PTC_TRACK_LINE"
		   "PTC_CREATE_UNIVERSE"
		   "PTC_CREATE_LAYOUT"
		   "PTC_READ_ERRORS"
		   "PTC_MOVE_TO_LAYOUT"
		   "PTC_ALIGN"
		   "PTC_END"
		   "PTC_TRACK_END"
		   "START"
		   "RUN"
		   "PTC_OBSERVE"
		   "OBSERVE"
		   "PTC_START"
		   "PTC_SETSWITCH"
		   "PTC_KNOB"
		   "PTC_SETKNOBVALUE"
		   "MATCH WITHPTCKNOBS"
		   "PTC_PRINTFRAMES"
		   "PTC_SELECT"
		   "PTC_SELECT_MOMENT"
		   "PTC_DUMPMAPS"
		   "PTC_EPLACEMENT"
		   "PTC_VARYKNOB"
		   "END_MATCH"
		   "PTC_MOMENTS"
		   "PTC_SETCAVITIES"
		   "PTC_SETDEBUGLEVEL"
		   "PTC_SETACCEL_METHOD"
		   "PTC_SETEXACTMIS"
		   "PTC_SETRADIATION"
		   "PTC_SETTOTALPATH"
		   "PTC_SETTIME"
		   "PTC_SETFRINGE"
		   ;; madx-font-lock-keywords-controlstm              
		   "EXIT"
		   "QUIT"
		   "STOP"
		   "HELP"
		   "SHOW"
		   "VALUE"
		   "OPTION"
		   "EXEC"
		   "SET"
		   "SYSTEM"
		   "TITLE"
		   "USE"
		   "SELECT"
		   ;;  madx-font-lock-keywords-filehandstm
		   "ASSIGN"
		   "CALL"
		   "RETURN"
		   "PRINT"
		   "PRINTF"
		   "RENAMEFILE"
		   "COPYFILE"
		   "REMOVEFILE"
		   ;;  madx-font-lock-keywords-tablehandstm
		   "CREATE"
		   "DELETE"
		   "READTABLE"
		   "READMYTABLE"
		   "WRITE"
		   "SETVARS"
		   "SETVARS_LIN"
		   "FILL"
		   "SHRINK"
		   ;;  madx-font-lock-keywords-beamhandstm
		   "BEAM"
		   "RESBEAM"
		   ;; madx-font-lock-keywords-seqediting
		   "SEQEDIT"
		   "FLATTEN"
		   "CYCLE"
		   "REFLECT"
		   "INSTALL"
		   "MOVE"
		   "REMOVE"
		   "REPLACE"
		   "EXTRACT"
		   "ENDEDIT"
		   "SAVE"        
		   "DUMPSEQU"
		   ;; madx-font-lock-keywords-othrcmds
		   "SAVEBETA"
		   "COGUESS"
		   "CONST"
		   "EOPTION"
		   "ESAVE"
		   "REAL"
		   ;; madx-font-lock-keywords-matchingmet
		   "LMDIF"
		   "MIGRAD"
		   "SIMPLEX"
		   "JACOBIAN"
		   "USE_MACRO"
		   ;; madx-font-lock-keywords-orbit_corr
		   "CORRECT"
		   "USEMONITOR"
		   "USEKICK"
		   "CSAVE"
		   "SETCORR"
		   "COPTION"
		   "SODD"
		   "SURVEY"
		   "SXFREAD"
		   "SXFWRITE"
		   "TOUSCHEK"
		   "TRACK"
		   "ENDTRACK"
		   ;; madx-font-lock-keywords-plot
		   "PLOT"
		   "RPLOT"
		   "RVIEWER"
		   "RTRACKSTORE"
		   "RESPLOT"
		   "SETPLOT"
		   "EPRINT"
		   ;; madx-font-lock-keywords-stringatt
		   "TITLE"
		   "system"
		   )
		  'words)
     . font-lock-builtin-face))
  "Highlighting expressions for MAD-X mode (builtin-all).")

(defconst madx-font-lock-type-face-all
  ;; madx-font-lock-keywords-elements
  `((,(regexp-opt '(; font-lock-type-face
		   ;; madx-font-lock-keywords-elements
		   "DRIFT"
		   "QUADRUPOLE"
		   "SEXTUPOLE"
		   "OCTUPOLE"
		   "SOLENOID"
		   "CRABCAVITY"
		   "RFCAVITY"
		   "DIPEDGE"
		   "MULTIPOLE"
		   "COLLIMATOR"
		   "ECOLLIMATOR"
		   "RCOLLIMATOR"
		   "YROTATION"
		   "SROTATION"
		   "TRANSLATION"
		   "CHANGEREF"
		   "MARKER"
		   "RBEND"
		   "SBEND"
		   "DIPEDGE"
		   "HKICKER"
		   "VKICKER"
		   "KICKER"
		   "TKICKER"
		   "ELSEPARATOR"
		   "HMONITOR"
		   "VMONITOR"
		   "MONITOR"
		   "INSTRUMENT"
		   "PLACEHOLDER"
		   "BEAMBEAM"
		   "MATRIX"
		   "NLLENS"
		   "RFMULTIPOLE"
		   "ELSEPARATOR"
		   )
		  'words)
     . font-lock-type-face))
  "Highlighting expressions for MAD-X mode (type-all).")

(defconst madx-font-lock-warning-face-all
  ;; madx-font-lock-keywords-errordef
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-keywords-errordef
		   "ERROR"
		   "EALIGN"
		   "EFCOMP"
		   "SETERR"
		   )
		  'words)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (warning-all).")

(defconst madx-font-lock-special_operators
  ;; madx-font-lock-special_operators
  `((,(regexp-opt '(; font-lock-warning-face
		   ;; madx-font-lock-special_operators
		   ":="
		   "->"
		   )
		  t)
     . font-lock-warning-face))
  "Highlighting expressions for MAD-X mode (special-operators).")

(defconst madx-font-lock-constant-face-all
  ;; madx-font-lock-keywords-constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-keywords-constants
		   "POSITRON"
		   "ELECTRON"
		   "PROTON"
		   "ANTIPROTON"
		   "POSMUON"
		   "NEGMUON"
		   "ION"
		   "PI"
		   "TWOPI"
		   "DEGRAD"
		   "RADDEG"
		   "E"
		   "EMASS"
		   "PMASS"
		   "NMASS"
		   "MUMASS"
		   "CLIGHT"
		   "QELECT"
		   "HBAR"
		   "ERAD"
		   "PRAD"
		   "TRUE"
		   "FALSE"
		   "SIMPLE"
		   "COLLIM"
		   "TEAPOT"
		   "HYBRID"
		   "ENTRY"
		   "CENTRE"
		   "EXIT"
		   "CIRCLE"
		   "RECTANGLE"
		   "ELLIPSE"
		   "LHCSCREEN"
		   "MARGUERITE"
		   "RECTELLIPSE"
		   "RACETRACK"
		   "OCTAGON"
		   "TERMINAL"
		   )
		  'words)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (constant-all).")

(defconst madx-font-lock-special_constants
  ;; madx-font-lock-special_constants
  `((,(regexp-opt '(; font-lock-constant-face
		   ;; madx-font-lock-special_constants
		   "#e"
		   "#s"
		   )
		  t)
     . font-lock-constant-face))
  "Highlighting expressions for MAD-X mode (special_constants).")

(defconst madx-font-lock-doc-face-all
  ;; madx-font-lock-keywords-parameters
  `((,(regexp-opt '(;; font-lock-doc-face
		   ;; madx-font-lock-keywords-parameters
		   "NOEXPR" ;2016.08
		   "KNLL" ;2016.08
		   "CNLL" ;2016.08
		   "ROOTMACRO"
		   "MOMENT_S"
		   "MOMENT"
		   "SURVEYALL"
		   "DELTA_DEPENDENCY"
		   "IGNORE_MAP_ORBIT"
		   "RING_PARAMETERS"
		   "CENTER_MAGNETS"
		   "SUMMARY_FILE"
		   "SUMMARY_TABLE"
		   "MAPTABLE"
		   "DELS"
		   "TXI"
		   "TYI"
		   "TLI"
		   "UPDATE"
		   "NCORR"
		   "SNGVAL"
		   "SNGCUT"
		   "CORRLIM"
		   "TWORING"
		   "UNITS"
		   "CORZERO"
		   "BEAM1TAB"
		   "BEAM2TAB"
		   "EXTERN"
		   "NAME_COL"
		   "X_COL"
		   "Y_COL"
		   "TWISSUM"
		   "LSQ"
		   "MICADO"
		   "SVD"
		   "THICK"
		   "VECTOR"
		   "expr"
		   "VLENGTH"
		   "SLOW"
		   "PATCH_ANG"
		   "PATCH_TRANS"
		   "ADD_ANGLE"
		   "ADD_PASS"
		   "NEXT_SEQU"
		   "ZERO_SUPPR"
		   "N_BESSEL"
		   "RIPKEN"
		   "NO_CAVITY_TOTALPATH"
		   "PNL"
		   "PSL"
		   "MAKEDIPEDGE"
		   "TRUNCATE"
		   "APPEND"
		   "ROW1"
		   "ROW1"
		   "PARAM"
		   "SINKICK"
		   "SINPEAK"
		   "SINTUNE"
		   "SINPHASE"
		   "L"
		   "K1"
		   "K1S"
		   "TILT"
		   "K2"
		   "K2S"
		   "K3"
		   "K3S"
		   "KS"
		   "K3S"
		   "KSI"
		   "VOLT"
		   "LAG"
		   "FREQ"
		   "HARMON"
		   "rv1"
		   "rv2"
		   "rv3"
		   "rv4"
		   "rph1"
		   "rph2"
		   "lagf"
		   "PARTICLE"
		   "MASS"
		   "CHARGE"
		   "ENERGY"
		   "PC"
		   "GAMMA"
		   "BETA"
		   "BRHO"
		   "EX"
		   "EXN"
		   "EY"
		   "EYN"
		   "ET"
		   "SIGT"
		   "SIGE"
		   "KBUNCH"
		   "NPART"
		   "PLANE"
		   "BCURRENT"
		   "CURRENT"
		   "BUNCHED"
		   "RADIATE"
		   "NORM_NO"
		   "BV"
		   "SEQUENCE"
		   "ENDSEQUENCE"
		   "REFER"
		   "MAD8"
		   "GNFU"
		   "KICK"
		   "HKICK"
		   "VKICK"
		   "ANGLE"
		   "K0"
		   "K0S"
		   "RESPLIT"
		   "DAMP"
		   "QUANTUM"
		   "RECLOSS"
		   "ELEMENT_BY_ELEMENT"
		   "NORM"
		   "NORM_OUT"
		   "RADIATION_MODEL1"
		   "RADIATION_ENERGY_LOSS"
		   "RADIATION_QUADr"
		   "BEAM_ENVELOPE"
		   "SPACE_CHARGE"
		   "FX"
		   "FY"
		   "FT"
		   "FFILE"
		   "E1"
		   "E2"
		   "FINT"
		   "FINTX"
		   "HGAP"
		   "H1"
		   "H2"
		   "FLAG"
		   "RANGE"
		   "PLACE"
		   "PARENT"
		   "KEYWORD"
		   "FROM"
		   "AT"
		   "REFPOS"
		   "LENGTH"
		   "EXACT_MIS"
		   "CLASS"
		   "PATTERN"
		   "FILE"
		   "FORMAT"
		   "RBARC"
		   "TWISS_PRINT"
		   "THREADER"
		   "THIN_FOC"
		   "NO_FATAL_STOP"
		   "TEXT"
		   "BARE"
		   "SLICE"
		   "THICK"
		   "COMMAND"
		   "TO"
		   "NEWNAME"
		   "BY"
		   "SELECTED"
		   "H"
		   "LRAD"
		   "KNL"
		   "KSL"
		   "TYPE"
		   "SIGX"
		   "SIGY"
		   "XMA"
		   "YMA"
		   "BBSHAPE"
		   "WIDTH"
		   "BBDIR"
		   "ECHO"
		   "ECHOMACRO"
		   "TRACE"
		   "VERIFY"
		   "PERIOD"
		   "SECTORMAP"
		   "SECTORFILE"
		   "KEEPORBIT"
		   "USEORBIT"
		   "COUPLE"
		   "FULL"
		   "COLUMN"
		   "MOMENTS"
		   "PARAMETRIC"
		   "CLEAR"
		   "POS"
		   "POLYNOMIAL"
		   "MONOMIAL"
		   "PARAMETRIC"
		   "QUANTITY"
		   "ROW"
		   "SEED"
		   "ADD"
		   "INFO"
		   "DEBUG"
		   "VERBOSE"
		   "TELL"
		   "RESET"
		   "WARN"
		   "LABEL"
		   "APERTYPE"
		   "HAXIS"
		   "HMIN"
		   "HMAX"
		   "VAXIS"
		   "VAXIS1"
		   "VAXIS2"
		   "VAXIS3"
		   "VAXIS4"
		   "VMIN"
		   "VMAX"
		   "BARS"
		   "SYMBOL"
		   "NOVERSION"
		   "NO_FATAL_ERROR"
		   "NO_FATAL_STOP"
		   "INTERPOLATE"
		   "NOLINE"
		   "NOTITLE"
		   "MARKER_PLOT"
		   "RANGE_PLOT"
		   "MULTIPLE"
		   "PTC"
		   "PTC_TABLE"
		   "TRACKFILE"
		   "CAVALL"
		   "MULT_AUTO_OFF"
		   "MAX_MULT_ORD"
		   "SPLIT"
		   "RADIUS"
		   "WARNING"
		   "STYLE"
		   "COLOUR"
		   "TURNS"
		   "EVERYSTEP"
		   "ONETABLE"
		   "TABLEALLSTEPS"
		   "GCS"
		   "ROOTNTUPLE"
		   "EXTENSION"
		   "FASTUNE"
		   "MAXAPER"
		   "LYAPUNOV"
		   "ORBIT"
		   "TOL"
		   "DS"
		   "DPHI"
		   "DTHETA"
		   "DPSI"
		   "MREX"
		   "MREY"
		   "MSCALX"
		   "MSCALY"
		   "AREX"
		   "AREY"
		   "ORDER"
		   "DKN"
		   "DKS"
		   "DKNR"
		   "DKSR"
		   "HYSTER"
		   "HCOEFFN"
		   "HCOEFFS"
		   "BETA0"
		   "RMATRIX"
		   "STEP"
		   "CHROM"
		   "LOWER"
		   "UPPER"
		   "SLOPE"
		   "OPT"
		   "CALLS"
		   "NO"
		   "XDISTR"
		   "YDISTR"
		   "ZDISTR"
		   "TOLERANCE"
		   "STRATEGY"
		   "REPEAT"
		   "BISEC"
		   "COOL"
		   "BALANCE"
		   "RANDOM"
		   "MODEL"
		   "TARGET"
		   "MODE"
		   "MONERROR"
		   "MONON"
		   "MONSCALE"
		   "PLANEX"
		   "COND"
		   "RESOUT"
		   "CLIST"
		   "MLIST"
		   "STATUS"
		   "POST"
		   "FONT"
		   "LWIDTH"
		   "APER_TOL"
		   "APER_OFFSET"
		   "HALOFILE"
		   "PIPEFILE"
		   "DQF"
		   "BETAQFX"
		   "DP"
		   "DPARX"
		   "DPARY"
		   "COR"
		   "BBEAT"
		   "NCO"
		   "HALO"
		   "INTERVAL"
		   "SPEC"
		   "NOTSIMPLE"
		   "TRUEPROFILE"
		   "OFFSETELEM"
		   "XSIZE"
		   "YSIZE"
		   "ASCALE"
		   "LSCALE"
		   "SSCALE"
		   "RSCALE"
		   "DETUNE"
		   "DISTORT1"
		   "DISTORT2"
		   "START_STOP"
		   "MULTIPOLE_ORDER_RANGE"
		   "NOPRINT"
		   "PRINT_ALL"
		   "PRINT_AT_END"
		   "NOSIXTRACK"
		   "X0"
		   "Y0"
		   "Z0"
		   "THETA0"
		   "PHI0"
		   "PSI0"
		   "SUMM"
		   "CENTRE"
		   "SECTOR_NMUL_MAX"
		   "SECTOR_nMUL"
		   "NTPSA"
		   "SYMPRINT"
		   "TIME"
		   "METHOD"
		   "NST"
		   "EXACT"
		   "OFFSET_DELTAP"
		   "ERRORS_OUT"
		   "ERRORS_IN"
		   "MAGNET_NAME"
		   "RESPLIT"
		   "THIN"
		   "XBEND"
		   "EVEN"
		   "OVERWRITE"
		   "INDEX"
		   "ONEPASS"
		   "DUMP"
		   "DEBUGLEVEL"
		   "LEVEL"
		   "BBORBIT"
		   "SYMPL"
		   "MAXACCELERATION"
		   "EXACT_MISS"
		   "TOTALPATH"
		   "RADIATION"
		   "FRINGE"
		   "ICASE"
		   "CLOSED_ORBIT"
		   "SLICE_MAGNETS"
		   "INITIAL_MATRIX_TABLE"
		   "MATRIX_MANUAL"
		   "INITIAL_MAP_MANUAL"
		   "INITIAL"
		   "ELEMENT"
		   "TRUSTRANGE"
		   "ANHX"
		   "ANHY"
		   "GNUF"
		   "HAML"
		   "EIGN"
		   "INITIAL_MATRIX_MANUAL"
		   "ELEMENTNAME"
		   "KN"
		   "KS"
		   "EXACTMATCH"
		   "ONLYPOSITION"
		   "ONLYORIENTATION"
		   "AUTOPLACEDOWNSTREAM"
		   "REFFRAME"
		   "USE_PTCKNOBS"
		   )
		  'words)
     . font-lock-doc-face))
  "Highlighting expressions for MAD-X mode (doc-all).")

(defconst madx-font-lock-function-name-face-all
  ;; madx-font-lock-keywords-functions
  `((,(regexp-opt '(;;  font-lock-function-name-face
		   ;; madx-font-lock-keywords-functions
		   "SQRT"
		   "LOG"
		   "LOG10"
		   "EXP"
		   "SIN"
		   "COS"
		   "TAN"
		   "ASIN"
		   "ACOS"
		   "ATAN"
		   "SINH"
		   "COSH"
		   "TANH"
		   "SINC"
		   "ABS"
		   "ERF"
		   "ERFC"
		   "FLOOR"
		   "CEIL"
		   "ROUND"
		   "RANF"
		   "GAUSS"
		   "TGAUSS"
		   "FLAT5"
		   "FLAT56"
		   )
		  'words)
     . font-lock-function-name-face))
  "Highlighting expressions for MAD-X mode (name-all)." )

(defconst madx-font-lock-variable-name-face-all
  ;; madx-font-lock-keywords-variables_madx
  `((,(concat (regexp-opt '(;; font-lock-variable-name-face
			    ;; madx-font-lock-keywords-variables_madx
			    "mvar1"
			    "mvar2"
			    "mvar3"
			    "mvar4"
			    "CIRC"
			    "FREQ0"
			    "DTBYDS"
			    "U0"
			    "QS"
			    "ARAD"
			    "PDAMP"
			    "N1MIN"
			    "Z"
			    "PHI"
			    "PSI"
			    "X"
			    "Y"
			    "BETX"
			    "BETY"
			    "NAME"
			    "S"
			    "k0l"
			    "k1l"
			    "k2l"
			    "k3l"
			    "k4l"
			    "K1"
			    "K2"
			    "K3"
			    "K4"
			    "K5"
			    "K6"
			    "K1L"
			    "K2L"
			    "K3L"
			    "K4L"
			    "K5L"
			    "K6L"       
			    "KICK1"
			    "KICK2"
			    "KICK3"
			    "KICK4"
			    "KICK5"
			    "KICK6"
			    "MU1"
			    "MU2"
			    "MU3"
			    "MUX"
			    "MUY"
			    "PX"
			    "PY"
			    "PT"
			    "DELTAP"
			    "XN"
			    "PXN"
			    "WX"
			    "PHI"
			    "THETA"
			    "PHIX"
			    "YN"
			    "PYN"
			    "WY"
			    "PHIY"
			    "TN"
			    "PTN"
			    "WT"
			    "PHIT"
			    "ALFX"
			    "DX"
			    "DPX"
			    "ALFY"
			    "DY"
			    "DPY"
			    "ENERGY"
			    "DMUX"
			    "DDX"
			    "DDPX"
			    "DMUY"
			    "DDY"
			    "DDPY"
			    "Q1"
			    "Q2"
			    "DQ1"
			    "DQ2"
			    "DDQ1"
			    "DDQ2"
			    "N1"
			    "N1X_M"
			    "N1Y_M"
			    "APER_1"
			    "APER_2"
			    "APER_3"
			    "APER_4"
			    "RTOL"
			    "XTOL"
			    "YTOL"
			    "ON_AP"
			    "ON_ELEM"
			    "LENGTH"
			    "ORBIT5"
			    "BETXMAX"
			    "DXMAX"
			    "DXRMS"
			    "XCOMAX"
			    "XRMS"
			    "BETYMAX"
			    "DYMAX"
			    "DYRMS"
			    "YCOMAX"
			    "YCORMS"
			    "SYNCH_1"
			    "SYNCH_2"
			    "SYNCH_3"
			    "SYNCH_4"
			    "SYNCH_5"
			    "DISTANCE"
			    "LYAPUNOV"
			    "LOGDIST"
			    "LOGTURNS"
			    "RE"
					;		    "RE11";REPLACE BY RE[1-6][1-6]
			    "T"
					;		    "T111";; REPLACE BY T[1-6][1-6][1-6]
					;		    "TM111";; REPLACE BY TM[1-6][1-6][1-6]
					;		    "BETA11"; REPLACE BY BETA[1-3][1-3]
					;		    "BETA11P"; REPLACE BY BETA[1-3][1-3]P
			    "ALFA"
					;		    "ALFA11"; REPLACE BY ALFA[1-3][1-3]
					;		    "ALFA11P"; REPLACE BY ALFA[1-3][1-3]P
			    "GAMMATR"
			    "GAMAX"
			    "GAMAY"
					;		    "GAMA11"; REPLACE BY GAMA[1-3][1-3]
					;		    "GAMA11P"; REPLACE BY GAMA[1-3][1-3]P
					;		    "GAMMA11"; REPLACE BY GAMA[1-3][1-3]
			    "DISP1"
			    "DISP2"
			    "DISP3"
			    "DISP4"
					;		    "DISP1P1"; REPLACE BY DISP[1-4]P[1-3]
					;		    "EIGN11"; REPLACE BY EIGN[1-6][1-6]
			    "R"
					;		    "R11";; REPLACE BY R[1-6][1-6] AFTER REGEXP-OPT
					;		    "RM11";; REPLACE BY RM[1-6][1-6] AFTER REGEXP-OPT		    
			    )
			  'words)
	      ;; some variables already optimized
	      "\\|\\<RE[1-6][1-6]\\>"
	      "\\|\\<TM?[1-6][1-6][1-6]\\>"
	      "\\|\\<BETA[1-3][1-3]P?\\>"
	      "\\|\\<ALFA[1-3][1-3]P?\\>"
	      "\\|\\<GAMA[1-3][1-3]P?\\>"
	      "\\|\\<DISP[1-4]P[1-3]\\>"
	      "\\|\\<EIGN[1-6][1-6]\\>"
	      "\\|\\<RM?[1-6][1-6]\\>")
     . font-lock-variable-name-face))
  "Highlighting expressions for MAD-X mode (variable-name-all).")

(defconst madx-font-lock-intfp-name-face-all
  ;; madx- fonts for integers and floating point numbers
  (list
   '("\\<\\(\\([0-9]+\\.?[0-9]*\\|\\.[0-9]+\\)\\([eE][+-]?\\([0-9]+\\.?[0-9]*\\|[0-9]*\\.[0-9]+\\)\\)?\\)\\>"
     . font-lock-keyword-face))
  "Highlighting expresssions for MAD-X mode (integers and floats).")

(defconst madx-font-lock-keywords-4
  (append
   madx-font-lock-special_constants
   madx-font-lock-special_operators
   madx-font-lock-keywords-face-all
   madx-font-lock-constant-face-all
   madx-font-lock-function-name-face-all
   madx-font-lock-type-face-all
   madx-font-lock-variable-name-face-all
   madx-font-lock-builtin-face-all
   madx-font-lock-warning-face-all
   madx-font-lock-doc-face-all
   madx-font-lock-intfp-name-face-all)
 "Balls-out highlighting in MAD-X mode.")

(defvar madx-font-lock-keywords madx-font-lock-keywords-4
  "Default highlighting expressions for MAD-X mode.")

(defvar madx-mode-syntax-table
  (let ((madx-mode-syntax-table (make-syntax-table)))
	
  ;; This is added so entity names with underscores and dots can be more easily parsed
  (modify-syntax-entry ?_ "w" madx-mode-syntax-table)
  (modify-syntax-entry ?. "w" madx-mode-syntax-table)
	
  ;;  Comment styles are similar to C++
  (modify-syntax-entry ?/ ". 124 b" madx-mode-syntax-table)
  (modify-syntax-entry ?* ". 23" madx-mode-syntax-table)
  (modify-syntax-entry ?\n "> b" madx-mode-syntax-table)
  (modify-syntax-entry ?! "< b" madx-mode-syntax-table)
  (modify-syntax-entry ?' "|" madx-mode-syntax-table)
     madx-mode-syntax-table)
  "Syntax table for `madx-mode'.")

;;;###autoload
(define-derived-mode madx-mode fundamental-mode "madx"
  "Major mode for editing Methodical Accelerator Design X script files."
  (setq font-lock-defaults '(madx-font-lock-keywords nil t))
  ;; Setting up Imenu
  (setq imenu-generic-expression nil)
  (setq imenu-prev-index-position-function nil)
  (setq imenu-extract-index-name-function nil)
  ;;  (imenu-create-index-function)
  ;; Set up search
  (setq case-fold-search t)
  )
;; Highlighting .madx and .seq buffers
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.\\(madx\\|seq\\)\\'" . madx-mode))
(provide 'madx-mode)
;;; madx.el ends here

^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2018-04-27 11:00 bug#31289: madx mode for emacs Oscar Blanco
                   ` (3 preceding siblings ...)
  2018-10-27 10:53 ` Noam Postavsky
@ 2019-09-28 18:13 ` Stefan Kangas
  2019-09-28 18:46   ` Noam Postavsky
  4 siblings, 1 reply; 15+ messages in thread
From: Stefan Kangas @ 2019-09-28 18:13 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 31289, Oscar Blanco

Noam Postavsky <npostavs@gmail.com> writes:

> Noam Postavsky <npostavs@gmail.com> writes:
>
>> Dear Noam, I attached again the file madx.el.
>> With respect to the licence, I have to look back on my mails to check if I
>> have any other document apart from the one I sent yesterday.
>
> I've sent a message to the copyright-clerk@fsf.org, so we'll see what happens.

Did you ever hear back from the copyright clerk?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2019-09-28 18:13 ` Stefan Kangas
@ 2019-09-28 18:46   ` Noam Postavsky
  2019-09-28 18:55     ` Stefan Kangas
  0 siblings, 1 reply; 15+ messages in thread
From: Noam Postavsky @ 2019-09-28 18:46 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 31289, Oscar Blanco

Stefan Kangas <stefan@marxist.se> writes:

> Noam Postavsky <npostavs@gmail.com> writes:
>
>> I've sent a message to the copyright-clerk@fsf.org, so we'll see what happens.
>
> Did you ever hear back from the copyright clerk?

I did at the time, but there was some additional paperwork that Oscar
needed to get done, and it seems that it still hasn't been resolved
(since I don't see him listed in the copyright list file).






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2019-09-28 18:46   ` Noam Postavsky
@ 2019-09-28 18:55     ` Stefan Kangas
  2020-01-15 20:26       ` Stefan Kangas
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Kangas @ 2019-09-28 18:55 UTC (permalink / raw)
  To: Oscar Blanco; +Cc: 31289, Noam Postavsky

Hi Oscar,

It seems like there are still some additional paperwork to take care
of before we can accept your module madx.el into GNU ELPA.  Could you
please contact copyright-clerk@fsf.org to proceed with your copyright
assignment?

Thanks in advance.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#31289: madx mode for emacs
  2019-09-28 18:55     ` Stefan Kangas
@ 2020-01-15 20:26       ` Stefan Kangas
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Kangas @ 2020-01-15 20:26 UTC (permalink / raw)
  To: Oscar Blanco; +Cc: 31289-done, Noam Postavsky

Stefan Kangas <stefan@marxist.se> writes:

> Hi Oscar,
>
> It seems like there are still some additional paperwork to take care
> of before we can accept your module madx.el into GNU ELPA.  Could you
> please contact copyright-clerk@fsf.org to proceed with your copyright
> assignment?

Hi again,

More information was requested, but none was given within 15 weeks, so
I don't think we can make any progress here.  I'm therefore closing
this bug for now.

Oscar, if you are still interested in submitting your madx mode to GNU
ELPA, please reply to this email and we can reopen this bug report to
proceed with the inclusion.  Thank you.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-01-15 20:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-27 11:00 bug#31289: madx mode for emacs Oscar Blanco
2018-06-22  0:50 ` Noam Postavsky
2018-10-05  6:52   ` Oscar Blanco
2018-10-24 22:30     ` Noam Postavsky
2018-10-25 22:56 ` Noam Postavsky
2018-10-25 23:18   ` Noam Postavsky
2018-10-26  6:42     ` Eli Zaretskii
2018-10-27  3:27       ` Richard Stallman
2018-10-26 10:41 ` Noam Postavsky
2018-10-26 10:53   ` Noam Postavsky
2018-10-27 10:53 ` Noam Postavsky
2019-09-28 18:13 ` Stefan Kangas
2019-09-28 18:46   ` Noam Postavsky
2019-09-28 18:55     ` Stefan Kangas
2020-01-15 20:26       ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).