Giter VIP home page Giter VIP logo

Comments (6)

bastibe avatar bastibe commented on July 20, 2024

Hi Goeff, thank you for the bug report.

Your problem should be fixed in the latest release. The fix is already uploaded on Marmalade, and should show up on Melpa and Melpa Stable, soon.

Can you confirm that 1.11.1 works on your end?

from org-journal.

geoffmacintosh avatar geoffmacintosh commented on July 20, 2024

Hey!

I'd like to preface this by saying that I have no idea what I'm talking about, so forgive any huge mistakes.

I think your fix doesn't quite work for me, however using when instead of if does.

(when (and org-journal-hide-entries-p (org-journal-time-entry-level))

This seems to work okay for me. Testing the structure in M-x ielm shows the following

ELISP> (if (and t nil))
*** Eval error *** Wrong number of arguments: if, 1
ELISP> (when (and t nil))
nil

So I think using when provides the behaviour wanted? It seems to not have additional problems anyway. Searching through elisp guides hasn't uncovered anything anyway. I'm happy to submit a pull request, although my proposed change is one word. Thanks again!

from org-journal.

geoffmacintosh avatar geoffmacintosh commented on July 20, 2024

Immediate update: That doesn't fix everything. There's another section that goes

(when should-add-entry-p
        (unless (eq (current-column) 0) (insert "\n"))
        (insert "\n" org-journal-time-prefix
                (if (= (time-to-days (current-time)) (time-to-days time))
                    (format-time-string org-journal-time-format)
                  "")))

That seems to get mad when attempting to insert org-journal-time-prefix because it's nil. I can investigate more.

Since this seems to a non-pressing issue, I'll attempt to slowly figure it out myself, and submit a pull request when I solve it. So unless it's something that needs fixing now, I've got it covered, I hope.

from org-journal.

bastibe avatar bastibe commented on July 20, 2024

Thank you for the analysis. There should be no difference between if with two arguments and when with two arguments. The difference between the two is how the n>2 arguments are handled. if uses (if predicate true-clause false-clause), whereas when uses (when predicate true-clauses...) with an arbitrary number of true-clauses.

As for the second section that causes you problems, why is your org-journal-time-prefix nil?. It should be empty-string, not nil. The rest of the code should work fine with an empty string.

from org-journal.

geoffmacintosh avatar geoffmacintosh commented on July 20, 2024

My apologies. I got a bit carried away and stopped testing things with emacs -Q. I now am in the situation where having these two items in my normal config:

(setq org-journal-date-prefix "#+TITLE: Entry for ")
(setq org-journal-time-prefix "")

Causes the following error when I try to make a new entry or add to an existing entry:

Debugger entered--Lisp error: (error "before first heading")
  signal(error ("before first heading"))
  error("before first heading")
  outline-back-to-heading(t)
  show-entry()
  org-journal-new-entry(nil)
  call-interactively(org-journal-new-entry nil nil)
  command-execute(org-journal-new-entry)

But it doesn't happen using emacs -Q. This means it's pretty clearly my fault/config, which I think marks this issue as closed. Thanks for the bug fix and all of my additional nonsense!

from org-journal.

bastibe avatar bastibe commented on July 20, 2024

Yes, the last step of creating a new entry is to call (show-entry), which reveals the current headline. Of course in your case, there is no headline, so (show-entry) fails.

You can work around this by calling (org-journal-new-entry) with a prefix, which will suppress this, i.e. use C-u C-c C-j instead of C-c C-j.

A more permanent workaround would be to put this code into your init file:

(defadvice org-journal-new-entry (around org-journal-new-entry-no-show-entry (prefix &optional time) activate)
  "suppress calls to show-entry within org-journal-new-entry"
  (interactive "P")
  (let ((show-entry (lambda nil))) ad-do-it))

This will override show-entry within org-journal-new-entry to do nothing (I haven't tested this, so there might still be syntax errors).

from org-journal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.