[O] Bug: the code(convert the file to objc-mode) cause orgmode export to html file error

2017-12-26 Thread 陈泼杨
.h file use c/c++ mode or objc-mode base on it's content, so there is emacswiki 
solution there:
https://www.emacswiki.org/emacs/ObjectiveCMode, so i put the the code in my 
configuration:

;; header .h add to objc-mode, this cause org unable to export to html file
(add-to-list 'magic-mode-alist
 `(,(lambda ()
  (and (string= (file-name-extension buffer-file-name) "h")
   (re-search-forward "@\\"
  magic-mode-regexp-match-limit t)))
   . objc-mode))

i turn on debug-on-error options:(setq debug-on-error t),
and export org file to html by typing: C-c C-e h h, and there is error:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  file-name-extension(nil)
  (string= (file-name-extension buffer-file-name) "h")
  (and (string= (file-name-extension buffer-file-name) "h") (re-search-forward 
"@\\" magic-mode-regexp-match-limit t))
  (lambda nil (and (string= (file-name-extension buffer-file-name) "h") 
(re-search-forward "@\\" magic-mode-regexp-match-limit t)))()
  #[514 "\300!\203  \207\301!\207" [functionp looking-at] 4 "\n\n(fn RE 
DUMMY)"]((lambda nil (and (string= (file-name-extension buffer-file-name) "h") 
(re-search-forward "@\\" magic-mode-regexp-match-limit t))) nil)
  assoc-default(nil (((lambda nil (and (string= (file-name-extension 
buffer-file-name) "h") (re-search-forward "@\\" 
magic-mode-regexp-match-limit t))) . objc-mode) ("^[{[]$" . json-mode)) #[514 
"\300!\203  \207\301!\207" [functionp looking-at] 4 "\n\n(fn RE 
DUMMY)"])
  set-auto-mode(t)
  org-html-final-function(...) ;; some long text i delete to make the mail clean
  org-export-filter-apply-functions(...) ;; some long text i delete to make the 
mail clean
  org-export-as(html nil nil nil (:output-file "study.html"))
  org-export-to-file(html "study.html" nil nil nil nil nil)
  org-html-export-to-html(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)

may be it cause org file unable to convert to other format files too.




Emacs  : GNU Emacs 25.3.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 
10.9.5 (Build 13F1911))
 of 2017-09-13
Package: Org mode version 9.1.5 (9.1.5-1-gb3ddb0-elpa @ 
/Users/peck/.emacs.d/elpa/org-20171225/)

current state:
==
(setq
 org-hide-leading-stars t
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-log-done t
 org-confirm-shell-link-function 'yes-or-no-p
 org-agenda-custom-commands '(("h" "Daily habits" ((agenda ""))
   ((org-agenda-show-log t) 
(org-agenda-ndays-to-span 7)
(org-agenda-log-mode-items (quote (state)))
(org-agenda-skip-function
 (quote (org-agenda-skip-entry-if (quote 
notregexp) ":DAILY:")))
)
   )
  ("w" . "Task schedule")
  ("wa" "Important and urgent task" tags-todo 
"+PRIORITY=\"A\"")
  ("wb" "Important but not urgent task" tags-todo
   "-Weekly-Monthly-Daily+PRIORITY=\"B\"")
  ("wc" "Unimportant and not urgent task" tags-todo 
"+PRIORITY=\"C\"")
  ("p" . "Project schedule")
  ("pw" tags-todo 
"PROJECT+WORK+CATEGORY=\"c/c++/objc\"")
  ("pl" tags-todo 
"PROJECT+DREAM+CATEGORY=\"peckchen\"")
  ("W" "Weekly Review" ((stuck "") (tags-todo 
"PROJECT"
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-font-lock-set-keywords-hook '(doom-org-custom-fontification)
 org-mode-hook '((lambda nil (org-bullets-mode 1))
 (lambda nil (company-mode) (local-set-key "w" (quote 
org-pomodoro)))
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append 
local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all 
append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-fontify-done-headline t
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn

Re: [O] Bug: the code(convert the file to objc-mode) cause orgmode export to html file error

2017-12-26 Thread Nicolas Goaziou
Hello,

陈泼杨  writes:

> .h file use c/c++ mode or objc-mode base on it's content, so there is 
> emacswiki solution there:
> https://www.emacswiki.org/emacs/ObjectiveCMode, so i put the the code in my 
> configuration:
>
> ;; header .h add to objc-mode, this cause org unable to export to html file
> (add-to-list 'magic-mode-alist
>`(,(lambda ()
> (and (string= (file-name-extension buffer-file-name) "h")
>  (re-search-forward "@\\"
> magic-mode-regexp-match-limit t)))
>  . objc-mode))

Try to use `equal' instead of `string='.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: the code(convert the file to objc-mode) cause orgmode export to html file error

2017-12-26 Thread 陈泼杨
From: Nicolas Goaziou 
Subject: Re: Bug: the code(convert the file to objc-mode) cause orgmode export 
to html file error
Date: Tue, 26 Dec 2017 12:28:47 +0100

> Hello,
> 
> =E9=99=88=E6=B3=BC=E6=9D=A8  writes:
> 
>> .h file use c/c++ mode or objc-mode base on it's content, so there is ema=
> cswiki solution there:
>> https://www.emacswiki.org/emacs/ObjectiveCMode, so i put the the code in =
> my configuration:
>>
>> ;; header .h add to objc-mode, this cause org unable to export to html fi=
> le
>> (add-to-list 'magic-mode-alist
>>   `(,(lambda ()
>>(and (string=3D (file-name-extension buffer-file-name) "h")
>> (re-search-forward "@\\"
>>magic-mode-regexp-match-limit t)))
>> . objc-mode))
> 
> Try to use `equal' instead of `string=3D'.
> 
> Regards,
> 
> --=20
> Nicolas Goaziou

follow your tips, i change to code, use equal, and the code is:


(add-to-list 'magic-mode-alist
`(,(lambda ()
 (and (equal (file-name-extension buffer-file-name) "h")
  (re-search-forward "@\\" 
 magic-mode-regexp-match-limit t)))
  . objc-mode))


still unable to export org file to html:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  file-name-extension(nil)
  (equal (file-name-extension buffer-file-name) "h")
  (and (equal (file-name-extension buffer-file-name) "h") (re-search-forward 
"@\\" magic-mode-regexp-match-limit t))
  (lambda nil (and (equal (file-name-extension buffer-file-name) "h") 
(re-search-forward "@\\" magic-mode-regexp-match-limit t)))()
  #[514 "\300!\203  \207\301!\207" [functionp looking-at] 4 "\n\n(fn RE 
DUMMY)"]((lambda nil (and (equal (file-name-extension buffer-file-name) "h") 
(re-search-forward "@\\" magic-mode-regexp-match-limit t))) nil)
  assoc-default(nil (((lambda nil (and (equal (file-name-extension 
buffer-file-name) "h") (re-search-forward "@\\" 
magic-mode-regexp-match-limit t))) . objc-mode) ("^[{[]$" . json-mode)) #[514 
"\300!\203    \207\301!\207" [functionp looking-at] 4 "\n\n(fn RE 
DUMMY)"])
  set-auto-mode(t)
  org-html-final-function(...)
  org-export-filter-apply-functions(...)
  org-export-as(html nil nil nil (:output-file "note.html"))
  org-export-to-file(html "note.html" nil nil nil nil nil)
  org-html-export-to-html(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)


--
Best regards
Peck Chen / 陈泼杨


Re: [O] Bug: the code(convert the file to objc-mode) cause orgmode export to html file error

2017-12-26 Thread Nicolas Goaziou
陈泼杨  writes:

> 
> (add-to-list 'magic-mode-alist
> `(,(lambda ()
>  (and (equal (file-name-extension buffer-file-name) "h")
>   (re-search-forward "@\\" 
>magic-mode-regexp-match-limit t)))
>   . objc-mode))
> 
>
> still unable to export org file to html:

Your function doesn't handle buffers not associated to a file. You may
want to try

  (and (stringp buffer-file-name)
   (equal "h" (file-name-extension buffer-file-name))
   ...)

Regards,



Re: [O] Searching all attachments in org-files

2017-12-26 Thread Narendra Joshi
Ihor Radchenko  writes:

> Dear Narendra,
>
> Here is what I am using:
>
> (defun org-att-complete-link (&optional arg)
>   "Completion dispatcher for att: links (rewritten from org-attach-open)"
>   (let* ((attach-dir (org-attach-dir t))
>(files (org-attach-file-list attach-dir))
>(file (if (= (length files) 1)
>  (car files)
>(completing-read "att: "
> (mapcar #'list files) nil t)))
>(path (expand-file-name file attach-dir)))
> (concat "att:" file)))
> (add-to-list 'org-link-abbrev-alist '("att" . org-attach-expand-link))
> (org-link-set-parameters
>  "att"
>  :complete 'org-att-complete-link)
#+begin_src emacs-lisp
(defun org-att-complete-link (&optional arg)
"Completion dispatcher for att: links (rewritten from org-attach-open)"
(let* ((attach-dir (expand-file-name org-attach-directory org-directory))
   (file-paths (directory-files-recursively attach-dir ".*"))
   (completions (mapcar (lambda (f)
  (cons (file-name-base f) f))
file-paths))
   (file-name (completing-read "att: " completions nil t))
   (path (assoc-default file-name completions)))
  (concat "att:" path)))
#+end_src

This worked for me. I had to change it a bit for my use case. Thanks a
lot for the help! :)

--
Narendra Joshi



Re: [O] Bug: the code(convert the file to objc-mode) cause orgmode export to html file error

2017-12-26 Thread 陈泼杨
From: Nicolas Goaziou 
Subject: Re: Bug: the code(convert the file to objc-mode) cause orgmode export 
to html file error
Date: Tue, 26 Dec 2017 14:35:18 +0100

> Your function doesn't handle buffers not associated to a file. You may
> want to try
> 
>   (and (stringp buffer-file-name)
>(equal "h" (file-name-extension buffer-file-name))
>...)
> 
> Regards,

thanks for your help.

--
Best regards
Peck Chen / 陈泼杨


[O] taskjuggler subtract scheduled and deadline

2017-12-26 Thread edgar

Hello,

I am trying this:

#+BEGIN_SRC org
  ,* TODO Pay the rent 
:taskjuggler_project:

  SCHEDULED: <2017-12-29 Fri 09:00> DEADLINE: <2017-12-29 Fri 11:00>
#+END_SRC

which gives me this:
#+BEGIN_EXAMPLE
  repeat.tjp:13: Error: The end date (2017-12-29-00:00-+) must be 
after the start date (2017-12-29-00:00-+).

#+END_EXAMPLE

I tried modifying ox-taskjuggler.el:
#+BEGIN_SRC diff
  ,*** org/ox-taskjuggler.el2017-12-26 16:39:52.633050180 -0700
  --- my/ox-taskjuggler.el  2017-12-26 19:42:17.921208465 -0700
  ,***
  ,*** 478,484 
  --- 478,490 
doesn't have any start date defined."
  (let ((scheduled (org-element-property :scheduled item)))
(or
  +  ;; How do I compile a regex to avoid locale day names?:
  +  ;; "%Y-%02m-%02d [[:alpha:][:space:]]* %[RT]"
 (and scheduled (org-timestamp-format scheduled "%Y-%02m-%02d"))
  +  (and scheduled (org-timestamp-format scheduled "%Y-%02m-%02d 
%R"))
  +  (and scheduled (org-timestamp-format scheduled "%Y-%02m-%02d %a 
%R"))
  +  (and scheduled (org-timestamp-format scheduled "%Y-%02m-%02d 
%T"))
  +  (and scheduled (org-timestamp-format scheduled "%Y-%02m-%02d %a 
%T"))

 (and (memq 'start org-taskjuggler-valid-task-attributes)
(org-element-property :START item)

  ,***
  ,*** 487,493 
ITEM is a headline.  Return value is a string or nil if ITEM
doesn't have any end date defined."
  (let ((deadline (org-element-property :deadline item)))
  ! (and deadline (org-timestamp-format deadline "%Y-%02m-%02d"



  --- 493,506 
ITEM is a headline.  Return value is a string or nil if ITEM
doesn't have any end date defined."
  (let ((deadline (org-element-property :deadline item)))
  ! ;; How do I compile a regex to avoid locale day names?:
  ! ;; "%Y-%02m-%02d [[:alpha:][:space:]]* %[RT]"
  ! (or
  !  (and deadline (org-timestamp-format deadline "%Y-%02m-%02d"))
  !  (and deadline (org-timestamp-format deadline "%Y-%02m-%02d 
%R"))
  !  (and deadline (org-timestamp-format deadline "%Y-%02m-%02d %a 
%R"))
  !  (and deadline (org-timestamp-format deadline "%Y-%02m-%02d 
%T"))
  !  (and deadline (org-timestamp-format deadline "%Y-%02m-%02d %a 
%T")





#+END_SRC

but I got the same error. Is there a way to set starting and ending 
times with a resolution of hours or minutes to be exported with 
taskjuggler? Thanks!


-

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!