[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 8fae568 184/395: counsel.el (counsel-org-link
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 8fae568 184/395: counsel.el (counsel-org-link): Add |
Date: |
Thu, 25 Feb 2021 08:31:59 -0500 (EST) |
branch: externals/ivy-hydra
commit 8fae568daafdc79d4990ad739bac42ee230d3234
Author: Brice Waegeneire <brice@waegenei.re>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
counsel.el (counsel-org-link): Add
Fixes #1062
Fixes #2490
---
counsel.el | 44 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/counsel.el b/counsel.el
index eaf833a..bec4ecc 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3543,6 +3543,14 @@ otherwise continue prompting for tags."
"If non-nil, display priorities in matched `org-mode' headlines."
:type 'boolean)
+(defcustom counsel-org-headline-display-comment nil
+ "If non-nil, display COMMENT string in matched `org-mode' headlines."
+ :type 'boolean)
+
+(defcustom counsel-org-headline-display-statistics nil
+ "If non-nil, display statistics cookie in matched `org-mode' headlines."
+ :type 'boolean)
+
(declare-function org-get-heading "org")
(declare-function org-goto-marker-or-bmk "org")
(declare-function outline-next-heading "outline")
@@ -3662,11 +3670,12 @@ version. Argument values are based on the
`counsel-org-headline-display-*' user options."
(nbutlast (mapcar #'not (list counsel-org-headline-display-tags
counsel-org-headline-display-todo
- counsel-org-headline-display-priority))
+ counsel-org-headline-display-priority
+ counsel-org-headline-display-comment))
(if (if (fboundp 'func-arity)
(< (cdr (func-arity #'org-get-heading)) 3)
(version< org-version "9.1.1"))
- 1 0)))
+ 2 0)))
;;** `counsel-org-file'
(declare-function org-attach-dir "org-attach")
@@ -3884,7 +3893,28 @@ This variable has no effect unless
:history 'counsel-org-agenda-headlines-history
:caller 'counsel-org-agenda-headlines)))
-;;* Misc. Emacs
+;;** `counsel-org-link'
+(declare-function org-insert-link "ol")
+(declare-function org-id-get-create "org-id")
+
+(defun counsel-org-link-action (x)
+ "Insert a link to X."
+ (let ((id (save-excursion
+ (goto-char (cdr x))
+ (org-id-get-create))))
+ (org-insert-link nil (concat "id:" id) (car x))))
+
+;;;###autoload
+(defun counsel-org-link ()
+ "Insert a link to an headline with completion."
+ (interactive)
+ (ivy-read "Link: " (counsel-outline-candidates
+ '(:outline-title counsel-outline-title-org ))
+ :action #'counsel-org-link-action
+ :history 'counsel-org-link-history
+ :caller 'counsel-org-link))
+
+;; Misc. Emacs
;;** `counsel-mark-ring'
(defface counsel--mark-ring-highlight
'((t (:inherit highlight)))
@@ -4821,6 +4851,8 @@ TREEP is used to expand internal nodes."
(counsel-imenu)))
;;** `counsel-outline'
+(declare-function org-trim "org-macs")
+
(defcustom counsel-outline-face-style nil
"Determines how to style outline headings during completion.
@@ -4880,7 +4912,11 @@ Intended as a value for the `:outline-title' setting in
"Return title of current outline heading.
Like `counsel-outline-title' (which see), but for `org-mode'
buffers."
- (apply #'org-get-heading (counsel--org-get-heading-args)))
+ (let ((statistics-re "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]")
+ (heading (apply #'org-get-heading (counsel--org-get-heading-args))))
+ (if counsel-org-headline-display-statistics
+ heading
+ (org-trim (replace-regexp-in-string statistics-re " " heading)))))
(defun counsel-outline-title-markdown ()
"Return title of current outline heading.
- [elpa] externals/ivy-hydra 554c178 158/395: ivy.el (ivy-set-actions): Allow to override the default action using "o", (continued)
- [elpa] externals/ivy-hydra 554c178 158/395: ivy.el (ivy-set-actions): Allow to override the default action using "o", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0cff3e1 157/395: swiper.el (swiper): Add isearch-clean-overlays, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 35d015b 166/395: ivy.el (ivy-avy): Configure no-counsel-M-x, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 18d7ff9 168/395: ivy.el (ivy--set-candidates): Delete duplicates, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b9eb3c1 162/395: swiper.el (swiper--line-number): Works with ivy-mark, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ba73e45 156/395: ivy.el (ivy-read-action): Avoid ivy-read-action-ivy overwriting ivy--directory, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 328da1f 170/395: counsel.el (counsel-rg): Split command args in a more familiar way, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1c1573e 167/395: ivy.el (ivy--update-prompt): Handle auto-insert.el, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 45a3609 176/395: counsel.el (counsel-rg-base-command): Add "-M 120" by default, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0258725 175/395: counsel.el: Fix candidate splitting when eol is CR or CRLF, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8fae568 184/395: counsel.el (counsel-org-link): Add,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 9b36d9c 186/395: swiper.el (swiper-isearch): Use ivy-init-fns-alist, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 9e1513f 195/395: ivy.el (ivy--split): Don't split consecutive group brackets, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7b9b3cc 200/395: ivy.el (ivy--switch-buffer-matcher): Complete remote dirs via ":", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 829cf8a 212/395: ivy.el (ivy--done): Set ivy-text, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 95896df 221/395: Honour sentence-end-double-space in recent change, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c0a960b 216/395: ivy.el (ivy-read): Don't error on "Selecting deleted buffer", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8277a70 197/395: ivy.el (ivy-switch-buffer-transformer): Simplify, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra df41a6d 220/395: counsel.el (counsel-rg-base-command): Double the default max columns, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 51430ff 233/395: counsel.el: Fix candidate splitting when eol is CR or CRLF, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 04ca164 275/395: ivy-resume: resume buffer for counsel-grep, Basil L. Contovounesios, 2021/02/25