|
@@ -84,8 +84,16 @@ The return value is a string naming the thing at point."
|
|
|
(equal (char-after (point-at-bol)) ?*))
|
|
|
(cons "tag" nil))
|
|
|
((and (equal (char-before beg1) ?:)
|
|
|
- (not (equal (char-after (point-at-bol)) ?*)))
|
|
|
+ (not (equal (char-after (point-at-bol)) ?*))
|
|
|
+ (save-excursion
|
|
|
+ (move-beginning-of-line 1)
|
|
|
+ (skip-chars-backward "[ \t\n]")
|
|
|
+ (or (looking-back org-drawer-regexp)
|
|
|
+ (looking-back org-property-re))))
|
|
|
(cons "prop" nil))
|
|
|
+ ((and (equal (char-before beg1) ?:)
|
|
|
+ (not (equal (char-after (point-at-bol)) ?*)))
|
|
|
+ (cons "drawer" nil))
|
|
|
(t nil))))
|
|
|
|
|
|
(defun org-command-at-point ()
|
|
@@ -239,6 +247,23 @@ This needs more work, to handle headings with lots of spaces in them."
|
|
|
lst))
|
|
|
(substring pcomplete-stub 1)))
|
|
|
|
|
|
+(defun pcomplete/org-mode/drawer ()
|
|
|
+ "Complete a drawer name."
|
|
|
+ (let ((spc (save-excursion
|
|
|
+ (move-beginning-of-line 1)
|
|
|
+ (looking-at "^\\([ \t]*\\):")
|
|
|
+ (match-string 1)))
|
|
|
+ (cpllist (mapcar (lambda (x) (concat x ": ")) org-drawers)))
|
|
|
+ (pcomplete-here cpllist
|
|
|
+ (substring pcomplete-stub 1)
|
|
|
+ (unless (or (not (delete
|
|
|
+ nil
|
|
|
+ (mapcar (lambda(x)
|
|
|
+ (string-match (substring pcomplete-stub 1) x))
|
|
|
+ cpllist)))
|
|
|
+ (looking-at "[ \t]*\n.*:END:"))
|
|
|
+ (save-excursion (insert "\n" spc ":END:"))))))
|
|
|
+
|
|
|
(defun pcomplete/org-mode/block-option/src ()
|
|
|
"Complete the arguments of a begin_src block.
|
|
|
Complete a language in the first field, the header arguments and switches."
|