diff options
| author | Lars Ingebrigtsen | 2021-06-12 14:44:54 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-06-12 14:44:54 +0200 |
| commit | 6b5a7136ca0b3c7022bf143a5d482ef8bfc856d7 (patch) | |
| tree | 7e52613ea7c7c479120a0d00831eab2ba941e687 | |
| parent | dd3094170a09fdbf2f45502d248640530fb15be4 (diff) | |
| download | emacs-6b5a7136ca0b3c7022bf143a5d482ef8bfc856d7.tar.gz emacs-6b5a7136ca0b3c7022bf143a5d482ef8bfc856d7.zip | |
Fix double (recursive) load of fortran.el
* lisp/progmodes/fortran.el (fortran-menu): Move menu creation to
the end to avoid a recursive load (bug#43116).
| -rw-r--r-- | lisp/progmodes/fortran.el | 143 |
1 files changed, 75 insertions, 68 deletions
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 3bef3986a10..707226fb2a5 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el | |||
| @@ -650,74 +650,6 @@ Used in the Fortran entry in `hs-special-modes-alist'.") | |||
| 650 | (define-key map "7" 'fortran-electric-line-number) | 650 | (define-key map "7" 'fortran-electric-line-number) |
| 651 | (define-key map "8" 'fortran-electric-line-number) | 651 | (define-key map "8" 'fortran-electric-line-number) |
| 652 | (define-key map "9" 'fortran-electric-line-number) | 652 | (define-key map "9" 'fortran-electric-line-number) |
| 653 | |||
| 654 | (easy-menu-define fortran-menu map "Menu for Fortran mode." | ||
| 655 | `("Fortran" | ||
| 656 | ["Manual" (info "(emacs)Fortran") :active t | ||
| 657 | :help "Read the Emacs manual chapter on Fortran mode"] | ||
| 658 | ("Customization" | ||
| 659 | ,(custom-menu-create 'fortran) | ||
| 660 | ;; FIXME useless? | ||
| 661 | ["Set" Custom-set :active t | ||
| 662 | :help "Set current value of all edited settings in the buffer"] | ||
| 663 | ["Save" Custom-save :active t | ||
| 664 | :help "Set and save all edited settings"] | ||
| 665 | ["Reset to Current" Custom-reset-current :active t | ||
| 666 | :help "Reset all edited settings to current"] | ||
| 667 | ["Reset to Saved" Custom-reset-saved :active t | ||
| 668 | :help "Reset all edited or set settings to saved"] | ||
| 669 | ["Reset to Standard Settings" Custom-reset-standard :active t | ||
| 670 | :help "Erase all customizations in buffer"] | ||
| 671 | ) | ||
| 672 | "--" | ||
| 673 | ["Comment Region" fortran-comment-region mark-active] | ||
| 674 | ["Uncomment Region" | ||
| 675 | (fortran-comment-region (region-beginning) (region-end) 1) | ||
| 676 | mark-active] | ||
| 677 | ["Indent Region" indent-region mark-active] | ||
| 678 | ["Indent Subprogram" fortran-indent-subprogram t] | ||
| 679 | "--" | ||
| 680 | ["Beginning of Subprogram" fortran-beginning-of-subprogram :active t | ||
| 681 | :help "Move point to the start of the current subprogram"] | ||
| 682 | ["End of Subprogram" fortran-end-of-subprogram :active t | ||
| 683 | :help "Move point to the end of the current subprogram"] | ||
| 684 | ("Mark" | ||
| 685 | :help "Mark a region of code" | ||
| 686 | ["Subprogram" mark-defun t] | ||
| 687 | ["IF Block" fortran-mark-if t] | ||
| 688 | ["DO Block" fortran-mark-do t] | ||
| 689 | ) | ||
| 690 | ["Narrow to Subprogram" narrow-to-defun t] | ||
| 691 | ["Widen" widen t] | ||
| 692 | "--" | ||
| 693 | ["Temporary Column Ruler" fortran-column-ruler :active t | ||
| 694 | :help "Briefly display Fortran column numbers"] | ||
| 695 | ;; May not be '72', depending on fortran-line-length, but this | ||
| 696 | ;; seems ok for a menu item. | ||
| 697 | ["72-column Window" fortran-window-create :active t | ||
| 698 | :help "Set window width to Fortran line length"] | ||
| 699 | ["Full Width Window" | ||
| 700 | (enlarge-window-horizontally (- (frame-width) (window-width))) | ||
| 701 | :active (not (window-full-width-p)) | ||
| 702 | :help "Make window full width"] | ||
| 703 | ["Momentary 72-Column Window" fortran-window-create-momentarily | ||
| 704 | :active t :help "Briefly set window width to Fortran line length"] | ||
| 705 | "--" | ||
| 706 | ["Break Line at Point" fortran-split-line :active t | ||
| 707 | :help "Break the current line at point"] | ||
| 708 | ["Join Line" fortran-join-line :active t | ||
| 709 | :help "Join the current line to the previous one"] | ||
| 710 | ["Fill Statement/Comment" fill-paragraph t] | ||
| 711 | "--" | ||
| 712 | ["Toggle Auto Fill" auto-fill-mode :selected auto-fill-function | ||
| 713 | :style toggle | ||
| 714 | :help "Automatically fill text while typing in this buffer"] | ||
| 715 | ["Toggle Abbrev Mode" abbrev-mode :selected abbrev-mode | ||
| 716 | :style toggle :help "Expand abbreviations while typing in this buffer"] | ||
| 717 | ["Add Imenu Menu" imenu-add-menubar-index | ||
| 718 | :active (not (lookup-key (current-local-map) [menu-bar index])) | ||
| 719 | :included (fboundp 'imenu-add-to-menubar) | ||
| 720 | :help "Add an index menu to the menu-bar"])) | ||
| 721 | map) | 653 | map) |
| 722 | "Keymap used in Fortran mode.") | 654 | "Keymap used in Fortran mode.") |
| 723 | 655 | ||
| @@ -2209,6 +2141,81 @@ arg DO-SPACE prevents stripping the whitespace." | |||
| 2209 | (point))))) | 2141 | (point))))) |
| 2210 | "main")))) | 2142 | "main")))) |
| 2211 | 2143 | ||
| 2144 | ;; The menu is defined at the end because `custom-menu-create' is | ||
| 2145 | ;; called at load time and will result in (recursively) loading this | ||
| 2146 | ;; file otherwise. | ||
| 2147 | (easy-menu-define fortran-menu fortran-mode-map "Menu for Fortran mode." | ||
| 2148 | `("Fortran" | ||
| 2149 | ["Manual" (info "(emacs)Fortran") :active t | ||
| 2150 | :help "Read the Emacs manual chapter on Fortran mode"] | ||
| 2151 | ("Customization" | ||
| 2152 | ,(progn | ||
| 2153 | ;; Tell the byte compiler that `features' is lexical. | ||
| 2154 | (with-no-warnings (defvar features)) | ||
| 2155 | (let ((features (cons 'fortran features))) | ||
| 2156 | (custom-menu-create 'fortran))) | ||
| 2157 | ;; FIXME useless? | ||
| 2158 | ["Set" Custom-set :active t | ||
| 2159 | :help "Set current value of all edited settings in the buffer"] | ||
| 2160 | ["Save" Custom-save :active t | ||
| 2161 | :help "Set and save all edited settings"] | ||
| 2162 | ["Reset to Current" Custom-reset-current :active t | ||
| 2163 | :help "Reset all edited settings to current"] | ||
| 2164 | ["Reset to Saved" Custom-reset-saved :active t | ||
| 2165 | :help "Reset all edited or set settings to saved"] | ||
| 2166 | ["Reset to Standard Settings" Custom-reset-standard :active t | ||
| 2167 | :help "Erase all customizations in buffer"] | ||
| 2168 | ) | ||
| 2169 | "--" | ||
| 2170 | ["Comment Region" fortran-comment-region mark-active] | ||
| 2171 | ["Uncomment Region" | ||
| 2172 | (fortran-comment-region (region-beginning) (region-end) 1) | ||
| 2173 | mark-active] | ||
| 2174 | ["Indent Region" indent-region mark-active] | ||
| 2175 | ["Indent Subprogram" fortran-indent-subprogram t] | ||
| 2176 | "--" | ||
| 2177 | ["Beginning of Subprogram" fortran-beginning-of-subprogram :active t | ||
| 2178 | :help "Move point to the start of the current subprogram"] | ||
| 2179 | ["End of Subprogram" fortran-end-of-subprogram :active t | ||
| 2180 | :help "Move point to the end of the current subprogram"] | ||
| 2181 | ("Mark" | ||
| 2182 | :help "Mark a region of code" | ||
| 2183 | ["Subprogram" mark-defun t] | ||
| 2184 | ["IF Block" fortran-mark-if t] | ||
| 2185 | ["DO Block" fortran-mark-do t] | ||
| 2186 | ) | ||
| 2187 | ["Narrow to Subprogram" narrow-to-defun t] | ||
| 2188 | ["Widen" widen t] | ||
| 2189 | "--" | ||
| 2190 | ["Temporary Column Ruler" fortran-column-ruler :active t | ||
| 2191 | :help "Briefly display Fortran column numbers"] | ||
| 2192 | ;; May not be '72', depending on fortran-line-length, but this | ||
| 2193 | ;; seems ok for a menu item. | ||
| 2194 | ["72-column Window" fortran-window-create :active t | ||
| 2195 | :help "Set window width to Fortran line length"] | ||
| 2196 | ["Full Width Window" | ||
| 2197 | (enlarge-window-horizontally (- (frame-width) (window-width))) | ||
| 2198 | :active (not (window-full-width-p)) | ||
| 2199 | :help "Make window full width"] | ||
| 2200 | ["Momentary 72-Column Window" fortran-window-create-momentarily | ||
| 2201 | :active t :help "Briefly set window width to Fortran line length"] | ||
| 2202 | "--" | ||
| 2203 | ["Break Line at Point" fortran-split-line :active t | ||
| 2204 | :help "Break the current line at point"] | ||
| 2205 | ["Join Line" fortran-join-line :active t | ||
| 2206 | :help "Join the current line to the previous one"] | ||
| 2207 | ["Fill Statement/Comment" fill-paragraph t] | ||
| 2208 | "--" | ||
| 2209 | ["Toggle Auto Fill" auto-fill-mode :selected auto-fill-function | ||
| 2210 | :style toggle | ||
| 2211 | :help "Automatically fill text while typing in this buffer"] | ||
| 2212 | ["Toggle Abbrev Mode" abbrev-mode :selected abbrev-mode | ||
| 2213 | :style toggle :help "Expand abbreviations while typing in this buffer"] | ||
| 2214 | ["Add Imenu Menu" imenu-add-menubar-index | ||
| 2215 | :active (not (lookup-key (current-local-map) [menu-bar index])) | ||
| 2216 | :included (fboundp 'imenu-add-to-menubar) | ||
| 2217 | :help "Add an index menu to the menu-bar"])) | ||
| 2218 | |||
| 2212 | (provide 'fortran) | 2219 | (provide 'fortran) |
| 2213 | 2220 | ||
| 2214 | ;;; fortran.el ends here | 2221 | ;;; fortran.el ends here |