Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use org-ai-on-region-or-buffer instead of org-ai-on-region #83

Open
LemonBreezes opened this issue Sep 25, 2023 · 1 comment
Open

use org-ai-on-region-or-buffer instead of org-ai-on-region #83

LemonBreezes opened this issue Sep 25, 2023 · 1 comment

Comments

@LemonBreezes
Copy link
Contributor

Hi. I'm thinking we should replace org-ai-on-region with a new command, org-ai-on-region-or-buffer which uses the entire buffer if a region is not selected.

;;;###autoload
(defun org-ai-on-buffer ()
  (interactive)
  (save-mark-and-excursion
    (mark-whole-buffer)
    (call-interactively #'org-ai-on-region)))

;;;###autoload
(defun org-ai-on-region-or-buffer ()
  (interactive)
  (if (region-active-p)
      (call-interactively #'org-ai-on-region)
    (call-interactively #'org-ai-on-buffer)))

I like the implementation above because the user can see that the entire buffer is selected for the command.

@LemonBreezes LemonBreezes changed the title org-ai-on-region-or-buffer use org-ai-on-region-or-buffer instead of org-ai-on-region Sep 25, 2023
@rksm
Copy link
Owner

rksm commented Oct 10, 2023

ok, will add that, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants