Commit c942de99 authored by Fabián Ezequiel Gallina's avatar Fabián Ezequiel Gallina Committed by Fabián Ezequiel Gallina
Browse files

fixed CL related bytecompilation errors and set make-tree for imenu default

parent fc2dc7df
......@@ -1152,12 +1152,12 @@ run).
(proc-buffer-name (format "*%s*" proc-name))
(if python-shell-process-environment
(merge 'list python-shell-process-environment
(python-util-merge 'list python-shell-process-environment
process-environment 'string=)
(if python-shell-exec-path
(merge 'list python-shell-exec-path
(python-util-merge 'list python-shell-exec-path
exec-path 'string=)
(when (not (comint-check-proc proc-buffer-name))
......@@ -1956,7 +1956,7 @@ Interactively, prompt for symbol."
:group 'python
:safe 'booleanp)
(defcustom python-imenu-make-tree nil
(defcustom python-imenu-make-tree t
"Non-nil make imenu to build a tree menu.
Set to nil for speed."
:type 'boolean
......@@ -1992,7 +1992,8 @@ Argument PLAIN-INDEX is the calculated plain index used to build the tree."
(mapconcat #'identity full-element ".")
(subelement-name (car element-list))
(subelement-position (position subelement-name full-element))
(subelement-position (python-util-position
subelement-name full-element))
(subelement-path (when subelement-position
......@@ -2045,7 +2046,7 @@ This tree gets built:
Internally it uses `python-imenu-make-element-tree' to create all
branches for each element."
(setq python-imenu-index-alist nil)
(mapcar (lambda (element)
(mapc (lambda (element)
(python-imenu-make-element-tree element element index))
(mapcar (lambda (element)
(split-string (car element) "\\." t)) index))
......@@ -2194,6 +2195,29 @@ character address of the specified TYPE."
(nth 1 ppss))
(t nil))))
;;; Utility functions
;; Stolen from GNUS
(defun python-util-merge (type list1 list2 pred)
"Destructively merge lists LIST1 and LIST2 to produce a new list.
Argument TYPE is for compatibility and ignored.
Ordering of the elements is preserved according to PRED, a `less-than'
predicate on the elements."
(let ((res nil))
(while (and list1 list2)
(if (funcall pred (car list2) (car list1))
(push (pop list2) res)
(push (pop list1) res)))
(nconc (nreverse res) list1 list2)))
(defun python-util-position (item seq)
"Find the first occurrence of ITEM in SEQ.
Return the index of the matching item, or nil if not found."
(let ((member-result (member item seq)))
(when member-result
(- (length seq) (length member-result)))))
(define-derived-mode python-mode fundamental-mode "Python"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment