emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Greg Minshall <minshall@umich.edu>
To: Tim Cross <theophilusx@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Fwd: errors when using org-agenda
Date: Sun, 24 Oct 2021 08:05:05 +0300	[thread overview]
Message-ID: <1522775.1635051905@apollo2.minshall.org> (raw)
In-Reply-To: <m2a6j0ot8s.fsf@blind-drunk.fritz.box>

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


  parent reply	other threads:[~2021-10-24  5:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 20:35 errors when using org-agenda William McCoy
2021-10-23  0:46 ` Fwd: " William McCoy
2021-10-23  1:57   ` Tim Cross
2021-10-23 10:26     ` Greg Minshall
2021-10-23 11:34       ` Tim Cross
2021-10-23 18:07         ` Greg Minshall
2021-10-23 18:21           ` Tim Cross
2021-10-24  0:45             ` Thomas S. Dye
2021-10-24  5:05         ` Greg Minshall [this message]
2021-10-24  6:44           ` Tim Cross
2021-10-24 10:55             ` Greg Minshall
2021-10-24  5:12         ` [PATCH] " Ihor Radchenko
2021-10-24  6:59           ` Tim Cross
2021-10-24  8:16       ` Max Nikulin
2021-10-24  8:34         ` Ihor Radchenko
2021-10-27 16:46           ` Max Nikulin
2022-09-11  9:22             ` Ihor Radchenko
2021-10-23 14:49     ` William McCoy

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=1522775.1635051905@apollo2.minshall.org \
    --to=minshall@umich.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=theophilusx@gmail.com \
    /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).