Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4d82c9a

Browse files
committed
(python-font-lock-keywords): merged with XEmacs 19.12 font-lock.el
value
1 parent e64bfee commit 4d82c9a

1 file changed

Lines changed: 58 additions & 50 deletions

File tree

Misc/python-mode.el

Lines changed: 58 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -163,57 +163,65 @@ equal <number>, `tab-width' is set to <number>, a message saying so is
163163
displayed in the echo area, and if `py-beep-if-tab-change' is non-nil
164164
the Emacs bell is also rung as a warning.")
165165

166-
(defvar python-font-lock-keywords
167-
(list
168-
(cons
169-
(concat
170-
"\\<\\("
171-
(mapconcat
172-
'identity
173-
'("access" "and" "break" "continue"
174-
"del" "elif" "else" "except"
175-
"exec" "finally" "for" "from"
176-
"global" "if" "import" "in"
177-
"is" "lambda" "not" "or"
178-
"pass" "print" "raise" "return"
179-
"try" "while" "def" "class"
180-
)
181-
"\\|")
182-
"\\)\\>")
183-
1)
184-
;; functions
185-
'("\\bdef\\s +\\(\\sw+\\)(" 1 font-lock-function-name-face)
186-
;; classes
187-
'("\\bclass\\s +\\(\\sw+\\)[(:]" 1 font-lock-function-name-face)
188-
)
189-
"*Additional keywords to highlight `python-mode' buffers.")
190-
191-
;; These are taken from XEmacs 19.12's font-lock.el file. I prefer
192-
;; these myself, but which do you think are better?
166+
;; These were the previous font-lock keywords, but I think I now
167+
;; prefer the ones from XEmacs 19.12's font-lock.el. I've merged the
168+
;; two into the new definition below.
169+
;;
170+
;;(defvar python-font-lock-keywords
171+
;; (list
172+
;; (cons
173+
;; (concat
174+
;; "\\<\\("
175+
;; (mapconcat
176+
;; 'identity
177+
;; '("access" "and" "break" "continue"
178+
;; "del" "elif" "else" "except"
179+
;; "exec" "finally" "for" "from"
180+
;; "global" "if" "import" "in"
181+
;; "is" "lambda" "not" "or"
182+
;; "pass" "print" "raise" "return"
183+
;; "try" "while" "def" "class"
184+
;; )
185+
;; "\\|")
186+
;; "\\)\\>")
187+
;; 1)
188+
;; ;; functions
189+
;; '("\\bdef\\s +\\(\\sw+\\)(" 1 font-lock-function-name-face)
190+
;; ;; classes
191+
;; '("\\bclass\\s +\\(\\sw+\\)[(:]" 1 font-lock-function-name-face)
192+
;; )
193+
;; "*Additional keywords to highlight `python-mode' buffers.")
194+
195+
;; These are taken from XEmacs 19.12's font-lock.el file, but have the
196+
;; more complete list of keywords from the previous definition in
197+
;; python-mode.el. There are a few other minor stylistic changes as
198+
;; well.
193199
;;
194-
;;(defconst python-font-lock-keywords
195-
;; (purecopy
196-
;; (list
197-
;; (cons (concat "\\b\\("
198-
;; (mapconcat 'identity
199-
;; '("access" "del" "from"
200-
;; "lambda" "return" "and"
201-
;; "elif" "global" "not"
202-
;; "try:" "break " "else:"
203-
;; "if" "or" "while"
204-
;; "except" "except:" "import"
205-
;; "pass" "continue" "finally:"
206-
;; "in" "print" "for"
207-
;; "is" "raise")
208-
;; "\\|")
209-
;; "\\)[ \n\t(]")
210-
;; 1)
211-
;; '("\\bclass[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
212-
;; 1 font-lock-type-face)
213-
;; '("\\bdef[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
214-
;; 1 font-lock-function-name-face)
215-
;; ))
216-
;; "Additional expressions to highlight in Python mode.")
200+
(defvar python-font-lock-keywords
201+
(list
202+
(cons (concat
203+
"\\b\\("
204+
(mapconcat
205+
'identity
206+
'("access" "and" "break" "continue"
207+
"del" "elif" "else:" "except"
208+
"except:" "exec" "finally:" "for"
209+
"from" "global" "if" "import"
210+
"in" "is" "lambda" "not"
211+
"or" "pass" "print" "raise"
212+
"return" "try:" "while"
213+
)
214+
"\\|")
215+
"\\)[ \n\t(]")
216+
1)
217+
;; classes
218+
'("\\bclass[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
219+
1 font-lock-type-face)
220+
;; functions
221+
'("\\bdef[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
222+
1 font-lock-function-name-face)
223+
)
224+
"*Additional expressions to highlight in Python mode.")
217225

218226
;; R Lindsay Todd <[email protected]> suggests these changes to the
219227
;; original keywords, which wouldn't be necessary if we go with the

0 commit comments

Comments
 (0)