Re: [PATCH] org-fold: (org-fold-hide-drawer-all): Make interactive

2023-10-19 Thread Ivan Necas
Oh nice, thanks!

-- Ivan

On Thu, 19 Oct 2023 at 11:32, Ihor Radchenko  wrote:

> Ivan Necas  writes:
>
> > Sometimes, I want to unfold all the drawers using `org-fold-show-all',
> > and then I want to hide them all back. I've noticed, there is a function
> > `org-fold-hide-drawer-all' does just that, but it's not marked
> > as a command, so the patch is as simple as adding `(interactive)` there,
> > as I don't see a reason it shouldn't be one.
>
> Makes sense.
> I applied an alternative version of the patch onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=13353f1fa
> Handled.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


[PATCH] org-fold: (org-fold-hide-drawer-all): Make interactive

2023-10-18 Thread Ivan Necas
Hi,

Sometimes, I want to unfold all the drawers using `org-fold-show-all',
and then I want to hide them all back. I've noticed, there is a function
`org-fold-hide-drawer-all' does just that, but it's not marked
as a command, so the patch is as simple as adding `(interactive)` there,
as I don't see a reason it shouldn't be one.

-- Ivan
From b059c1def1df57921b08b5a350f8b67148dfbc67 Mon Sep 17 00:00:00 2001
From: Ivan Necas 
Date: Wed, 18 Oct 2023 14:51:33 +0200
Subject: [PATCH] * lisp/org-fold.el (org-fold-hide-drawer-all): Make
 interactive

TINYCHANGE
---
 lisp/org-fold.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 18ccbf0bb..67a2a25a6 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -594,6 +594,7 @@ (defun org-fold-hide-block-all ()
   (org-block-map (apply-partially #'org-fold-hide-block-toggle 'hide)))
 
 (defun org-fold-hide-drawer-all ()
+  (interactive)
   "Fold all drawers in the current buffer."
   (let ((begin (point-min))
 (end (point-max)))
-- 
2.41.0



[O] PATCH: Possibility to yank target of link at point to kill ring

2019-01-11 Thread Ivan Necas
Hi,

I often need to copy target of a link to kill ring, so I decided to
write a small function to do that.
Would it make sense to pull this into org-mode directly?

Thanks for consideration and potential review.

-- Ivan
From 1f38afd4c26d2a8c6238040c6a40eb7dbd1f32ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20Ne=C4=8Das?= 
Date: Thu, 10 Jan 2019 22:21:38 +0100
Subject: [PATCH] org: Add org-yank-link-at-point

* lisp/org.el (org-yank-link-at-point): New function to yank the
  target of a link at point to kill ring.

TINYCHANGE
---
 lisp/org.el | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index ea1607d85..6d13d8c92 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9791,6 +9791,15 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 ;; Redisplay so as the new link has proper invisible characters.
 (sit-for 0)))
 
+(defun org-yank-link-at-point ()
+  "Yank target of a link at point"
+  (interactive)
+  (if (org-in-regexp org-bracket-link-regexp 1)
+  (let ((link (match-string-no-properties 1)))
+(kill-new link)
+(message "Link '%s' yanked" link))
+(user-error "No link found")))
+
 (defun org-link-try-special-completion (type)
   "If there is completion support for link type TYPE, offer it."
   (let ((fun (org-link-get-parameter type :complete)))
-- 
2.20.1



Re: [O] PATCH: Possibility to yank target of link at point to kill ring

2019-01-10 Thread Ivan Necas
I've added a test for the function as well.

-- Ivan

On Thu, 10 Jan 2019 at 22:37, Ivan Necas  wrote:
>
> Hi,
>
> I often need to copy target of a link to kill ring, so I decided to
> write a small function to do that.
> Would it make sense to pull this into org-mode directly?
>
> Thanks for consideration and potential review.
>
> -- Ivan
From 28938924eaca1c5835b12e1e92d48eaf3443c058 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivan=20Ne=C4=8Das?= 
Date: Thu, 10 Jan 2019 22:21:38 +0100
Subject: [PATCH] org: Add org-yank-link-at-point

* lisp/org.el (org-yank-link-at-point): New function to yank the
  target of a link at point to kill ring.

TINYCHANGE
---
 lisp/org.el  | 9 +
 testing/lisp/test-org.el | 9 +
 2 files changed, 18 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index ea1607d85..6d13d8c92 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9791,6 +9791,15 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 ;; Redisplay so as the new link has proper invisible characters.
 (sit-for 0)))
 
+(defun org-yank-link-at-point ()
+  "Yank target of a link at point"
+  (interactive)
+  (if (org-in-regexp org-bracket-link-regexp 1)
+  (let ((link (match-string-no-properties 1)))
+(kill-new link)
+(message "Link '%s' yanked" link))
+(user-error "No link found")))
+
 (defun org-link-try-special-completion (type)
   "If there is completion support for link type TYPE, offer it."
   (let ((fun (org-link-get-parameter type :complete)))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 976b7d8d6..82f50cf45 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -2724,6 +2724,15 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/;
 	 (equal (format "[[file:%s][file:%s]]" file file)
 	 	(org-store-link '(16
 
+(ert-deftest test-org/yank-link-at-point ()
+  "Test `org-yank-link-at-point' specifications."
+  (should
+   (equal
+"https://orgmode.org;
+(org-test-with-temp-text "[[https://orgmode.org][Link name]]"
+  (org-yank-link-at-point)
+  (current-kill 0)
+
 
 ;;; Node Properties
 
-- 
2.20.1