emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Org mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer
Date: Wed, 14 Aug 2024 10:04:52 +0800	[thread overview]
Message-ID: <CAL1eYuK5Nc0br3bX0fHU4e=wGd=MmmDPzKYC6VZMUoM6soqQ4Q@mail.gmail.com> (raw)
In-Reply-To: <87o75yhwnu.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 3145 bytes --]

I agree with your patch solution. I have tested fine. Thanks for your
re-write.

I have an idea, would you like to add an function in bellowing:

#+begin_src emacs-lisp
(defun org-toggle-inline-images-in-results ()
  "Toggle inline images in babel source block results."
  (save-excursion
    ;; [C-c C-v C-o] `org-babel-open-src-block-result'
    (let ((begin (org-babel-where-is-src-block-result))
          (end (progn
                 (end-of-line)
                 (skip-chars-forward " \r\t\n")
                 (looking-at org-link-bracket-re)
                 ;; (org-babel-read-result)
                 (point))))
      (org-toggle-inline-images-command nil begin end))))

(add-hook 'org-babel-after-execute-hook
'org-toggle-inline-images-in-results)
#+end_src

WDYT? after all I originally propose this patch for this purpose to
improve the babel result inline image toggle displaying performance.


[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Mon, Aug 12, 2024 at 6:17 PM Ihor Radchenko <yantar92@posteo.net> wrote:

> "Christopher M. Miles" <numbchild@gmail.com> writes:
>
> >> What about the following treatment of ARG:
> >>
> >> 1. No argument, no region selected :: toggle (display or hide dwim)
> images in current section
> >> 2. No argument, region selected: toggle images in region
> >> 3. C-u argument :: toggle images in the whole buffer
> >> 4. C-u C-u argument, no region selected :: unconditionally hide images
> in the buffer
> >> 5. M-1 argument, no region selected :: display images in current
> section with INCLUDE-LINKED
> >> 6. M-1 argument, region selected :: ... in region ...
> >> 7. M-11 argument :: ... in the whole buffer ...
> >> 8. Any other argument :: treat as INCLUDE-LINKED = t
> >>
> >> And please document all the new arguments in the manual and
> etc/ORG-NEWS file.
> >
> > I followed you upper 8 conditions to re-write my patch.
> > Except the 8. condition I'm not sure I understand correctly.
> > And I extend 1. condition to support the inline image link at point
> toggle displaying.
> > ...
>
> I do not like the code repetitions in the patch and relying upon
> `use-region-p' even for non-interactive use.
>
> I am attaching a complete rewrite of your idea.
> Please let me know if my patch does everything you want to include into
> the command.
>
> Note that I went with a new idea of introducing a branch new function
> instead of changing `org-toggle-inline-images'.  This way, existing
> users of `org-toggle-inline-images' will not be affected at all.  We are
> just changing the default C-c C-x C-v binding.  This way, the breakage
> is a little as possible.
>
>
> --
> 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>
>

[-- Attachment #2: Type: text/html, Size: 4549 bytes --]

  reply	other threads:[~2024-08-14  2:06 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15  3:28 [PATCH] add a function to only refresh inline images under current headline instead of global buffer Christopher M. Miles
2023-05-15 11:08 ` Ihor Radchenko
2023-05-15 13:01   ` Christopher M. Miles
2023-05-15 14:00   ` [PATCH v2] " Christopher M. Miles
2023-05-16  9:17     ` Ihor Radchenko
2023-05-16 12:18       ` Christopher M. Miles
2023-07-24 11:25         ` Ihor Radchenko
2023-08-01  4:40           ` [PATCH v3] " Christopher M. Miles
2023-08-01  8:04             ` Ihor Radchenko
2023-08-01 12:17               ` [PATCH v3.1] " Christopher M. Miles
2023-08-01 14:09                 ` Ihor Radchenko
2023-08-01 15:22                   ` Christopher M. Miles
2023-08-01 15:46                   ` Christopher M. Miles
2023-08-02 16:08                     ` Ihor Radchenko
2023-08-04  6:30                       ` Christopher M. Miles
2023-08-02  7:26                 ` Ihor Radchenko
2023-08-02 15:44                   ` Christopher M. Miles
2023-08-04  8:20                     ` Ihor Radchenko
2023-08-05  5:28                       ` [PATCH v3.2] " Christopher M. Miles
2024-07-22 10:46                         ` Ihor Radchenko
2024-08-01 22:58                           ` [PATCH v4.0] " stardiviner
     [not found]                           ` <66a8b73b.170a0220.383476.996e@mx.google.com>
2024-08-12 10:18                             ` Ihor Radchenko
2024-08-14  2:04                               ` stardiviner [this message]
2024-08-18 10:27                                 ` Ihor Radchenko
2024-08-20  2:02                                   ` Karthik Chikmagalur
2024-08-20 15:43                                     ` Karthik Chikmagalur
2024-08-20 18:19                                       ` Ihor Radchenko
2024-08-20 19:46                                         ` Karthik Chikmagalur
2024-08-22 13:19                                           ` Ihor Radchenko
2024-08-23  6:04                                             ` Karthik Chikmagalur
2024-08-23 23:36                                             ` [PATCH v1] Inline image display as part of a new org-link-preview system Karthik Chikmagalur
2024-08-24  1:00                                               ` Karthik Chikmagalur
2024-08-31 14:22                                               ` Ihor Radchenko
2024-08-31 16:41                                                 ` Karthik Chikmagalur
2024-08-31 16:53                                                   ` Ihor Radchenko
2024-08-31 22:37                                                     ` [PATCH v2] " Karthik Chikmagalur
2024-09-01 13:06                                                       ` Ihor Radchenko
2024-09-02 20:13                                                         ` [PATCH v3] " Karthik Chikmagalur
2024-09-08  7:43                                                           ` Ihor Radchenko
2024-09-09  3:21                                                             ` Karthik Chikmagalur
2024-09-09  6:06                                                               ` Ihor Radchenko
2024-09-09  6:30                                                                 ` Karthik Chikmagalur
2024-09-09 16:47                                                                   ` Ihor Radchenko
2024-09-09 19:14                                                                     ` Karthik Chikmagalur
2024-09-10 16:57                                                                       ` Ihor Radchenko
2024-09-10 19:53                                                                         ` Karthik Chikmagalur
2024-09-15  7:51                                                                           ` Ihor Radchenko
2024-09-09 21:45                                                                 ` Karthik Chikmagalur
2024-09-10 16:58                                                                   ` Ihor Radchenko
2024-09-10 17:38                                                                     ` Karthik Chikmagalur
2024-09-10 18:34                                                                       ` Ihor Radchenko
2024-09-10 19:43                                                             ` Karthik Chikmagalur
2024-09-15  8:12                                                               ` Ihor Radchenko
2024-09-15 20:50                                                                 ` Karthik Chikmagalur
2024-09-15 21:57                                                                 ` [PATCH v4] " Karthik Chikmagalur
2024-08-18 10:34                                 ` [FR] Automatically display images in resutls of evaluation (was: [PATCH v4.0] Re: [PATCH] add a function to only refresh inline images under current headline instead of global buffer) Ihor Radchenko
     [not found]                                   ` <66c54dfc.a70a0220.3c823a.2899@mx.google.com>
2024-08-22 13:06                                     ` [FR] Automatically display images in resutls of evaluation Ihor Radchenko
     [not found]                                       ` <66c89411.170a0220.3255c1.0cd5@mx.google.com>
     [not found]                                         ` <87zfor7b04.fsf@localhost>
     [not found]                                           ` <CAL1eYuLOsaS43ahueN4uWiCn+Ykp=p_-t9dzAypKdy1en_53BQ@mail.gmail.com>
2024-09-15 13:33                                             ` [PATCH v3] " Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL1eYuK5Nc0br3bX0fHU4e=wGd=MmmDPzKYC6VZMUoM6soqQ4Q@mail.gmail.com' \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).