Re: Bug: Duplicate logbook entry for repeated tasks [9.4.6 (9.4.6-gab9f2a @ /home/gustavo/.emacs.d/elpa/org-9.4.6/)]

2021-06-25 Thread Jeff Kowalski
While I don't have a fix for the root issue, I did have a chance to create
a lint for LOGBOOK duplicates, as you suggested.
It can be found here:
https://github.com/jeffkowalski/prelude/commit/f44b6041730469ba2094849b60d301cd94a5bed1#diff-3de035eea502a119bcdd40f4adc3d6108d4f337f827358cb2361623525682042R1199-R1251

Also below:

  (defun jeff/org-logbook-retrieve-timestamps (beg end)
"Retrieve timestamp of all state-change entries between BEG and END."
(save-excursion
  (let* ((reversed org-log-states-order-reversed)
 (search (if reversed 're-search-forward 're-search-backward))
 (limit (if reversed end (point)))
 (re (format
  "^[ \t]*-[ \t]+\\(?:State \"%s\"\s+from\s+\"%s\".*%s%s\\)"
  org-todo-regexp
  org-todo-regexp
  org-ts-regexp-inactive
  (let ((value (cdr (assq 'done org-log-note-headings
(if (not value) ""
  (concat "\\|"
  (org-replace-escapes
   (regexp-quote value)
   `(("%d" . ,org-ts-regexp-inactive)
 ("%D" . ,org-ts-regexp)
 ("%s" . "\"\\S-+\"")
 ("%S" . "\"\\S-+\"")
 ("%t" . ,org-ts-regexp-inactive)
 ("%T" . ,org-ts-regexp)
 ("%u" . ".*?")
 ("%U" . ".*?"
 log-entries)
(goto-char (if reversed beg end))
(while (funcall search re limit t)
  (push (match-string-no-properties 3) log-entries))
log-entries)))

  (defun org-lint-duplicate-logbook-timestamps (ast)
"Report LOGBOOK entries with duplicate timestamp"
(org-element-map ast 'drawer
  (lambda (d)
(when (equal (org-element-property :drawer-name d) "LOGBOOK")
  (let* ((beg (org-element-property :contents-begin d))
 (end (org-element-property :contents-end d))
 (orig (jeff/org-logbook-retrieve-timestamps beg end))
 (uniq (cl-remove-duplicates
orig
:test (lambda (x y) (or (null y) (equal x y)))
:from-end t))
 (diff (- (length orig) (length uniq
(unless (zerop diff)
  (list (org-element-property :begin d)
(format "LOGBOOK has %d entries with duplicate
timestamp" diff

  (add-to-list 'org-lint--checkers
   (make-org-lint-checker
:name 'duplicate-logbook-timestamps
:description "Report LOGBOOK entries with duplicate
timestamp"
:categories '(properties)))


On Thu, Jun 17, 2021 at 6:16 AM Gustavo Barros 
wrote:

> Thanks for confirming and for the habits info.  So that's what was
> happening with my consistency graphs.  I had indeed been noticing they
> felt "off", but I eventually reverted to 9.4.4 because of the duplicate
> entries and forgot about it.  It seems then that this got solved for me
> not by the reverting itself but by me removing the duplicate entries in
> the LOGBOOK.
>
> Would clocking reports be affected too? (I'm not personally an user of
> clocking, so I don't really know).
>
> Perhaps a "lint" for LOGBOOK duplicates would be a good idea alongside
> with the fix, so that people could go about fixing their data with a
> little more convenience?
>
> Best regards,
> Gustavo.
>


Re: Bug: Duplicate logbook entry for repeated tasks [9.4.6 (9.4.6-gab9f2a @ /home/gustavo/.emacs.d/elpa/org-9.4.6/)]

2021-06-16 Thread Jeff Kowalski
I can confirm the same is happening here for me with Org mode version 9.4.6
(9.4.6-4-g093c94-elpa @ /home/jeff/.emacs.d/elpa/org-20210607/) on GNU
Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo
version 1.16.0) of 2021-06-16
The duplicate LOGBOOK entries also seem to be messing up the graphical
display of habit records in the agenda.  Deleting the duplicates returns
the habit display to expected output.  I'd be happy to share details of
that symptom, but the root cause seems to clearly be the duplicates in the
LOGBOOK
Jeff Kowalski


Re: [O] Add TODO from external app?

2014-04-03 Thread Jeff Kowalski
I use org-etml to serve pages from within emacs and use a custom capture 
handler, like this:


(defun jeff/capture-handler (request)
  "Handle REQUEST objects meant for 'org-capture'.
GET header should contain a path in form '/capture/KEY/LINK/TITLE/BODY'."
  (with-slots (process headers) request
(let ((path (cdr (assoc :GET headers
  (if (string-match "/capture:?/\\(.*\\)" path)
  (progn
(org-protocol-capture (match-string 1 path))
(ws-response-header process 200))
(ws-send-404 process)

(setq jeff/org-ehtml-handler
  '(((:GET  . "/capture") . jeff/capture-handler)
((:GET  . ".*") . org-ehtml-file-handler)
((:POST . ".*") . org-ehtml-edit-handler)))

(when t
  (mapc (lambda (server)
  (if (=  (port server))
  (ws-stop server)))
ws-servers)
  (ws-start jeff/org-ehtml-handler ))


And the relevant org-capture looks like


("b" "entry.html" entry (file+headline (concat org-directory "toodledo.org") 
"TASKS")
   "* TODO [#C] %:description\nSCHEDULED: %t\n%:initial\n"
   :immediate-finish t)



Then, I post from a hosted form served as entry.html via org-ehtml, like 
this:

###



Org Entry



  
input[type=text] {
-webkit-appearance: none; -moz-appearance: none;
display: block;
margin: 0;
width: 100%; height: 40px;
line-height: 40px; font-size: 17px;
border: 1px solid #bbb;
}
input[type=submit],select {
-webkit-appearance: none; -moz-appearance: none;
display: block;
margin: 0;
height: 40px;
line-height: 40px; font-size: 17px;
border: 1px solid #bbb;
}
  

  http://code.jquery.com/jquery-1.10.2.min.js";>

  



  @agendas
  @calls  
  @errands
  @home   
  @quicken
  @view   
  @waiting
  @work   



  
  

  
$("#target").submit (function (event) {
event.preventDefault();

var link  = encodeURIComponent("LINK");
var title = encodeURIComponent($("#title").val() + "  :" + 
$("#context").val() + ":");
var body  = encodeURIComponent("");
var xurl   = "/capture/b" + "/" + link + "/" + title + "/" + body;

$.ajax({
url: xurl
}).success(function() {
$("span").text("captured "+xurl).show().fadeOut(1000);
$("#title").val("");
$("#context").val("@agendas");
}).fail(function(jqXHR, textStatus) {
$("span").text("failed " + xurl + "
" + textStatus).show(); //.fadeOut(1000); }); }); Forwarding ports from my machine running org-ehtml on emacs means I can access the page anywhere to add new tasks even from my cell phone. You could easily call this emacs-webservice from a PHP page, but it's just as easy to simply serve the page from emacs itself. Take a look at org- ehtml and the companion webserver that Schulte wrote.

Re: [O] Agenda buffer: 't' key moves current item to window's top line

2013-05-06 Thread Jeff Kowalski
Jeff Kowalski  gmail.com> writes:
 
> Bastien  altern.org> writes:
> > Hi James,
> > James Harkins  gmail.com> writes:
> > > After a recent update, I noticed that the agenda buffer now moves the
> > > displayed text when you change an item's TODO state using 't'.
> > Fixed, thanks!

> I'm still seeing the move-to-top bug, as James stated in OP.
> I'm using Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef
> /usr/share/emacs/24.3.50/lisp/org/).
> Bastien, in which release was it fixed?

I'll answer my own question - it appears to be fixed by Org-mode version 
8.0.2 (8.0.2-10-g3e1d83-elpa)

Jeff




Re: [O] Agenda buffer: 't' key moves current item to window's top line

2013-05-05 Thread Jeff Kowalski
Bastien  altern.org> writes:

> 
> Hi James,
> 
> James Harkins  gmail.com> writes:
> 
> > After a recent update, I noticed that the agenda buffer now moves the
> > displayed text when you change an item's TODO state using 't'.
> 
> Fixed, thanks!
> 

I'm still seeing the move-to-top bug, as James stated in OP.
I'm using Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ 
/usr/share/emacs/24.3.50/lisp/org/).
Bastien, in which release was it fixed?