emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: errors when using org-agenda


From: Tim Cross
Subject: Re: Fwd: errors when using org-agenda
Date: Sun, 24 Oct 2021 17:44:34 +1100
User-agent: mu4e 1.6.7; emacs 27.2

Greg Minshall <minshall@umich.edu> writes:

> Tim,
>
> i wonder if the emacs variable `load-history` might be of (approximate)
> help?  i submit a starter routine below.  as the comments say: caveat,
> caveat, caveat.
>
> i don't think something as uncertain as this would be a candidate for
> normal run-time checking (and, i'm not even sure when one would want to
> run such a thing -- maybe as each module is loaded, if it were faster).
> but, maybe it could be run as part of `M-x org-submit-bug-report`?
> either to notify the user, or to include with the bug report?
>
> wdyt?  (such a nice acronym!)
>
> cheers, Greg
>
> ----
> notice the canned list of files.  one could, i suspect, go find where
> org.el came from, then use all the .el files there.  (or the union of
> all the files in *all* the directories that loaded an org.el.)
> ----
>
> (defun org--check-load-history (&optional where)
>   "check to see if there *appears* to *maybe* have be a \"mixed
>   installation\" of org-mode running.  if there appear to be more than
>   one directory holding org package(-like) files, the names of those
>   directories, along with the relevant files in each, are returned as
>   a vector of explanatory strings.  
>
>   this routine is subject to both type I and type II errors (false
>   positives, false negatives).  we have a canned list of org .el file
>   names, and we look to see if those files exist in more than one
>   directory that has been loaded (using the `load-list` variable).
>
>   if there does not appear to be the possibility of a \"mixed
>   installation\", the if the optional argument WHERE is non-nil, and
>   there is only one directory containing org package(-like) files,
>   that directory name is returned.  if WHERE is nil, nil is returned."
>   (require 'seq)
>   (require 's)
>
>   (let* ((org-files
>           '("ob-lob.el" "oc-bibtex.el" "org-crypt.el" "org-persist.el"
>             "ob-C.el" "ob-lua.el" "oc-csl.el" "org-ctags.el" "org-plot.el"
>             "ob-R.el" "ob-makefile.el" "oc-natbib.el" "org-datetree.el" 
> "org-protocol.el"
>             "ob-awk.el" "ob-matlab.el" "oc.el" "org-duration.el" 
> "org-refile.el"
>             "ob-calc.el" "ob-maxima.el" "ol-bbdb.el" "org-element.el" 
> "org-src.el"
>             "ob-clojure.el" "ob-ocaml.el" "ol-bibtex.el" "org-entities.el" 
> "org-table.el"
>             "ob-comint.el" "ob-octave.el" "ol-docview.el" "org-faces.el" 
> "org-tempo.el"
>             "ob-core.el" "ob-org.el" "ol-doi.el" "org-feed.el" "org-timer.el"
>             "ob-css.el" "ob-perl.el" "ol-eshell.el" "org-footnote.el" 
> "org-version.el"
>             "ob-ditaa.el" "ob-plantuml.el" "ol-eww.el" "org-goto.el" 
> "org-version.el~"
>             "ob-dot.el" "ob-processing.el" "ol-gnus.el" "org-habit.el" 
> "org.el"
>             "ob-emacs-lisp.el" "ob-python.el" "ol-info.el" "org-id.el" 
> "ox-ascii.el"
>             "ob-eshell.el" "ob-ref.el" "ol-irc.el" "org-indent.el" 
> "ox-beamer.el"
>             "ob-eval.el" "ob-ruby.el" "ol-man.el" "org-inlinetask.el" 
> "ox-html.el"
>             "ob-exp.el" "ob-sass.el" "ol-mhe.el" "org-install.el" 
> "ox-icalendar.el"
>             "ob-forth.el" "ob-scheme.el" "ol-rmail.el" "org-keys.el" 
> "ox-koma-letter.el"
>             "ob-fortran.el" "ob-screen.el" "ol-w3m.el" "org-lint.el" 
> "ox-latex.el"
>             "ob-gnuplot.el" "ob-sed.el" "ol.el" "org-list.el" "ox-man.el"
>             "ob-groovy.el" "ob-shell.el" "org-agenda.el" "org-loaddefs.el" 
> "ox-md.el"
>             "ob-haskell.el" "ob-sql.el" "org-archive.el" "org-loaddefs.el~" 
> "ox-odt.el"
>             "ob-java.el" "ob-sqlite.el" "org-attach-git.el" "org-macro.el" 
> "ox-org.el"
>             "ob-js.el" "ob-table.el" "org-attach.el" "org-macs.el" 
> "ox-publish.el"
>             "ob-julia.el" "ob-tangle.el" "org-capture.el" "org-mobile.el" 
> "ox-texinfo.el"
>             "ob-latex.el" "ob.el" "org-clock.el" "org-mouse.el" "ox.el"
>             "ob-lilypond.el" "oc-basic.el" "org-colview.el" "org-num.el"
>             "ob-lisp.el" "oc-biblatex.el" "org-compat.el" "org-pcomplete.el"))
>          (possibles
>           (seq-map (lambda (x)
>                      (cons (file-name-directory (car x))
>                            (list (file-name-base (car x)))))
>                    (seq-filter
>                     (lambda (x)
>                       (let ((bn (file-name-nondirectory (car x))))
>                         (seq-contains-p org-files bn
>                                         (lambda (e elt) (s-match (concat "^" 
> e "$") elt)))))
>                     load-history))))
>     (let ((uniques (seq-uniq (seq-map 'car possibles))))
>       (if (eq 1 (length uniques))
>           (if where                             ; this is the good outcome
>               (car uniques))
>         (seq-map
>          (lambda (dir)
>            (let ((joined
>                   (s-join " "
>                           (seq-map 'cadr
>                                    (seq-filter
>                                     (lambda (e)
>                                       (progn
>                                         (equal (car e) dir)))
>                                     possibles)))))
>              (s-lex-format "from ${dir} have: ${joined}")))
>          uniques)))))


Iff you could run this function as part of the actual upgrade process
i.e. it runs just before package.el or straight.el or ... tries to
upgrade org mode, I guess it could provide a warning that org is already
loaded and that continuing will run the risk of a mixed installation.

The key point to remember is that a mized installation is not about
loading org sources from two different org versions. The problem is
about compilation of org where some of the source definitions are
already loaded (from existing installation) and result in output which
is a combination of some of the source from the new version mixed with
definitions from the old version. This approach wouldn't be useful, for
example, when you have a mixed installation and encounter the problem in
a later session, because by that time, you are only loading a single
version, only the elc files which make up that version are corrupted
(and load-history is only for the current session). . 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]