emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110546: Merge bug fixes from CEDET u


From: David Engster
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110546: Merge bug fixes from CEDET upstream.
Date: Sun, 14 Oct 2012 21:24:16 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110546 [merge]
committer: David Engster <address@hidden>
branch nick: trunk
timestamp: Sun 2012-10-14 21:24:16 +0200
message:
  Merge bug fixes from CEDET upstream.
modified:
  lisp/cedet/ChangeLog
  lisp/cedet/cedet.el
  lisp/cedet/semantic.el
  lisp/cedet/semantic/analyze/complete.el
  lisp/cedet/semantic/complete.el
  lisp/cedet/semantic/senator.el
  lisp/cedet/semantic/wisent/python.el
=== modified file 'lisp/cedet/ChangeLog'
--- a/lisp/cedet/ChangeLog      2012-10-08 19:40:50 +0000
+++ b/lisp/cedet/ChangeLog      2012-10-14 19:24:16 +0000
@@ -1,3 +1,33 @@
+2012-10-14  David Engster  <address@hidden>
+
+       * semantic.el (semantic-error-if-unparsed): New function.  Raise
+       error if buffer was not parsed by Semantic (bug #12045).
+       (navigate-menu, edit-menu, cedet-menu-map): Enable Semantic items
+       only if buffer was parsed.  Also, replace ':active' with ':enable'
+       where necessary.
+
+       * semantic/wisent/python.el
+       (semantic-python-get-system-include-path): Use
+       `python-shell-internal-send-string' if available to query Python
+       for system paths.
+
+       * semantic/senator.el (senator-next-tag):
+       (senator-previous-tag):
+       (senator-go-to-up-reference): Use `semantic-error-if-unparsed'.
+
+       * semantic/complete.el (semantic-complete-jump-local):
+       (semantic-complete-jump):
+       (semantic-complete-jump-local-members):
+       (semantic-complete-self-insert): Use `semantic-error-if-unparsed'.
+       (semantic-complete-inline-project): Fix autoload cookie.
+
+       * semantic/analyze/complete.el
+       (semantic-analyze-possible-completions): Check if buffer was
+       parsed.  Only raise an error if function was called interactively,
+       otherwise silently return nil.
+
+       * cedet.el (cedet-menu-map): Fix copy&paste typo in menu creation.
+
 2012-10-08  David Engster  <address@hidden>>
 
        * semantic/bovine/el.el: Add `semantic-default-elisp-setup' to

=== modified file 'lisp/cedet/cedet.el'
--- a/lisp/cedet/cedet.el       2012-10-01 18:10:29 +0000
+++ b/lisp/cedet/cedet.el       2012-10-14 19:20:28 +0000
@@ -59,7 +59,7 @@
     (define-key map [navigate-menu]              'undefined)
     (define-key map [semantic-options-separator] 'undefined)
     (define-key map [global-semantic-highlight-func-mode]   'undefined)
-    (define-key map [global-semantic-highlight-func-mode]   'undefined)
+    (define-key map [global-semantic-stickyfunc-mode]   'undefined)
     (define-key map [global-semantic-decoration-mode]       'undefined)
     (define-key map [global-semantic-idle-completions-mode] 'undefined)
     (define-key map [global-semantic-idle-summary-mode]     'undefined)

=== modified file 'lisp/cedet/semantic.el'
--- a/lisp/cedet/semantic.el    2012-10-07 18:12:46 +0000
+++ b/lisp/cedet/semantic.el    2012-10-14 19:20:28 +0000
@@ -319,6 +319,11 @@
   "Return non-nil if the current buffer was set up for parsing."
   semantic-new-buffer-fcn-was-run)
 
+(defsubst semantic-error-if-unparsed ()
+  "Raise an error if current buffer was not parsed by Semantic."
+  (unless semantic-new-buffer-fcn-was-run
+    (error "Buffer was not parsed by Semantic.")))
+
 (defsubst semantic--umatched-syntax-needs-refresh-p  ()
   "Return non-nil if the unmatched syntax cache needs a refresh.
 That is, if it is dirty or if the current parse tree isn't up to date."
@@ -907,75 +912,91 @@
   ;; Edit Tags submenu:
   (define-key edit-menu [semantic-analyze-possible-completions]
     '(menu-item "List Completions" semantic-analyze-possible-completions
+               :enable (semantic-active-p)
                :help "Display a list of completions for the tag at point"))
   (define-key edit-menu [semantic-complete-analyze-inline]
     '(menu-item "Complete Tag Inline" semantic-complete-analyze-inline
+               :enable (semantic-active-p)
                :help "Display inline completion for the tag at point"))
   (define-key edit-menu [semantic-completion-separator]
     '("--"))
   (define-key edit-menu [senator-transpose-tags-down]
     '(menu-item "Transpose Tags Down" senator-transpose-tags-down
-               :active (semantic-current-tag)
+               :enable (and (semantic-active-p)
+                            (semantic-current-tag))
                :help "Transpose the current tag and the next tag"))
   (define-key edit-menu [senator-transpose-tags-up]
     '(menu-item "Transpose Tags Up" senator-transpose-tags-up
-               :active (semantic-current-tag)
+               :enable (and (semantic-active-p)
+                            (semantic-current-tag))
                :help "Transpose the current tag and the previous tag"))
   (define-key edit-menu [semantic-edit-separator]
     '("--"))
   (define-key edit-menu [senator-yank-tag]
     '(menu-item "Yank Tag" senator-yank-tag
-               :active (not (ring-empty-p senator-tag-ring))
+               :enable (not (ring-empty-p senator-tag-ring))
                :help "Yank the head of the tag ring into the buffer"))
   (define-key edit-menu [senator-copy-tag-to-register]
     '(menu-item "Copy Tag To Register" senator-copy-tag-to-register
-               :active (semantic-current-tag)
+               :enable (and (semantic-active-p)
+                            (semantic-current-tag))
                :help "Yank the head of the tag ring into the buffer"))
   (define-key edit-menu [senator-copy-tag]
     '(menu-item "Copy Tag" senator-copy-tag
-               :active (semantic-current-tag)
+               :enable (and (semantic-active-p)
+                            (semantic-current-tag))
                :help "Copy the current tag to the tag ring"))
   (define-key edit-menu [senator-kill-tag]
     '(menu-item "Kill Tag" senator-kill-tag
-               :active (semantic-current-tag)
+               :enable (and (semantic-active-p)
+                            (semantic-current-tag))
                :help "Kill the current tag, and copy it to the tag ring"))
 
   ;; Navigate Tags submenu:
   (define-key navigate-menu [senator-narrow-to-defun]
     '(menu-item "Narrow to Tag" senator-narrow-to-defun
-               :active (semantic-current-tag)
+               :enable (and (semantic-active-p)
+                            (semantic-current-tag))
                :help "Narrow the buffer to the bounds of the current tag"))
   (define-key navigate-menu [semantic-narrow-to-defun-separator]
     '("--"))
   (define-key navigate-menu [semantic-symref-symbol]
     '(menu-item "Find Tag References..." semantic-symref-symbol
+               :enable (semantic-active-p)
                :help "Read a tag and list the references to it"))
   (define-key navigate-menu [semantic-complete-jump]
     '(menu-item "Find Tag Globally..." semantic-complete-jump
+               :enable (semantic-active-p)
                :help "Read a tag name and find it in the current project"))
   (define-key navigate-menu [semantic-complete-jump-local-members]
     '(menu-item "Find Local Members ..." semantic-complete-jump-local-members
+               :enable (semantic-active-p)
                :help "Read a tag name and find a local member with that name"))
   (define-key navigate-menu [semantic-complete-jump-local]
     '(menu-item "Find Tag in This Buffer..." semantic-complete-jump-local
+               :enable (semantic-active-p)
                :help "Read a tag name and find it in this buffer"))
   (define-key navigate-menu [semantic-navigation-separator]
     '("--"))
   (define-key navigate-menu [senator-go-to-up-reference]
     '(menu-item "Parent Tag" senator-go-to-up-reference
+               :enable (semantic-active-p)
                :help "Navigate up one reference by tag"))
   (define-key navigate-menu [senator-next-tag]
     '(menu-item "Next Tag" senator-next-tag
+               :enable (semantic-active-p)
                :help "Go to the next tag"))
   (define-key navigate-menu [senator-previous-tag]
     '(menu-item "Previous Tag" senator-previous-tag
+               :enable (semantic-active-p)
                :help "Go to the previous tag"))
 
   ;; Top level menu items:
   (define-key cedet-menu-map [semantic-force-refresh]
     '(menu-item "Reparse Buffer" semantic-force-refresh
                :help "Force a full reparse of the current buffer"
-               :visible semantic-mode))
+               :visible semantic-mode
+               :enable (semantic-active-p)))
   (define-key cedet-menu-map [semantic-edit-menu]
     `(menu-item "Edit Tags" ,edit-menu
                :visible semantic-mode))

=== modified file 'lisp/cedet/semantic/analyze/complete.el'
--- a/lisp/cedet/semantic/analyze/complete.el   2012-01-19 07:21:25 +0000
+++ b/lisp/cedet/semantic/analyze/complete.el   2012-10-14 19:20:28 +0000
@@ -87,20 +87,25 @@
   ;; In theory, we don't need the below since the context will
   ;; do it for us.
   ;;(semantic-refresh-tags-safe)
-  (with-syntax-table semantic-lex-syntax-table
-    (let* ((context (if (semantic-analyze-context-child-p context)
-                        context
-                      (semantic-analyze-current-context context)))
-          (ans (if (not context)
-                   (error "Nothing to complete")
-                 (:override))))
-      ;; If interactive, display them.
-      (when (called-interactively-p 'any)
-       (with-output-to-temp-buffer "*Possible Completions*"
-         (semantic-analyze-princ-sequence ans "" (current-buffer)))
-       (shrink-window-if-larger-than-buffer
-        (get-buffer-window "*Possible Completions*")))
-      ans)))
+  (if (semantic-active-p)
+    (with-syntax-table semantic-lex-syntax-table
+      (let* ((context (if (semantic-analyze-context-child-p context)
+                         context
+                       (semantic-analyze-current-context context)))
+            (ans (if (not context)
+                     (error "Nothing to complete")
+                   (:override))))
+       ;; If interactive, display them.
+       (when (called-interactively-p 'any)
+         (with-output-to-temp-buffer "*Possible Completions*"
+           (semantic-analyze-princ-sequence ans "" (current-buffer)))
+         (shrink-window-if-larger-than-buffer
+          (get-buffer-window "*Possible Completions*")))
+       ans))
+    ;; Buffer was not parsed by Semantic.
+    ;; Raise error if called interactively.
+    (when (cedet-called-interactively-p 'any)
+      (error "Buffer was not parsed by Semantic."))))
 
 (defun semantic-analyze-possible-completions-default (context &optional flags)
   "Default method for producing smart completions.

=== modified file 'lisp/cedet/semantic/complete.el'
--- a/lisp/cedet/semantic/complete.el   2012-10-06 20:30:26 +0000
+++ b/lisp/cedet/semantic/complete.el   2012-10-14 19:20:28 +0000
@@ -2088,6 +2088,7 @@
 (defun semantic-complete-jump-local ()
   "Jump to a local semantic symbol."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((tag (semantic-complete-read-tag-buffer-deep "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
@@ -2101,6 +2102,7 @@
 (defun semantic-complete-jump ()
   "Jump to a semantic symbol."
   (interactive)
+  (semantic-error-if-unparsed)
   (let* ((tag (semantic-complete-read-tag-project "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
@@ -2115,6 +2117,7 @@
 (defun semantic-complete-jump-local-members ()
   "Jump to a semantic symbol."
   (interactive)
+  (semantic-error-if-unparsed)
   (let* ((tag (semantic-complete-read-tag-local-members "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (let ((start (condition-case nil (semantic-tag-start tag)
@@ -2216,7 +2219,7 @@
       (error nil))
     ))
 
-;;;;###autoload
+;;;###autoload
 (defun semantic-complete-inline-project ()
   "Perform inline completion for any symbol in the current project.
 `semantic-analyze-possible-completions' is used to determine the

=== modified file 'lisp/cedet/semantic/senator.el'
--- a/lisp/cedet/semantic/senator.el    2012-01-19 07:21:25 +0000
+++ b/lisp/cedet/semantic/senator.el    2012-10-14 19:20:28 +0000
@@ -255,6 +255,7 @@
   "Navigate to the next Semantic tag.
 Return the tag or nil if at end of buffer."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((pos (point))
         (tag (semantic-current-tag))
         where)
@@ -294,6 +295,7 @@
   "Navigate to the previous Semantic tag.
 Return the tag or nil if at beginning of buffer."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((pos (point))
         (tag (semantic-current-tag))
         where)
@@ -519,6 +521,7 @@
 is found, we can jump to it.
 Some tags such as includes have other reference features."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((result (semantic-up-reference (or tag (semantic-current-tag)))))
     (if (not result)
         (error "No up reference found")

=== modified file 'lisp/cedet/semantic/wisent/python.el'
--- a/lisp/cedet/semantic/wisent/python.el      2012-10-07 18:23:50 +0000
+++ b/lisp/cedet/semantic/wisent/python.el      2012-10-14 19:20:28 +0000
@@ -48,24 +48,15 @@
 
 (defun semantic-python-get-system-include-path ()
   "Evaluate some Python code that determines the system include path."
-  (python-proc)
-  (if python-buffer
-      (with-current-buffer python-buffer
-       (set (make-local-variable 'python-preoutput-result) nil)
-       (python-send-string
-        "import sys; print '_emacs_out ' + '\\0'.join(sys.path)")
-       (accept-process-output (python-proc) 2)
-       (if python-preoutput-result
-           (split-string python-preoutput-result "[\0\n]" t)
-         ;; Try a second, Python3k compatible shot
-         (python-send-string
-          "import sys; print('_emacs_out ' + '\\0'.join(sys.path))")
-         (accept-process-output (python-proc) 2)
-         (if python-preoutput-result
-             (split-string python-preoutput-result "[\0\n]" t)
-           (message "Timeout while querying Python for system include path.")
-           nil)))
-    (message "Python seems to be unavailable on this system.")))
+  (delq nil
+       (mapcar
+        (lambda (dir)
+          (when (file-directory-p dir)
+            dir))
+        (split-string
+         (python-shell-internal-send-string
+          "import sys;print ('\\n'.join(sys.path))")
+         "\n" t))))
 
 (defcustom-mode-local-semantic-dependency-system-include-path
   python-mode semantic-python-dependency-system-include-path


reply via email to

[Prev in Thread] Current Thread [Next in Thread]