emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch to add a new org-archive hook and context info type
@ 2024-11-07  6:19 John Wiegley
  2024-11-23 16:45 ` Problem installing Org using the Emacs packaging system Alain.Cochard
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: John Wiegley @ 2024-11-07  6:19 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

The following patch adds ‘org-archive-finalize-hook’, which runs earlier than
‘org-archive-hook’ and in the destination buffer, not the original file. This
allows the context to be extended, the archived entry to be cleaned up after
inseration, maybe even encrypted or hashed to prevent changes.

I also added a new ‘ARCHIVE_OLID’ context type, which preserves the ID of the
parent the archived entry was previously under. This is because ARCHIVE_OLPATH
is not stable: it’s very possible the tree structure may change over time and
invalidate the path. But as long as the original parent is not deleted, there
stands a better chance that the original context of the archived entry can be
restored.

John

--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -144,13 +144,26 @@ information."
 	      (const :tag "Priority" priority)
 	      (const :tag "Inherited tags" itags)
 	      (const :tag "Outline path" olpath)
+	      (const :tag "Outline parent id" olid)
 	      (const :tag "Local tags" ltags)))
 
-(defvar org-archive-hook nil
+(defcustom org-archive-hook nil
   "Hook run after successfully archiving a subtree.
 Hook functions are called with point on the subtree in the
 original file.  At this stage, the subtree has been added to the
-archive location, but not yet deleted from the original file.")
+archive location, but not yet deleted from the original file."
+  :group 'org-archive
+  :type 'hook)
+
+(defcustom org-archive-finalize-hook nil
+  "Hook run after successfully archiving a subtree in final location.
+Hook functions are called with point on the subtree in the
+destination file. Compare this with `org-archive-hook', which
+runs in the original file. At this stage, the subtree has been
+added to the archive location, but not yet deleted from the
+original file."
+  :group 'org-archive
+  :type 'hook)
 
 ;;;###autoload
 (defun org-add-archive-files (files)
@@ -299,6 +312,9 @@ direct children of this heading."
 		    (olpath . ,(mapconcat #'identity
 					  (org-get-outline-path)
 					  "/"))
+                    (olid . ,(org-with-wide-buffer
+                              (and (org-up-heading-safe)
+	                           (org-entry-get (point) "ID"))))
 		    (time . ,time)
 		    (todo . ,(org-entry-get (point) "TODO")))))
 	    ;; We first only copy, in case something goes wrong
@@ -393,6 +409,7 @@ direct children of this heading."
 		     (point)
 		     (concat "ARCHIVE_" (upcase (symbol-name item)))
 		     value))))
+              (run-hooks 'org-archive-finalize-hook)
 	      ;; Save the buffer, if it is not the same buffer and
 	      ;; depending on `org-archive-subtree-save-file-p'.
 	      (unless (eq this-buffer buffer)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Problem installing Org using the Emacs packaging system
  2024-11-07  6:19 Patch to add a new org-archive hook and context info type John Wiegley
@ 2024-11-23 16:45 ` Alain.Cochard
  2024-12-16 19:08   ` Ihor Radchenko
  2024-12-18  3:24 ` Patch to add a new org-archive hook and context info type Liu Hui
  2024-12-23 17:36 ` Ihor Radchenko
  2 siblings, 1 reply; 11+ messages in thread
From: Alain.Cochard @ 2024-11-23 16:45 UTC (permalink / raw)
  To: emacs-orgmode

Hello.  An excerpt of the page 

https://orgmode.org/manual/Installation.html

is 

   Using Emacs packaging system

   Recent Emacs distributions include a packaging system which lets you
   install Elisp libraries. You can install Org from the “package menu”,
   with M-x list-packages. See Package Menu.

       Important: You need to do this in a session where no ‘.org’ file has
       been visited, i.e., where no Org built-in function have been
       loaded. Otherwise autoload Org functions will mess up the
       installation.

   To avoid interference with built-in Org mode, you can use command line:

   emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
   (package-refresh-contents) (package-upgrade 'org))"

   This approach has the advantage of isolating the upgrade process from a
   running Emacs session, ensuring that version conflicts can not arise.

I have used the emacs batch command above on a number of machines but it
always failed (see below), so I guess I am doing something wrong, but what?

Anyway, is it correct that one does not need this command to avoid the
above mentioned interferences, provided that a single Emacs session is
running, and in which no org file has been visited (.org or otherwise)?

Thanks.


NB: I of course type the emacs command on a single line of a regular
terminal.

* Fedora 40 

Linux frac.u-strasbg.fr 6.11.5-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Tue
Oct 22 19:13:11 UTC 2024 x86_64 GNU/Linux

GNU Emacs 29.4 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.42,
cairo version 1.18.0) of 2024-07-16

Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)
Mark set

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Contacting host: elpa.nongnu.org:443
Package refresh done

Error: wrong-type-argument (package-desc nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode
  0x1a9410ba93aef0d9>)) debug-early-backtrace() debug-early(error
  (wrong-type-argument package-desc nil)) package-upgrade(org) (progn
  (require 'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org)) command-line-1(("-eval" "(progn (require
  'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org))")) command-line() normal-top-level()
Wrong type argument: package-desc, nil

* Fedora 38

Linux fedora 6.8.9-100.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2
18:50:49 UTC 2024 x86_64 GNU/Linux

GNU Emacs 29.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.41,
cairo version 1.17.8) of 2024-03-25

Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/29.3/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Package refresh done

Error: wrong-type-argument (package-desc nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x1880ef4263aef0ea>))
  debug-early-backtrace()
  debug-early(error (wrong-type-argument package-desc nil))
  package-upgrade(org)
  (progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))
  command-line-1(("-eval" "(progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))"))
  command-line()
  normal-top-level()
Wrong type argument: package-desc, nil


* Another Fedora 38

Linux fruc.u-strasbg.fr 6.5.6-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri
Oct 6 19:02:35 UTC 2023 x86_64 GNU/Linux

GNU Emacs 28.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.17.8) of 2023-09-24

Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/28.3/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Failed to download ‘gnu’ archive.
Contacting host: elpa.nongnu.org:443
Package refresh done
Failed to download ‘nongnu’ archive.
Debugger entered--Lisp error: (void-function package-upgrade)
  (package-upgrade 'org)
  (progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))
  command-line-1(("-eval" "(progn (require 'package) (package-initialize) (pa..."))
  command-line()
  normal-top-level()

* Fedora 34

Linux frac 5.17.12-100.fc34.x86_64 #1 SMP PREEMPT Mon May 30 17:47:02 UTC
2022 x86_64 x86_64 x86_64 GNU/Linux

GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.30,
cairo version 1.17.4) of 2021-08-07

Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done

Symbol’s function definition is void: package-upgrade

* Debian

Linux petrelvm-lin.eost.unistra.fr 6.1.0-22-amd64 #1 SMP PREEMPT_DYNAMIC
Debian 6.1.94-1 (2024-06-21) x86_64 GNU/Linux

GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo
version 1.16.0) of 2024-06-25, modified by Debian

Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Contacting host: elpa.nongnu.org:443
Contacting host: elpa.nongnu.org:443
Package refresh done
Debugger entered--Lisp error: (void-function package-upgrade)
  (package-upgrade 'org)
  (progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))
  command-line-1(("-eval" "(progn (require 'package) (package-initialize) (pa..."))
  command-line()
  normal-top-level()

* Ubuntu

Linux loreen-tablet 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC
Wed Sep 11 15:25:05 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo
version 1.16.0) of 2022-05-31

Org mode version 9.5.2 (release_9.5.2-25-gaf6f12 @
/usr/share/emacs/28.1/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Package refresh done

Error: wrong-type-argument (package-desc nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x9d980ba93aef0ed>))
  debug-early-backtrace()
  debug-early(error (wrong-type-argument package-desc nil))
  package-upgrade(org)
  (progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))
  command-line-1(("-eval" "(progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))"))
  command-line()
  normal-top-level()
Wrong type argument: package-desc, nil

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Problem installing Org using the Emacs packaging system
@ 2024-12-08 10:57 Alain.Cochard
  2024-12-16 19:09 ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Alain.Cochard @ 2024-12-08 10:57 UTC (permalink / raw)
  To: emacs-orgmode


Hello.  About 2 weeks ago I already sent the following message.  I just
realized that I must have failed in removing all the 'In-Reply-To:' and
similar fields, so it is part of another thread.  I was thinking this might
be the reason why it was ignored and I dare submit it again.  I apologize
for the inconvenience.  Regards.

--------------

An excerpt of the page 

https://orgmode.org/manual/Installation.html

is 

   Using Emacs packaging system

   Recent Emacs distributions include a packaging system which lets you
   install Elisp libraries. You can install Org from the “package menu”,
   with M-x list-packages. See Package Menu.

       Important: You need to do this in a session where no ‘.org’ file has
       been visited, i.e., where no Org built-in function have been
       loaded. Otherwise autoload Org functions will mess up the
       installation.

   To avoid interference with built-in Org mode, you can use command line:

   emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
   (package-refresh-contents) (package-upgrade 'org))"

   This approach has the advantage of isolating the upgrade process from a
   running Emacs session, ensuring that version conflicts can not arise.

I have used the emacs batch command above on a number of machines but it
always failed (see below), so I guess I am doing something wrong, but what?

Anyway, is it correct that one does not need this command to avoid the
above mentioned interferences, provided that a single Emacs session is
running, and in which no org file has been visited (.org or otherwise)?

Thanks.


NB: I of course type the emacs command on a single line of a regular
terminal.

* Fedora 40 

Linux frac.u-strasbg.fr 6.11.5-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Tue
Oct 22 19:13:11 UTC 2024 x86_64 GNU/Linux

GNU Emacs 29.4 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.42,
cairo version 1.18.0) of 2024-07-16

Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)
Mark set

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Contacting host: elpa.nongnu.org:443
Package refresh done

Error: wrong-type-argument (package-desc nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode
  0x1a9410ba93aef0d9>)) debug-early-backtrace() debug-early(error
  (wrong-type-argument package-desc nil)) package-upgrade(org) (progn
  (require 'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org)) command-line-1(("-eval" "(progn (require
  'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org))")) command-line() normal-top-level()
Wrong type argument: package-desc, nil

* Fedora 38

Linux fedora 6.8.9-100.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2
18:50:49 UTC 2024 x86_64 GNU/Linux

GNU Emacs 29.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.41,
cairo version 1.17.8) of 2024-03-25

Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/29.3/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Package refresh done

Error: wrong-type-argument (package-desc nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode
  0x1880ef4263aef0ea>)) debug-early-backtrace() debug-early(error
  (wrong-type-argument package-desc nil)) package-upgrade(org) (progn
  (require 'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org)) command-line-1(("-eval" "(progn (require
  'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org))")) command-line() normal-top-level()
Wrong type argument: package-desc, nil


* Another Fedora 38

Linux fruc.u-strasbg.fr 6.5.6-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri
Oct 6 19:02:35 UTC 2023 x86_64 GNU/Linux

GNU Emacs 28.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.17.8) of 2023-09-24

Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/28.3/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Failed to download ‘gnu’ archive.
Contacting host: elpa.nongnu.org:443
Package refresh done
Failed to download ‘nongnu’ archive.
Debugger entered--Lisp error: (void-function package-upgrade)
  (package-upgrade 'org) (progn (require 'package)
  (package-initialize) (package-refresh-contents) (package-upgrade
  'org)) command-line-1(("-eval" "(progn (require 'package)
  (package-initialize) (pa..."))  command-line() normal-top-level()

* Fedora 34

Linux frac 5.17.12-100.fc34.x86_64 #1 SMP PREEMPT Mon May 30 17:47:02 UTC
2022 x86_64 x86_64 x86_64 GNU/Linux

GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.30,
cairo version 1.17.4) of 2021-08-07

Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done

Symbol’s function definition is void: package-upgrade

* Debian

Linux petrelvm-lin.eost.unistra.fr 6.1.0-22-amd64 #1 SMP PREEMPT_DYNAMIC
Debian 6.1.94-1 (2024-06-21) x86_64 GNU/Linux

GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo
version 1.16.0) of 2024-06-25, modified by Debian

Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Contacting host: elpa.nongnu.org:443
Contacting host: elpa.nongnu.org:443
Package refresh done
Debugger entered--Lisp error: (void-function package-upgrade)
  (package-upgrade 'org) (progn (require 'package)
  (package-initialize) (package-refresh-contents) (package-upgrade
  'org)) command-line-1(("-eval" "(progn (require 'package)
  (package-initialize) (pa..."))  command-line() normal-top-level()

* Ubuntu

Linux loreen-tablet 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC
Wed Sep 11 15:25:05 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo
version 1.16.0) of 2022-05-31

Org mode version 9.5.2 (release_9.5.2-25-gaf6f12 @
/usr/share/emacs/28.1/lisp/org/)

$ emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
(package-refresh-contents) (package-upgrade 'org))"

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Package refresh done
Contacting host: elpa.nongnu.org:443
Package refresh done

Error: wrong-type-argument (package-desc nil)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode
  0x9d980ba93aef0ed>)) debug-early-backtrace() debug-early(error
  (wrong-type-argument package-desc nil)) package-upgrade(org) (progn
  (require 'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org)) command-line-1(("-eval" "(progn (require
  'package) (package-initialize) (package-refresh-contents)
  (package-upgrade 'org))")) command-line() normal-top-level()
Wrong type argument: package-desc, nil

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes                 | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | bureau 110, ancien bât.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem installing Org using the Emacs packaging system
  2024-11-23 16:45 ` Problem installing Org using the Emacs packaging system Alain.Cochard
@ 2024-12-16 19:08   ` Ihor Radchenko
  2024-12-22  3:07     ` Alain.Cochard
  2024-12-23 16:16     ` Ihor Radchenko
  0 siblings, 2 replies; 11+ messages in thread
From: Ihor Radchenko @ 2024-12-16 19:08 UTC (permalink / raw)
  To: alain.cochard; +Cc: emacs-orgmode

Alain.Cochard@unistra.fr writes:

> Hello.  An excerpt of the page 
>
> https://orgmode.org/manual/Installation.html
>
> is 
> ...
>    emacs -Q -batch -eval "(progn (require 'package) (package-initialize)
>    (package-refresh-contents) (package-upgrade 'org))"
>
> I have used the emacs batch command above on a number of machines but it
> always failed (see below), so I guess I am doing something wrong, but what?

I suspect that it is some kind of bug in Emacs 29.
It seems that the command is only properly working in Emacs 30.

I am not sure how I overlooked the problem. Maybe forgot to test things
on older Emacs somehow.

I think that we should:
1. Remove this from Org 9.7 manual (bugfix)
2. Add a note that the one-liner requires Emacs 30 in the Org 9.8-re
   manual (main)

> Anyway, is it correct that one does not need this command to avoid the
> above mentioned interferences, provided that a single Emacs session is
> running, and in which no org file has been visited (.org or otherwise)?

Yup.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem installing Org using the Emacs packaging system
  2024-12-08 10:57 Problem installing Org using the Emacs packaging system Alain.Cochard
@ 2024-12-16 19:09 ` Ihor Radchenko
  0 siblings, 0 replies; 11+ messages in thread
From: Ihor Radchenko @ 2024-12-16 19:09 UTC (permalink / raw)
  To: alain.cochard; +Cc: emacs-orgmode

Alain.Cochard@unistra.fr writes:

> Hello.  About 2 weeks ago I already sent the following message.  I just
> realized that I must have failed in removing all the 'In-Reply-To:' and
> similar fields, so it is part of another thread.  I was thinking this might
> be the reason why it was ignored and I dare submit it again.  I apologize
> for the inconvenience.  Regards.

It was not ignored. I just had a very long backlog. Just got to your
bug report.

Duplicate of
https://orgmode.org/list/26434.1724.554991.978456@frac.u-strasbg.fr
Canceled.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Patch to add a new org-archive hook and context info type
  2024-11-07  6:19 Patch to add a new org-archive hook and context info type John Wiegley
  2024-11-23 16:45 ` Problem installing Org using the Emacs packaging system Alain.Cochard
@ 2024-12-18  3:24 ` Liu Hui
  2024-12-23 17:36 ` Ihor Radchenko
  2 siblings, 0 replies; 11+ messages in thread
From: Liu Hui @ 2024-12-18  3:24 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-orgmode


在 2024/11/7 14:19, John Wiegley 写道:
> Hello,
> 
> The following patch adds ‘org-archive-finalize-hook’, which runs earlier than
> ‘org-archive-hook’ and in the destination buffer, not the original file. This
> allows the context to be extended, the archived entry to be cleaned up after
> inseration, maybe even encrypted or hashed to prevent changes.
> 
> I also added a new ‘ARCHIVE_OLID’ context type, which preserves the ID of the
> parent the archived entry was previously under. This is because ARCHIVE_OLPATH
> is not stable: it’s very possible the tree structure may change over time and
> invalidate the path. But as long as the original parent is not deleted, there
> stands a better chance that the original context of the archived entry can be
> restored.
> 
> John
> 
> --- a/lisp/org-archive.el
> +++ b/lisp/org-archive.el
> @@ -144,13 +144,26 @@ information."
>   	      (const :tag "Priority" priority)
>   	      (const :tag "Inherited tags" itags)
>   	      (const :tag "Outline path" olpath)
> +	      (const :tag "Outline parent id" olid)
>   	      (const :tag "Local tags" ltags)))
>   
> -(defvar org-archive-hook nil
> +(defcustom org-archive-hook nil
>     "Hook run after successfully archiving a subtree.
>   Hook functions are called with point on the subtree in the
>   original file.  At this stage, the subtree has been added to the
> -archive location, but not yet deleted from the original file.")
> +archive location, but not yet deleted from the original file."
> +  :group 'org-archive
> +  :type 'hook)
> +
> +(defcustom org-archive-finalize-hook nil
> +  "Hook run after successfully archiving a subtree in final location.
> +Hook functions are called with point on the subtree in the
> +destination file. Compare this with `org-archive-hook', which
> +runs in the original file. At this stage, the subtree has been
> +added to the archive location, but not yet deleted from the
> +original file."
> +  :group 'org-archive
> +  :type 'hook)
>   
>   ;;;###autoload
>   (defun org-add-archive-files (files)
> @@ -299,6 +312,9 @@ direct children of this heading."
>   		    (olpath . ,(mapconcat #'identity
>   					  (org-get-outline-path)
>   					  "/"))
> +                    (olid . ,(org-with-wide-buffer
> +                              (and (org-up-heading-safe)
> +	                           (org-entry-get (point) "ID"))))
>   		    (time . ,time)
>   		    (todo . ,(org-entry-get (point) "TODO")))))
>   	    ;; We first only copy, in case something goes wrong
> @@ -393,6 +409,7 @@ direct children of this heading."
>   		     (point)
>   		     (concat "ARCHIVE_" (upcase (symbol-name item)))
>   		     value))))
> +              (run-hooks 'org-archive-finalize-hook)
>   	      ;; Save the buffer, if it is not the same buffer and
>   	      ;; depending on `org-archive-subtree-save-file-p'.
>   	      (unless (eq this-buffer buffer)
> 
> 

Thank you. This hook is useful and I'm using it to set bookmark at last 
archive position, etc.

Can we add it to org-mode?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem installing Org using the Emacs packaging system
  2024-12-16 19:08   ` Ihor Radchenko
@ 2024-12-22  3:07     ` Alain.Cochard
  2024-12-22  9:19       ` Ihor Radchenko
  2024-12-23 16:16     ` Ihor Radchenko
  1 sibling, 1 reply; 11+ messages in thread
From: Alain.Cochard @ 2024-12-22  3:07 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: alain.cochard, emacs-orgmode

Ihor Radchenko writes on Mon 16 Dec 2024 19:08:

 > I suspect that it is some kind of bug in Emacs 29.  It seems that the
 > command is only properly working in Emacs 30.
 > 
 > I am not sure how I overlooked the problem. Maybe forgot to test things
 > on older Emacs somehow.
 > 
 > I think that we should:
 > 1. Remove this from Org 9.7 manual (bugfix)
 > 2. Add a note that the one-liner requires Emacs 30 in the Org 9.8-re
 >    manual (main)
 > 
 > > Anyway, is it correct that one does not need this command to avoid the
 > > above mentioned interferences, provided that a single Emacs session is
 > > running, and in which no org file has been visited (.org or otherwise)?
 > 
 > Yup.

Thanks a lot for the feedback.  I hope Emacs 29 (the current official
version, right?) is not too old already :-)


-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes                 | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | bureau 110, ancien bât.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem installing Org using the Emacs packaging system
  2024-12-22  3:07     ` Alain.Cochard
@ 2024-12-22  9:19       ` Ihor Radchenko
  2024-12-22 13:02         ` Alain.Cochard
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2024-12-22  9:19 UTC (permalink / raw)
  To: Alain.Cochard; +Cc: emacs-orgmode

Alain.Cochard@unistra.fr writes:

>  > I suspect that it is some kind of bug in Emacs 29.  It seems that the
>  > command is only properly working in Emacs 30.
> ...
> Thanks a lot for the feedback.  I hope Emacs 29 (the current official
> version, right?) is not too old already :-)

May you please elaborate what you mean?
The command from the manual is indeed not working in Emacs 29.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem installing Org using the Emacs packaging system
  2024-12-22  9:19       ` Ihor Radchenko
@ 2024-12-22 13:02         ` Alain.Cochard
  0 siblings, 0 replies; 11+ messages in thread
From: Alain.Cochard @ 2024-12-22 13:02 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Alain.Cochard, emacs-orgmode

Ihor Radchenko writes on Sun 22 Dec 2024 09:19:

 > May you please elaborate what you mean?  The command from the manual is
 > indeed not working in Emacs 29.

It just was a bit funny to me when you said "Maybe forgot to test on older
Emacs", considering that 29.4 is the last version that one can download
from the GNU site.


-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes                 | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | bureau 110, ancien bât.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem installing Org using the Emacs packaging system
  2024-12-16 19:08   ` Ihor Radchenko
  2024-12-22  3:07     ` Alain.Cochard
@ 2024-12-23 16:16     ` Ihor Radchenko
  1 sibling, 0 replies; 11+ messages in thread
From: Ihor Radchenko @ 2024-12-23 16:16 UTC (permalink / raw)
  To: alain.cochard; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> I think that we should:
> 1. Remove this from Org 9.7 manual (bugfix)
> 2. Add a note that the one-liner requires Emacs 30 in the Org 9.8-re
>    manual (main)

Fixed, on main, and on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9f5fce73e9
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e696e37110

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Patch to add a new org-archive hook and context info type
  2024-11-07  6:19 Patch to add a new org-archive hook and context info type John Wiegley
  2024-11-23 16:45 ` Problem installing Org using the Emacs packaging system Alain.Cochard
  2024-12-18  3:24 ` Patch to add a new org-archive hook and context info type Liu Hui
@ 2024-12-23 17:36 ` Ihor Radchenko
  2 siblings, 0 replies; 11+ messages in thread
