* Adding new package org-menu to nongnu elpa @ 2024-11-14 13:01 Jan Rehders 2024-11-15 13:45 ` Philip Kaludercic ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Jan Rehders @ 2024-11-14 13:01 UTC (permalink / raw) To: emacs-devel [-- Attachment #1: Type: text/plain, Size: 173 bytes --] Hello, I’d like to offer my package org-menu to be included in nongnu elpa. I believe it has enough users to warrant making it easier to install Kind regards, Jan [-- Attachment #2: 0001-elpa-packages-org-menu-New-package.patch --] [-- Type: application/octet-stream, Size: 737 bytes --] From 5e752326b40faaf47122188401fa233ed64c0287 Mon Sep 17 00:00:00 2001 From: Jan Rehders <nospam@sheijk.net> Date: Thu, 14 Nov 2024 21:55:32 +0900 Subject: [PATCH] elpa-packages (org-menu): New package --- elpa-packages | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elpa-packages b/elpa-packages index 86d753c8da..eb084787e3 100644 --- a/elpa-packages +++ b/elpa-packages @@ -600,6 +600,8 @@ :news "CHANGELOG" :ignored-files (".github" ".travis.yml" "Makefile" "org-journal.svg" "tests")) + (org-menu :url "https://github.com/sheijk/org-menu/") + (org-mime :url "https://github.com/org-mime/org-mime.git" :ignored-files (".travis.yml" "Makefile" "screenshot.png" "test")) -- 2.46.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Adding new package org-menu to nongnu elpa 2024-11-14 13:01 Adding new package org-menu to nongnu elpa Jan Rehders @ 2024-11-15 13:45 ` Philip Kaludercic 2024-11-15 16:20 ` Jan Rehders 2024-11-16 6:30 ` Adam Porter 2024-11-17 4:38 ` Richard Stallman 2 siblings, 1 reply; 7+ messages in thread From: Philip Kaludercic @ 2024-11-15 13:45 UTC (permalink / raw) To: Jan Rehders; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 359 bytes --] Jan Rehders <jan@sheijk.net> writes: > Hello, Hi, > I’d like to offer my package org-menu to be included in nongnu elpa. I believe it has enough users to warrant making it easier to install Popularity is no precondition for a package to be added to NonGNU ELPA. We can add the package, just consider the following comments and suggestions: [-- Attachment #2: Type: text/plain, Size: 8717 bytes --] diff --git a/org-menu.el b/org-menu.el index df82c18..f4f5066 100644 --- a/org-menu.el +++ b/org-menu.el @@ -1,6 +1,6 @@ -;;; org-menu.el --- A discoverable menu for org-mode using transient -*- lexical-binding: t; coding: utf-8 -*- +;;; org-menu.el --- A discoverable menu for org-mode using transient -*- lexical-binding: t -*- ;; -;; Copyright 2021 Jan Rehders +;; Copyright 2021 Jan Rehders ;; ;; Author: Jan Rehders <nospam@sheijk.net> ;; Version: 0.1alpha @@ -23,19 +23,19 @@ ;; Boston, MA 02111-1307, USA. ;; ;;; Commentary: -;; -;; Usage: -;; + +;;;; Usage: + ;; Add this to your ~/.emacs to bind the menu to `C-c m': ;; ;; (with-eval-after-load 'org ;; (require 'org-menu) ;; not needed if installing by package manager -;; (define-key org-mode-map (kbd "C-c m") 'org-menu)) +;; (define-key org-mode-map (kbd "C-c m") #'org-menu)) ;; ;; The menu should be pretty self-explanatory. It is context dependent and ;; offers different commands for headlines, tables, timestamps, etc. ;; The task menu provides entry points for task that work from anywhere. -;; + ;;; Code: (require 'org) @@ -52,27 +52,23 @@ Use this if you prefer to be consistent with magit. It will also change some other bindings to use Q instead of q." - :group 'org-menu :type 'boolean) (defcustom org-menu-global-toc-depth 10 "The number of heading levels to show when displaying the global content." - :group 'org-menu - :type 'integer) + :type 'natnum) -(defcustom org-menu-expand-snippet-function 'org-menu-expand-snippet-default +(defcustom org-menu-expand-snippet-function #'org-menu-expand-snippet-default "The function used to expand a snippet. See `org-menu-expand-snippet-default' for a list of snippet ids which need to be supported. `org-menu-expand-snippet-yasnippet' shows how to invoke snippets." - :group 'org-menu :type 'function) (defun org-menu-show-columns-view-options-p () "Return whether `org-columns' mode is active." - (and (boundp 'org-columns-overlays) - (not (null org-columns-overlays)))) + (bound-and-true-p org-columns-overlays)) (defun org-menu-show-heading-options-p () "Whether to show commands operating on headings." @@ -109,8 +105,7 @@ Conditions have been adapted from `org-insert-link'" (unless (org-menu-show-columns-view-options-p) (or ;; Use variable from org-compat to support Emacs 26 - ;; this produces a warning in newer Emacs which we can't avoid - (org-in-regexp org-bracket-link-regexp 1) + (org-in-regexp (symbol-value 'org-bracket-link-regexp) 1) (when (boundp 'org-link-angle-re) (org-in-regexp org-link-angle-re)) (when (boundp 'org-link-plain-re) @@ -135,7 +130,7 @@ true the items will only be added if on a heading. `CYCLE-FUNCTION' is the function to be used to cycle visibility of current element." (setq cycle-function (or cycle-function #'org-cycle)) `(["Navigate" - ,@(when check-for-heading '(:if org-menu-show-heading-options-p)) + ,@(and check-for-heading '(:if org-menu-show-heading-options-p)) ("p" "prev" org-previous-visible-heading :transient t) ("n" "next" org-next-visible-heading :transient t) ("c" "cycle" ,cycle-function :transient t) @@ -164,30 +159,30 @@ function to be used to cycle visibility of current element." #+attr_org: :width 400px [[file:plot.svg]] ")) - (_ (insert (format "unknown snippet type %s" snippet-id))))) + (_ (insert (format "unknown snippet type %s" snippet-id))))) ;or use `pcase-exhaustive'? -(autoload 'yas-expand-snippet "yasnippet") -(autoload 'yas-expand-from-trigger-key "yasnippet") +;; You are require'ing yasnippet anyway, so there is no need to mess with autoloads +(declare-function yas-expand-snippet "yasnippet" (snippet &optional start end expand-env)) +(declare-function yas-expand-from-trigger-key "yasnippet" (&optional field)) (defun org-menu-expand-snippet-yasnippet (snippet-id) "Expand a yasnippet for each `SNIPPET-ID'." - (if (not (require 'yasnippet nil 'noerror)) - (message "error: yasnippet not installed, could not expand %s" snippet-id) - - (pcase snippet-id - ('block - (insert "beg") - (yas-expand-from-trigger-key)) - ('option - (insert "opt") - (yas-expand-from-trigger-key)) - ('subscript - (yas-expand-snippet "${1:text}_{${2:sub}}")) - ('superscript - (yas-expand-snippet "${1:text}^{${2:super}}")) - ('plot - (yas-expand-snippet - "#+plot: type:${1:2d} file:\"${2:plot.svg}\" + (unless (require 'yasnippet nil 'noerror) + (error "Yasnippet not installed, could not expand %s" snippet-id)) + (pcase snippet-id + ('block + (insert "beg") + (yas-expand-from-trigger-key)) + ('option + (insert "opt") + (yas-expand-from-trigger-key)) + ('subscript + (yas-expand-snippet "${1:text}_{${2:sub}}")) + ('superscript + (yas-expand-snippet "${1:text}^{${2:super}}")) + ('plot + (yas-expand-snippet + "#+plot: type:${1:2d} file:\"${2:plot.svg}\" | A | B | |---+----| | 1 | 10 | @@ -197,8 +192,8 @@ function to be used to cycle visibility of current element." #+attr_org: :width ${3:400px} [[file:$2]] ")) - (_ - (insert (format "unknown snippet type %s" snippet-id)))))) + (_ + (insert (format "unknown snippet type %s" snippet-id))))) ;; If yasnippet gets loaded it will be used automatically (with-eval-after-load 'yasnippet @@ -214,7 +209,7 @@ function to be used to cycle visibility of current element." (interactive) (save-excursion (outline-hide-subtree) - (org-show-children 4) + (org-show-children 4) ;there is an obsoletion warning here! (org-goto-first-child) (org-reveal '(4)))) @@ -541,7 +536,6 @@ Named `NAME' with `DEFINITION'." If region is active it will be surrounded by `LEFT' and `RIGHT' and the point will be at end of region. Will add spaces before/after text if `SURROUND-WHITESPACE' is true and it's needed." - (let ((start (point)) (end (point))) (when (region-active-p) @@ -549,7 +543,7 @@ the point will be at end of region. Will add spaces before/after text if end (region-end)) (deactivate-mark)) (when (> start end) - ;; swap variables w/o importing cl-lib + ;; swap variables w/o importing cl-lib (this wouldn't be that much of an issue, as org already uses cl-lib...) (setq start (prog1 end (setq end start)))) (goto-char start) @@ -582,14 +576,17 @@ the point will be at end of region. Will add spaces before/after text if (defun org-menu-toggle-nbspace () "Will remove non-breaking space before/after point or insert it if none found." + ;; ^ + ;; Non-breaking or zero-width space? \u200b is zero-width (used below) (interactive) - (cond - ((looking-back "") - (backward-delete-char 1)) - ((looking-at "") - (delete-char 1)) - (t - (insert "\u200b")))) + (let ((zww (eval-when-compile (string (char-from-name "ZERO WIDTH SPACE"))))) + (save-excursion + ;; By moving back first, we will avoid just removing the space + ;; before /or/ after as handled by the cond expression. + (skip-chars-backward zww) + (if (looking-at (rx (+ (literal zww)))) + (replace-match "") + (insert zww))))) (defun org-menu-text-format-items (check-for-table) "Items to format text. @@ -704,12 +701,13 @@ Will add an ':if org-menu-show-text-options-p' criteria if (interactive) (org-columns t)) +;; Can you explain why you are copying code org-colview.el? It is not +;; clear to me why you don't try to call it directly. +(declare-function org-agenda-do-context-action ()) (defun org-menu-columns-next () "Move into the next row when org-columns is active. -Code copied from lambda in org-colview.el after - (org-defkey org-columns-map [down] -" +Code copied from lambda in org-colview.el from `org-columns-map'." (interactive) (let ((col (current-column))) (beginning-of-line 2) @@ -805,7 +803,7 @@ Code copied from lambda in org-colview.el after (transient-insert-suffix 'org-menu-archive (list 0) `["Archive" - ,@(org-menu-heading-navigate-items nil #'org-force-cycle-archived) + ,@(org-menu-heading-navigate-items nil #'org-force-cycle-archived) ;obsoletion warning! ["Archive to" ("t" "tree" org-archive-subtree :transient t) ("s" "sibling" org-archive-to-archive-sibling :transient t) [-- Attachment #3: Type: text/plain, Size: 34 bytes --] -- Philip Kaludercic on siskin ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Adding new package org-menu to nongnu elpa 2024-11-15 13:45 ` Philip Kaludercic @ 2024-11-15 16:20 ` Jan Rehders 2024-11-16 0:54 ` Philip Kaludercic 0 siblings, 1 reply; 7+ messages in thread From: Jan Rehders @ 2024-11-15 16:20 UTC (permalink / raw) To: Philip Kaludercic; +Cc: emacs-devel Thanks for the feedback. Applied them. Some comments: > + (_ (insert (format "unknown snippet type %s" snippet-id))))) ;or use `pcase-exhaustive'? Throwing an error here now to keep the info about what snippet type was not found > +;; You are require'ing yasnippet anyway, so there is no need to mess with autoloads yasnippet should only be required dynamically if it is selected so the plugin can work without it being installed > (defun org-menu-toggle-nbspace () > "Will remove non-breaking space before/after point or insert it if none found." > + ;; ^ > + ;; Non-breaking or zero-width space? \u200b is zero-width (used below) Yes that should have been zero-width space. Fixed > +;; Can you explain why you are copying code org-colview.el? It is not > +;; clear to me why you don't try to call it directly. This code used to be in lambdas and has since been moved into top-level functions. Calling them now I’ve also changed the calls to deprecated functions you pointed out. This might break with older Emacs versions but those are supported as a best effort, only so let’s see if this fails for anyone or if compat.el handles this Thanks! ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Adding new package org-menu to nongnu elpa 2024-11-15 16:20 ` Jan Rehders @ 2024-11-16 0:54 ` Philip Kaludercic 0 siblings, 0 replies; 7+ messages in thread From: Philip Kaludercic @ 2024-11-16 0:54 UTC (permalink / raw) To: Jan Rehders; +Cc: emacs-devel Jan Rehders <jan@sheijk.net> writes: > Thanks for the feedback. Applied them. Some comments: > >> + (_ (insert (format "unknown snippet type %s" snippet-id))))) ;or use `pcase-exhaustive'? > > Throwing an error here now to keep the info about what snippet type was not found 1+ >> +;; You are require'ing yasnippet anyway, so there is no need to mess with autoloads > > yasnippet should only be required dynamically if it is selected so the plugin can work without it being installed Right, so it is wrong to autoload the function, as you do not want to assume that they are loadable. >> (defun org-menu-toggle-nbspace () >> "Will remove non-breaking space before/after point or insert it if none found." >> + ;; ^ >> + ;; Non-breaking or zero-width space? \u200b is zero-width (used below) > > Yes that should have been zero-width space. Fixed OK, btw. I remembered that you can simplify the eval-when-compile by just writing ?\N{ZERO WIDTH SPACE} . >> +;; Can you explain why you are copying code org-colview.el? It is not >> +;; clear to me why you don't try to call it directly. > > This code used to be in lambdas and has since been moved into top-level functions. Calling them now > > I’ve also changed the calls to deprecated functions you pointed > out. This might break with older Emacs versions but those are > supported as a best effort, only so let’s see if this fails for anyone > or if compat.el handles this Compat will probably not be of much use, as these were Org-specific functions and Compat only provides core-Emacs functions. > Thanks! > -- Philip Kaludercic on siskin ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Adding new package org-menu to nongnu elpa 2024-11-14 13:01 Adding new package org-menu to nongnu elpa Jan Rehders 2024-11-15 13:45 ` Philip Kaludercic @ 2024-11-16 6:30 ` Adam Porter 2024-11-17 14:02 ` Jan Rehders 2024-11-17 4:38 ` Richard Stallman 2 siblings, 1 reply; 7+ messages in thread From: Adam Porter @ 2024-11-16 6:30 UTC (permalink / raw) To: jan; +Cc: emacs-devel Hello Jan, A Transient menu system for Org is definitely needed. Have you discussed this on the Org mailing list? Now that Transient is built in to Emacs, this is a feature that ought to be built in to Org. And it ought to be standardized and modularized so that it can (eventually) be expanded and adapted to all parts of Org. As well, I have a minor concern about the name: org-menu is so obviously the right name for the feature, that having it as a package on (non-) GNU ELPA would present a conflict, preventing Org from implementing the feature internally under that name. So it would seem best if you could contribute the package upstream to Org; it could be an example and foundation for this work to grow on. What do you think? --Adam ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Adding new package org-menu to nongnu elpa 2024-11-16 6:30 ` Adam Porter @ 2024-11-17 14:02 ` Jan Rehders 0 siblings, 0 replies; 7+ messages in thread From: Jan Rehders @ 2024-11-17 14:02 UTC (permalink / raw) To: emacs-devel; +Cc: Adam Porter [-- Attachment #1: Type: text/plain, Size: 1271 bytes --] Yes the name is a good point. I don’t mind renaming it but I’m not sure to what. org-transient has been proposed but that one might just have the same issue. Proposals are very welcome! I’ve written a mail to emacs-orgmode@gnu.org <mailto:emacs-orgmode@gnu.org> ("Contributing org-menu (using transient) to Orgmode?”). Lets put adding this this on hold until that discussion finishes — Jan > On 16. Nov 2024, at 15:30, Adam Porter <adam@alphapapa.net> wrote: > > Hello Jan, > > A Transient menu system for Org is definitely needed. Have you discussed this on the Org mailing list? Now that Transient is built in to Emacs, this is a feature that ought to be built in to Org. And it ought to be standardized and modularized so that it can (eventually) be expanded and adapted to all parts of Org. > > As well, I have a minor concern about the name: org-menu is so obviously the right name for the feature, that having it as a package on (non-) GNU ELPA would present a conflict, preventing Org from implementing the feature internally under that name. > > So it would seem best if you could contribute the package upstream to Org; it could be an example and foundation for this work to grow on. > > What do you think? > > --Adam [-- Attachment #2: Type: text/html, Size: 1901 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Adding new package org-menu to nongnu elpa 2024-11-14 13:01 Adding new package org-menu to nongnu elpa Jan Rehders 2024-11-15 13:45 ` Philip Kaludercic 2024-11-16 6:30 ` Adam Porter @ 2024-11-17 4:38 ` Richard Stallman 2 siblings, 0 replies; 7+ messages in thread From: Richard Stallman @ 2024-11-17 4:38 UTC (permalink / raw) To: Jan Rehders; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] We try to aim to make Emacs coherent. So when we consider adding to Emacs a package that implemnts a new feature, it isn't just a matter of how many users lke that feature. There are several things we might want to do with a new feature implemented as a eparate package: * Add it to Emacs as written. * Leave it out. * Merge the code into related parts of Emacs for better integration. * Reimplement the feature for better integration * And someimes others. Since I don't use Org mode, I don't have an opinion about what to do in this case. I'm simply reminding people to think about these options for the functionaliy of org-menu, and make a good choice. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-17 14:02 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-11-14 13:01 Adding new package org-menu to nongnu elpa Jan Rehders 2024-11-15 13:45 ` Philip Kaludercic 2024-11-15 16:20 ` Jan Rehders 2024-11-16 0:54 ` Philip Kaludercic 2024-11-16 6:30 ` Adam Porter 2024-11-17 14:02 ` Jan Rehders 2024-11-17 4:38 ` Richard Stallman
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.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).