Skip to content

Instantly share code, notes, and snippets.

@syohex
Created October 30, 2012 14:16
Show Gist options
  • Save syohex/3980404 to your computer and use it in GitHub Desktop.
Save syohex/3980404 to your computer and use it in GitHub Desktop.
Description style for emacs-jedi
diff --git a/jedi.el b/jedi.el
index 0e66af4..8fe65e0 100644
--- a/jedi.el
+++ b/jedi.el
@@ -182,6 +182,21 @@ To make this option work, you need to use `jedi:setup' instead of
;;; AC source
+(defcustom jedi:ac-description-style 'long
+ "How to display description"
+ :type '(choice (const :tag "Long description" 'long)
+ (const :tag "Short Desctiption" 'short)
+ (const :tag "No description" nil))
+ :group 'jedi)
+
+(defun jedi:ac-format-description (desc)
+ (case jedi:ac-description-style
+ (long desc)
+ (short (if (string-match "\\(<[^<:]+:[^>]+>\\)" desc)
+ (match-string 1 desc)
+ desc))
+ (otherwise nil)))
+
(defun jedi:ac-direct-matches ()
(mapcar
(lambda (x)
@@ -190,7 +205,7 @@ To make this option work, you need to use `jedi:setup' instead of
(popup-make-item word
:symbol symbol
:document (unless (equal doc "") doc)
- :summary description)))
+ :summary (jedi:ac-format-description description))))
jedi:complete-reply))
(defun jedi:ac-direct-prefix ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment