aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier2013-09-04 23:46:34 -0400
committerStefan Monnier2013-09-04 23:46:34 -0400
commitc0458e0b21bf507b6a9273189c58a6b97efa2db2 (patch)
tree95213e4e50168354bcc87c901d98bf9976ba1db1 /lisp/progmodes/python.el
parent6c42fc3efbbf590fca00b866859fbfa13d34b70a (diff)
downloademacs-c0458e0b21bf507b6a9273189c58a6b97efa2db2.tar.gz
emacs-c0458e0b21bf507b6a9273189c58a6b97efa2db2.zip
* lisp/subr.el (pop): Use `car-safe'.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Remove hack to detect unused `pop' return value. * lisp/emacs-lisp/advice.el (defadvice): Add indent rule. * lisp/international/mule-cmds.el: Require CL. (find-coding-systems-for-charsets): Avoid add-to-list. (sanitize-coding-system-list): New function, extracted from select-safe-coding-system-interactively. (select-safe-coding-system-interactively): Use it. (read-input-method-name): Accept symbols for `default'. * lisp/progmodes/python.el (python-nav-beginning-of-block): Remove unused var `block-regexp'. (python-nav--forward-sexp): Remove unused var `re-search-fn'. (python-fill-string): Remove unused var `marker'. (python-skeleton-add-menu-items): Remove unused var `items'.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el23
1 files changed, 8 insertions, 15 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index fb2dc01c9be..be151bf8114 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1327,9 +1327,7 @@ backward to previous statement."
1327(defun python-nav-beginning-of-block () 1327(defun python-nav-beginning-of-block ()
1328 "Move to start of current block." 1328 "Move to start of current block."
1329 (interactive "^") 1329 (interactive "^")
1330 (let ((starting-pos (point)) 1330 (let ((starting-pos (point)))
1331 (block-regexp (python-rx
1332 line-start (* whitespace) block-start)))
1333 (if (progn 1331 (if (progn
1334 (python-nav-beginning-of-statement) 1332 (python-nav-beginning-of-statement)
1335 (looking-at (python-rx block-start))) 1333 (looking-at (python-rx block-start)))
@@ -1422,9 +1420,6 @@ backwards."
1422 (let* ((forward-p (if (> dir 0) 1420 (let* ((forward-p (if (> dir 0)
1423 (and (setq dir 1) t) 1421 (and (setq dir 1) t)
1424 (and (setq dir -1) nil))) 1422 (and (setq dir -1) nil)))
1425 (re-search-fn (if forward-p
1426 're-search-forward
1427 're-search-backward))
1428 (context-type (python-syntax-context-type))) 1423 (context-type (python-syntax-context-type)))
1429 (cond 1424 (cond
1430 ((memq context-type '(string comment)) 1425 ((memq context-type '(string comment))
@@ -2666,8 +2661,7 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'."
2666(defun python-fill-string (&optional justify) 2661(defun python-fill-string (&optional justify)
2667 "String fill function for `python-fill-paragraph'. 2662 "String fill function for `python-fill-paragraph'.
2668JUSTIFY should be used (if applicable) as in `fill-paragraph'." 2663JUSTIFY should be used (if applicable) as in `fill-paragraph'."
2669 (let* ((marker (point-marker)) 2664 (let* ((str-start-pos
2670 (str-start-pos
2671 (set-marker 2665 (set-marker
2672 (make-marker) 2666 (make-marker)
2673 (or (python-syntax-context 'string) 2667 (or (python-syntax-context 'string)
@@ -2733,7 +2727,7 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'."
2733 ;; Again indent only if a newline is added. 2727 ;; Again indent only if a newline is added.
2734 (indent-according-to-mode))))) t) 2728 (indent-according-to-mode))))) t)
2735 2729
2736(defun python-fill-decorator (&optional justify) 2730(defun python-fill-decorator (&optional _justify)
2737 "Decorator fill function for `python-fill-paragraph'. 2731 "Decorator fill function for `python-fill-paragraph'.
2738JUSTIFY should be used (if applicable) as in `fill-paragraph'." 2732JUSTIFY should be used (if applicable) as in `fill-paragraph'."
2739 t) 2733 t)
@@ -2895,8 +2889,7 @@ The skeleton will be bound to python-skeleton-NAME."
2895 2889
2896(defun python-skeleton-add-menu-items () 2890(defun python-skeleton-add-menu-items ()
2897 "Add menu items to Python->Skeletons menu." 2891 "Add menu items to Python->Skeletons menu."
2898 (let ((skeletons (sort python-skeleton-available 'string<)) 2892 (let ((skeletons (sort python-skeleton-available 'string<)))
2899 (items))
2900 (dolist (skeleton skeletons) 2893 (dolist (skeleton skeletons)
2901 (easy-menu-add-item 2894 (easy-menu-add-item
2902 nil '("Python" "Skeletons") 2895 nil '("Python" "Skeletons")
@@ -2984,7 +2977,7 @@ Runs COMMAND, a shell command, as if by `compile'. See
2984 (let ((process-environment (python-shell-calculate-process-environment)) 2977 (let ((process-environment (python-shell-calculate-process-environment))
2985 (exec-path (python-shell-calculate-exec-path))) 2978 (exec-path (python-shell-calculate-exec-path)))
2986 (compilation-start command nil 2979 (compilation-start command nil
2987 (lambda (mode-name) 2980 (lambda (_modename)
2988 (format python-check-buffer-name command))))) 2981 (format python-check-buffer-name command)))))
2989 2982
2990 2983
@@ -3095,7 +3088,7 @@ It must be a function with two arguments: TYPE and NAME.")
3095 "Return imenu label for parent node using TYPE and NAME." 3088 "Return imenu label for parent node using TYPE and NAME."
3096 (format "%s..." (python-imenu-format-item-label type name))) 3089 (format "%s..." (python-imenu-format-item-label type name)))
3097 3090
3098(defun python-imenu-format-parent-item-jump-label (type name) 3091(defun python-imenu-format-parent-item-jump-label (type _name)
3099 "Return imenu label for parent node jump using TYPE and NAME." 3092 "Return imenu label for parent node jump using TYPE and NAME."
3100 (if (string= type "class") 3093 (if (string= type "class")
3101 "*class definition*" 3094 "*class definition*"
@@ -3209,7 +3202,7 @@ To this:
3209 (cons name (cdar pos)) 3202 (cons name (cdar pos))
3210 (python-imenu-create-flat-index (cddr item) name)))))) 3203 (python-imenu-create-flat-index (cddr item) name))))))
3211 (or alist 3204 (or alist
3212 (let* ((fn (lambda (type name) name)) 3205 (let* ((fn (lambda (_type name) name))
3213 (python-imenu-format-item-label-function fn) 3206 (python-imenu-format-item-label-function fn)
3214 (python-imenu-format-parent-item-label-function fn) 3207 (python-imenu-format-parent-item-label-function fn)
3215 (python-imenu-format-parent-item-jump-label-function fn)) 3208 (python-imenu-format-parent-item-jump-label-function fn))
@@ -3614,7 +3607,7 @@ if that value is non-nil."
3614 3607
3615 (add-to-list 'hs-special-modes-alist 3608 (add-to-list 'hs-special-modes-alist
3616 `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" 3609 `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
3617 ,(lambda (arg) 3610 ,(lambda (_arg)
3618 (python-nav-end-of-defun)) nil)) 3611 (python-nav-end-of-defun)) nil))
3619 3612
3620 (set (make-local-variable 'mode-require-final-newline) t) 3613 (set (make-local-variable 'mode-require-final-newline) t)