(defvar par-keymap (make-sparse-keymap) "Keymap used for `par-mode' commands.") (defcustom par-list nil "AList of your personal LaTeX math symbols. Each entry should be a list with three elements, KEY, VALUE, and MENU. KEY is the key to be redefined (under `LaTeX-math-abbrev-prefix' in math minor mode, VALUE can be a string with the name of the macro to be inserted, or a function to be called. The optional third element is the name of the submenu where the command should be added. See also `LaTeX-math-menu'." :type '(repeat (group (choice :tag "Key" (const :tag "none") (character :format "%v\n")) (string :tag "Value") (choice :tag "Menu" (string :tag "Name" :format "%v") (repeat :tag "Path" (string :format "%v")))))) (defconst par-default '((?a "alpha" "greek") (?b "beta" "greek") (?c LaTeX-math-cal "Cal-whatever") (?d "delta" "greek") (?e "epsilon" "greek"))) (defvar par-menu '("Math" ("Greek") ("greek") ("Binary Op") ("Relational") ("Arrows") ("Misc Symbol") ("Var Symbol") ("Log-like") ("delimiters") ("Delimiters") ("Constructs") ("Accents") ("AMS")) "Menu containing LaTeX math commands. The menu entries will be generated dynamically, but you can specify the sequence by initializing this variable.") (easy-menu-define par-mode-menu par-keymap "Menu used in parameter.txt minor mode." par-menu) (define-key par-keymap "\C-c\C-w" "test") (define-key par-keymap "\C-c\;" 'comment-region) (define-key par-keymap "\C-c:" 'par-uncomment-region) (define-key par-keymap "\C-c\C-c" 'run-fibre) (define-key par-keymap "\C-ckk" 'kill-fibre) (define-key par-keymap "\C-c\C-n" 'set-fibre-normal) (define-key par-keymap "\C-c\C-l" 'set-fibre-low) (define-key par-keymap "\C-c\C-f" 'open-bessel-file) (defvar keywords '("END" "end" ; for ellipses only "ell_nextra" "ell_hppc" "ell_xacc" "ell_steps" "ell_sub" "ell_mb" "use extended position file format" "extposformat" ; internal version only "start diameter" "stop diameter" "start pitch" "stop pitch" "accept real minima" "new material" "material properties" "expansion type" "expansion order" "sellmeier coefficient" "track with geometry" "convert to fini" "central cylinder order" "num_n_points_2" "num_ni_points_2" "accuracy goal" "erase n_eff table" "exit" "load" "write" ; public version "overwrite" "OVERWRITE" "number of points" "steps" "number_of_points" "numpoints" "number of log points" "number of points between log" "numlogpoints" "start nwidth" "start n_width" "default nwidth" "default n_width" "start_width" "add central cylinder" "central cylinder" "central cylinder index" "central cylinder epsilon" "central cylinder refractive index" "central cylinder permittivity" "central cylinder radius" "start_lambda" "start lambda" "first wavelength" "first lambda" "start wavelength" "stop_lambda" "stop lambda" "last wavelength" "last lambda" "stop wavelength" "verbose" "VERBOSE" "Verbose" "progress file" "verbose file" "file suffix" "file extension" "file_extension" "wavelength" "WAVELENGTH" "wl" "WL" "lambda" "optimization" "pitch" "PITCH" "Lambda" "start_index" "start_neff" "n_eff_0" "lower left n_eff corner" "n_eff_width" "N_eff_width" "N_EFF_WIDTH" "n_width" "N_WIDTH" "stop_n_eff" "upper right n_eff corner" "final n_eff" "stop n_eff" "stop neff" "structure file" "structure" "STRUCTURE FILE" "structure_file" "STRUCTURE_FILE" "file name" "file name radix" "output file name radix" "Nr" "nr" "number of rings" "NUMBER OF RINGS" "MNr" "mnr" "missing rings" "MISSING RINGS" "number of core rings" "num_n_points" "num_ni_points" "start_mode" "first mode" "start mode" "stop_mode" "last mode" "stop mode" "det_mode_threshold" "det mode threshold" "determinant threshold" "eigen_value_threshold" "eigenvalue threshold" "eigen-value threshold" "upper_real_threshold" "upper real threshold" "lower_real_threshold" "lower real threshold" "lower_imag_threshold" "lower imag threshold" "lower imaginary threshold" "upper_imag_threshold" "upper imag threshold" "upper imaginary threshold" "minima_threshold" "minima threshold" "minimum threshold" "real_precision_threshold" "real precision threshold" "real precision" "imag_precision_threshold" "imag precision threshold" "imaginary precision threshold" "imag precision" "imaginary precision" "condition_threshold" "condition threshold" "degeneracy threshold" "skip_real_borders" "skip real borders" "jacket index" "nj" "nJ" "n_J" "n_j" "cladding index" "nc" "nC" "n_C" "n_c" "cylinder index" "ni" "nI" "n_I" "n_i" "matrix index" "nm" "nM" "n_M" "n_m" "parameter list" "order" "ORDER" "Order" "gorder" "GORDER" "Gorder" "Cladding Order" "cladding order" "CLADDING ORDER" "corder" "Corder" "CORDER" "cladding radius" "cladding_radius" "CLADDING_RADIUS" "Cladding radius" "Cladding_radius" "Cladding Radius" "jacket radius" "jacket_radius" "JACKET_RADIUS" "Jacket radius" "Jacket_radius" "Jacket Radius" "No Cladding" "no_cladding" "No_cladding" "NO CLADDING" "no cladding" "NO_CLADDING" "cylinder radius" "cylinder_radius" "CYLINDER_RADIUS" "Cylinder radius" "Cylinder_radius" "Cylinder Radius" "diameter on pitch ratio" "d/Lambda" "d/pitch" "diameter/pitch" "diameter on pitch" "diameter_on_pitch" "No Jacket" "no_jacket" "No_jacket" "NO JACKET" "no jacket" "NO_JACKET" "Build Fibre" "Build Fiber" "Build Structure" "build fibre" "build biber" "build structure" "make fibre" "Make Fibre" "write structure" "save structure" "write structure file" "save fibre" "save fiber" "suggest order" "eval order" "auto order" "suggest n_eff range" "search modes" "modesearch" "SEARCH MODES" "MODESEARCH" "mode search" "get dispersion curve" "compute dispersion curve" "dispersion" "lambda track" "wavelength track" "load bcf file" "load dispersion file" "load mode")) (setq opti (regexp-opt '( ; internal "n lambda" "n omega" "epsilon lambda" "epsilon omega" "n lambda power" ; public version "paranoid" "normal" "fast" "fast" "FAST" "normal" "NORMAL" "close cylinders" "second nearest neighbour" "second neighbour" "core" "average" "rigorous" "precise" "precision" "PRECISE" "PRECISION" "accurate" "paranoid" "PARANOID" "fundamental" "Fundamental" "FUNDAMENTAL" "FUND" "fund" "fundamental mode" "second" "second mode" ".true." ".TRUE." ".false." ".FALSE."))) (setq optlist (cons opti '(. 'font-lock-warning-face))) ;font-lock-string-face))) (define-generic-mode 'par () keywords (list '("\\(!.*\\)" 1 'font-lock-comment-face) optlist ;'("[0-9]*\\.[0-9]*[eEdD]?[0-9]*" . 'font-lock-warning-face) '("\\<\\(-?[0-9]*\\.[0-9]+[eEdD]?-?[0-9]*\\|-?[0-9]+\\.?[0-9]*[eEdD]?-?[0-9]*\\)" . 'font-lock-warning-face) '("=.*?[\n]" . font-lock-variable-name-face)) '("\\([]>:/\\]\\..*parameters\\.txt\\'\\|\\`\\..*parameters\\.txt\\'\\|[:/]parameters\\.txt\\'\\)") ;"[:/\\\\]?parameters\\.txt$") (list (lambda () (setq comment-start "!") (use-local-map par-keymap) (require 'extview) (push '("\\.fbb$" . "winfield.exe -r51 %s") extview-application-associations) (push '("\\.eps$" . nil) extview-application-associations) (push '("\\.ps$" . nil) extview-application-associations) (push '("\\_disp.dat$" . "c:\\progra\~1\\cudos\\plotit.bat %s") extview-application-associations) (push '("\\_dispD.dat$" . "c:\\progra\~1\\cudos\\plotit2.bat %s") extview-application-associations) ;;(push '("\\.bcf$" . "winfield.exe -r51 %s") extview-application-associations) ;if using speedbar, uncomment following ;(speedbar) ;(speedbar-add-supported-extension '(".bcf" ".fbb" "_disp.dat" "dispD.dat")) ;(speedbar-update-directory-contents) )) "Mode for CUDOS MOF Utilities parameter files") (setq auto-mode-alist (cons '("\\([]>:/\\]\\..*parameters\\.txt\\'\\|\\`\\..*parameters\\.txt\\'\\|[:/]parameters\\.txt\\'\\)" . par) auto-mode-alist)) (setq cudos-path '"c:/program files/CUDOS/") (setq exec-path (cons cudos-path exec-path)) ;(setcar exec-path cudos-path) (defun fibre-finished (process event) (set-frame-name (concat "Emacs:" (substring default-directory -40 -1))) ) (defun par-uncomment-region (beg end) "Uncomment active region." (interactive "r") (comment-region beg end -1)) (defun run-fibre () "Runs fibre in current directory." (interactive) ;(start-process "Fibre" "Fibre output" "fibrelow.bat" (shell-quote-argument "blatext 2")) (with-current-buffer (get-buffer-create "Fibre output") (insert (concat '"Running fibre on: " default-directory " ...\n"))) (set-frame-name (concat "Fibre running:" (substring default-directory -40 -1))) (setq fibreproc (start-process "Fibre" "Fibre output" "fibre.exe")) (w32-set-process-priority (process-id fibreproc) 'low) (set-process-sentinel fibreproc 'fibre-finished) ;(w32-set-process-priority (start-process "fibre.exe" nil (get-buffer-create "Fibre output") 1) low) ;'"fibrelow.bat") (display-buffer (get-buffer "Fibre output")) ;(display-buffer (get-buffer-create "errors.txt")) ;(find-file '"errors.txt") ) (defun set-fibre-normal () "sets priority of fibre process to normal (default when running is low)" (interactive) (w32-set-process-priority (process-id fibreproc) 'normal) (with-current-buffer (get-buffer-create "Fibre output") (insert '"Fibre priority set to normal. \n")) ) (defun set-fibre-low () "sets priority of fibre process to low" (interactive) (w32-set-process-priority (process-id fibreproc) 'low) (with-current-buffer (get-buffer-create "Fibre output") (insert '"Fibre priority set to low. \n")) ) (defun kill-fibre () "Kills current fibre process" (interactive) (interrupt-process "Fibre output") (with-current-buffer (get-buffer-create "Fibre output") (insert '"Fibre interrupted (user stop). \n")) ) ;; (defun open-bessel-file () ;; "Opens Fourier Bessel file with winfield" ;; (interactive) ;; (start-process "Winfield" nil "winfield.exe" speedbar-do-function-pointerlast-selected-file) ;; ) ;; (defvar par-speedbar-key-map (make-sparse-keymap) ;; "Keymap used for `par-speedbar-mode' commands.") ;; (setq par-speedbar-key-map (speedbar-make-specialized-keymap)) ;; (defvar par-speedbar-menu ["Winfield open" 'open-bessel-file t])