Comments (6)
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.
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.
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.
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.
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.
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)
- open-current-journal-file does not respect org-extend-today-until HOT 2
- Org Journal new entry does not enter time prefix along with current time for daily files HOT 5
- org-journal test suite failing under emacs 29 HOT 2
- support Daily / Weekly / Monthly journal at the same time
- After a recently upgrade of org, an error of "cannot be used in non-org buffer" raised HOT 4
- journal entries are not carried over when there are file headers HOT 2
- [BUG] Possible "hide entries" behavior bug. HOT 2
- [Question / Discussion] How to have a different `org-jounal-dir` for different projects?
- 'org-journal-new-entry' now seems broken with error: 'org-element-at-point' cannot be used in non-Org buffer HOT 2
- create-entry is brittle on unexpected contents in PROPERTIES blocks HOT 6
- Switch from travis to github actions HOT 1
- The test suite fails: HOT 4
- Write test for `org-extend-today-until` and re-factor references of `org-extend-today-until` into function
- Close issues opened before 2021? HOT 2
- Use Eask HOT 2
- org-journal.el:1984:1:Warning: the function `org--tag-add-to-alist' is not known to be defined -- see github action emacs 26.1 HOT 2
- rename master -> main and develop -> dev HOT 3
- Forum -- a issue open for general discussion about `org-journal` HOT 4
- Replace the caching functionality with`org-persist.el`... HOT 2
- `org-journal-new-entry` insert duplicate header on narrowed journal buffer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from org-journal.