From: Ihor Radchenko @ 2024-12-23 17:36 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-orgmode

"John Wiegley" <johnw@gnu.org> writes:

> The following patch adds ‘org-archive-finalize-hook’, which runs earlier than
> ‘org-archive-hook’ and in the destination buffer, not the original file. This
> allows the context to be extended, the archived entry to be cleaned up after
> inseration, maybe even encrypted or hashed to prevent changes.
>
> I also added a new ‘ARCHIVE_OLID’ context type, which preserves the ID of the
> parent the archived entry was previously under. This is because ARCHIVE_OLPATH
> is not stable: it’s very possible the tree structure may change over time and
> invalidate the path. But as long as the original parent is not deleted, there
> stands a better chance that the original context of the archived entry can be
> restored.

Thanks!
May you please split the patch into multiple - one per feature, document
the new features in etc/ORG-NEWS, and add a proper commit message to the
patches?

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-12-23 17:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07  6:19 Patch to add a new org-archive hook and context info type John Wiegley
2024-11-23 16:45 ` Problem installing Org using the Emacs packaging system Alain.Cochard
2024-12-16 19:08   ` Ihor Radchenko
2024-12-22  3:07     ` Alain.Cochard
2024-12-22  9:19       ` Ihor Radchenko
2024-12-22 13:02         ` Alain.Cochard
2024-12-23 16:16     ` Ihor Radchenko
2024-12-18  3:24 ` Patch to add a new org-archive hook and context info type Liu Hui
2024-12-23 17:36 ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2024-12-08 10:57 Problem installing Org using the Emacs packaging system Alain.Cochard
2024-12-16 19:09 ` Ihor Radchenko

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).