aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2021-01-28 21:35:34 +0100
committerStefan Kangas2021-01-28 21:35:34 +0100
commit554ec932ba37e0191df33959abaec9e1bfdaa891 (patch)
tree7a9da088da25277f3990b8054ad2986354548bff
parent11c504c9d2742cd7b19a2ed188b6545c9e86d206 (diff)
downloademacs-554ec932ba37e0191df33959abaec9e1bfdaa891.tar.gz
emacs-554ec932ba37e0191df33959abaec9e1bfdaa891.zip
Use lexical-binding in generic-x.el
* lisp/generic-x.el: Use lexical-binding. Remove redundant :groups. (generic-rul-mode-setup-function): Prefer setq-local.
-rw-r--r--lisp/generic-x.el34
1 files changed, 12 insertions, 22 deletions
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index 0063cb73b3b..be8d41bde00 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -1,4 +1,4 @@
1;;; generic-x.el --- A collection of generic modes 1;;; generic-x.el --- A collection of generic modes -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. 3;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc.
4 4
@@ -121,14 +121,12 @@
121 "If non-nil, add a hook to enter `default-generic-mode' automatically. 121 "If non-nil, add a hook to enter `default-generic-mode' automatically.
122This is done if the first few lines of a file in fundamental mode 122This is done if the first few lines of a file in fundamental mode
123start with a hash comment character." 123start with a hash comment character."
124 :group 'generic-x
125 :type 'boolean) 124 :type 'boolean)
126 125
127(defcustom generic-lines-to-scan 3 126(defcustom generic-lines-to-scan 3
128 "Number of lines that `generic-mode-find-file-hook' looks at. 127 "Number of lines that `generic-mode-find-file-hook' looks at.
129Relevant when deciding whether to enter Default-Generic mode automatically. 128Relevant when deciding whether to enter Default-Generic mode automatically.
130This variable should be set to a small positive number." 129This variable should be set to a small positive number."
131 :group 'generic-x
132 :type 'integer) 130 :type 'integer)
133 131
134(defcustom generic-find-file-regexp "^#" 132(defcustom generic-find-file-regexp "^#"
@@ -137,7 +135,6 @@ Files in fundamental mode whose first few lines contain a match
137for this regexp, should be put into Default-Generic mode instead. 135for this regexp, should be put into Default-Generic mode instead.
138The number of lines tested for the matches is specified by the 136The number of lines tested for the matches is specified by the
139value of the variable `generic-lines-to-scan', which see." 137value of the variable `generic-lines-to-scan', which see."
140 :group 'generic-x
141 :type 'regexp) 138 :type 'regexp)
142 139
143(defcustom generic-ignore-files-regexp "[Tt][Aa][Gg][Ss]\\'" 140(defcustom generic-ignore-files-regexp "[Tt][Aa][Gg][Ss]\\'"
@@ -146,7 +143,6 @@ Files whose names match this regular expression should not be put
146into Default-Generic mode, even if they have lines which match 143into Default-Generic mode, even if they have lines which match
147the regexp in `generic-find-file-regexp'. If the value is nil, 144the regexp in `generic-find-file-regexp'. If the value is nil,
148`generic-mode-find-file-hook' does not check the file names." 145`generic-mode-find-file-hook' does not check the file names."
149 :group 'generic-x
150 :type '(choice (const :tag "Don't check file names" nil) regexp)) 146 :type '(choice (const :tag "Don't check file names" nil) regexp))
151 147
152;; This generic mode is always defined 148;; This generic mode is always defined
@@ -249,7 +245,6 @@ This hook will be installed if the variable
249Each entry in the list should be a symbol. If you set this variable 245Each entry in the list should be a symbol. If you set this variable
250directly, without using customize, you must reload generic-x to put 246directly, without using customize, you must reload generic-x to put
251your changes into effect." 247your changes into effect."
252 :group 'generic-x
253 :type (let (list) 248 :type (let (list)
254 (dolist (mode 249 (dolist (mode
255 (sort (append generic-default-modes 250 (sort (append generic-default-modes
@@ -1298,19 +1293,16 @@ like an INI file. You can add this hook to `find-file-hook'."
1298 1293
1299;; here manually instead 1294;; here manually instead
1300(defun generic-rul-mode-setup-function () 1295(defun generic-rul-mode-setup-function ()
1301 (make-local-variable 'parse-sexp-ignore-comments)
1302 (make-local-variable 'comment-start)
1303 (make-local-variable 'comment-start-skip) 1296 (make-local-variable 'comment-start-skip)
1304 (make-local-variable 'comment-end)
1305 (setq imenu-generic-expression 1297 (setq imenu-generic-expression
1306 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)) 1298 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)))
1307 parse-sexp-ignore-comments t 1299 (setq-local parse-sexp-ignore-comments t
1308 comment-end "*/" 1300 comment-end "*/"
1309 comment-start "/*" 1301 comment-start "/*"
1310;;; comment-end "" 1302;;; comment-end ""
1311;;; comment-start "//" 1303;;; comment-start "//"
1312;;; comment-start-skip "" 1304;;; comment-start-skip ""
1313 ) 1305 )
1314 ;; (set-syntax-table rul-generic-mode-syntax-table) 1306 ;; (set-syntax-table rul-generic-mode-syntax-table)
1315 (setq-local font-lock-syntax-table rul-generic-mode-syntax-table)) 1307 (setq-local font-lock-syntax-table rul-generic-mode-syntax-table))
1316 1308
@@ -1460,7 +1452,7 @@ like an INI file. You can add this hook to `find-file-hook'."
1460 ":" 1452 ":"
1461 ;; Password, UID and GID 1453 ;; Password, UID and GID
1462 (mapconcat 1454 (mapconcat
1463 'identity 1455 #'identity
1464 (make-list 3 "\\([^:]+\\)") 1456 (make-list 3 "\\([^:]+\\)")
1465 ":") 1457 ":")
1466 ":" 1458 ":"
@@ -1640,8 +1632,7 @@ like an INI file. You can add this hook to `find-file-hook'."
1640 (((class color) (min-colors 88)) (:background "red1")) 1632 (((class color) (min-colors 88)) (:background "red1"))
1641 (((class color)) (:background "red")) 1633 (((class color)) (:background "red"))
1642 (t (:weight bold))) 1634 (t (:weight bold)))
1643 "Font Lock mode face used to highlight TABs." 1635 "Font Lock mode face used to highlight TABs.")
1644 :group 'generic-x)
1645 1636
1646(defface show-tabs-space 1637(defface show-tabs-space
1647 '((((class grayscale) (background light)) (:background "DimGray" :weight bold)) 1638 '((((class grayscale) (background light)) (:background "DimGray" :weight bold))
@@ -1649,8 +1640,7 @@ like an INI file. You can add this hook to `find-file-hook'."
1649 (((class color) (min-colors 88)) (:background "yellow1")) 1640 (((class color) (min-colors 88)) (:background "yellow1"))
1650 (((class color)) (:background "yellow")) 1641 (((class color)) (:background "yellow"))
1651 (t (:weight bold))) 1642 (t (:weight bold)))
1652 "Font Lock mode face used to highlight spaces." 1643 "Font Lock mode face used to highlight spaces.")
1653 :group 'generic-x)
1654 1644
1655(define-generic-mode show-tabs-generic-mode 1645(define-generic-mode show-tabs-generic-mode
1656 nil ;; no comment char 1646 nil ;; no comment char