Re: Specifying the execution function and/or nested major mode for babel blocks

2020-04-26 Thread Vladimir Nikishkin
>> (add-to-list 'org-src-lang-modes '("f90" . fortran))

Language alignment is fine. What needs to be done is to make org-babel
use org-babel-execute:fortran for both begin_src fortran, and for
begin_src f90.

пн, 27 апр. 2020 г. в 12:12, Kyle Meyer :
>
> Vladimir Nikishkin  writes:
>
> > This is fine most of the time, however, there are exceptions.
> > The one I am interested in is fortran/f90. There are separate
> > fortran-mode and f90-mode, however, afaiu, just a single
> > ob-fortran.el, which works fine with both of those.
>
> In that case, you'd just need (fortran . t) in org-babel-load-languages,
> I think.
>
> > #+begin_src fortran
> > #+end_src
> > or turns on syntax highlighting for fortran-mode, not for f90-mode.
> > I can make blocks like:
> > #+begin_src f90
> > #+end_src
> > This makes syntax highlighting work, but evaluation doesn't, because
> > org doesn't know that f90 and fortran have the same evaluation
> > (compilation) function.
> >
> > I feel that this is a super minor thing that can be solved in, like,
> > one line of code. But I don't seem to be able to find which one.
> >
> > Any suggestions?
>
> Perhaps you're looking for org-src-lang-modes?  This (untested) might do
> what you want:
>
>   (add-to-list 'org-src-lang-modes '("f90" . fortran))



-- 
Yours sincerely, Vladimir Nikishkin



Re: Specifying the execution function and/or nested major mode for babel blocks

2020-04-26 Thread Kyle Meyer
Vladimir Nikishkin  writes:

> This is fine most of the time, however, there are exceptions.
> The one I am interested in is fortran/f90. There are separate
> fortran-mode and f90-mode, however, afaiu, just a single
> ob-fortran.el, which works fine with both of those.

In that case, you'd just need (fortran . t) in org-babel-load-languages,
I think.

> #+begin_src fortran
> #+end_src
> or turns on syntax highlighting for fortran-mode, not for f90-mode.
> I can make blocks like:
> #+begin_src f90
> #+end_src
> This makes syntax highlighting work, but evaluation doesn't, because
> org doesn't know that f90 and fortran have the same evaluation
> (compilation) function.
>
> I feel that this is a super minor thing that can be solved in, like,
> one line of code. But I don't seem to be able to find which one.
>
> Any suggestions?

Perhaps you're looking for org-src-lang-modes?  This (untested) might do
what you want:

  (add-to-list 'org-src-lang-modes '("f90" . fortran))



Specifying the execution function and/or nested major mode for babel blocks

2020-04-26 Thread Vladimir Nikishkin
Hello, everyone.

In org.el we have the following:
(require (intern (concat "ob-" lang)))

This is fine most of the time, however, there are exceptions.
The one I am interested in is fortran/f90. There are separate
fortran-mode and f90-mode, however, afaiu, just a single
ob-fortran.el, which works fine with both of those.

Moreover, when I make block like:
#+begin_src fortran
#+end_src
or turns on syntax highlighting for fortran-mode, not for f90-mode.
I can make blocks like:
#+begin_src f90
#+end_src
This makes syntax highlighting work, but evaluation doesn't, because
org doesn't know that f90 and fortran have the same evaluation
(compilation) function.

I feel that this is a super minor thing that can be solved in, like,
one line of code. But I don't seem to be able to find which one.

Any suggestions?

Vlad

-- 
Yours sincerely, Vladimir Nikishkin



Re: Feature request: org-agenda-clockreport-mode to omit files with no clocked time

2020-04-26 Thread Stig Brautaset
Kyle Meyer  writes:
>> I often end up with empty files in my org-agenda-clockreport-mode,
>> [...]
>> I would have liked it to hide all the uninteresting files (i.e. files
>> with no clocked time) and instead shown me:
>
> I haven't tried, but can you already do this via
> org-agenda-clockreport-parameter-plist, in particular by adding
> `:fileskip0 t'?

That works for me. Thank you!

Stig



Re: Feature request: org-agenda-clockreport-mode to omit files with no clocked time

2020-04-26 Thread Kyle Meyer
Stig Brautaset  writes:

> I often end up with empty files in my org-agenda-clockreport-mode,
> something like this. (For the avoidance of doubt: this is an ECM ;-) )
>
> | File | Headline | Time   |   |
> |--+--++---|
> |  | ALL *Total time* | *0:42* |   |
> |--+--++---|
> | maybe.org| *File time*  | *0:00* |   |
> |--+--++---|
> | projects.org | *File time*  | *0:00* |   |
> |--+--++---|
> | tasks.org| *File time*  | *0:42* |   |
> |  | Foo  | 0:08   |   |
> |  | Bar  | 0:24   |   |
> |  | Quux | 0:10   |   |
>
> I would have liked it to hide all the uninteresting files (i.e. files
> with no clocked time) and instead shown me:

[...]

> It seems like a small-ish change I may brave to implement--unless
> someone beats me to it, which I'm fine with! I would appreciate some
> pointers:
>
> 1. Would I need to introduce an option, in case anyone relies on the
>empty sections? (I *think* not, as I gather the prevailing wind is to
>reduce the number of options.)

I haven't tried, but can you already do this via
org-agenda-clockreport-parameter-plist, in particular by adding
`:fileskip0 t'?



Feature request: org-agenda-clockreport-mode to omit files with no clocked time

2020-04-26 Thread Stig Brautaset
Hello,

I often end up with empty files in my org-agenda-clockreport-mode,
something like this. (For the avoidance of doubt: this is an ECM ;-) )

| File | Headline | Time   |   |
|--+--++---|
|  | ALL *Total time* | *0:42* |   |
|--+--++---|
| maybe.org| *File time*  | *0:00* |   |
|--+--++---|
| projects.org | *File time*  | *0:00* |   |
|--+--++---|
| tasks.org| *File time*  | *0:42* |   |
|  | Foo  | 0:08   |   |
|  | Bar  | 0:24   |   |
|  | Quux | 0:10   |   |

I would have liked it to hide all the uninteresting files (i.e. files
with no clocked time) and instead shown me:


| File | Headline | Time   |   |
|--+--++---|
|  | ALL *Total time* | *0:42* |   |
|--+--++---|
| tasks.org| *File time*  | *0:42* |   |
|  | Foo  | 0:08   |   |
|  | Bar  | 0:24   |   |
|  | Quux | 0:10   |   |

It seems like a small-ish change I may brave to implement--unless
someone beats me to it, which I'm fine with! I would appreciate some
pointers:

1. Would I need to introduce an option, in case anyone relies on the
   empty sections? (I *think* not, as I gather the prevailing wind is to
   reduce the number of options.)
2. Would this likely be best implemented as a post-processing filter? Or
   when generating the table in the first place?
3. Any helpful hints you can think of? :-)


Stig



Re: 28.0.50; [bug] Inside help buffers escaped symbol[s] causing a problem.

2020-04-26 Thread Achilles Yuce
Nicolas Goaziou  writes:

> It looks like a bug in Emacs, doesn't it? Why would Info buffer display
> "\`" when you write "`"? I suggest to report it to Emacs developers.
> Meanwhile, I pushed a work around. Thank you.

Thank you for the work around. 

As for the questions: I wouldn't know but probably help modes only care
for what the actual help/describe functions provide instead of the
interactive input.


  Achilles



Re: #+BEGIN_SRC sh C-c C-c in Windows

2020-04-26 Thread Neil Cherry
On 4/23/20 9:46 AM, Neil Cherry wrote:
> On 4/23/20 2:15 AM, Robert Klein wrote:
>> Hi,
>>
>> On Wed, 22 Apr 2020 08:09:39 -0400
>> Neil Cherry  wrote:
>>
>>> I've searched for a resolution for this but haven't found one. I want
>>> to be able to call a different command shell in Windows. What I keep
>>> seeing is that it can't find /bin/sh
>>>
>>> #+BEGIN_SRC sh :results output
>>> set
>>> #+END_SRC
>>>

Thanks to everyone who helped (Robert. Steven, Julius). Basically the Windows 
path
was munged and for some reason adding to the path (exec-path) didn't help. 
Anyway,
cleaned up the path and it is now working on both Windows (Home and Work PC).

#+BEGIN_SRC bash :shebang "#!/usr/bin/bash" :results output :wrap
echo -e "#\n# Date: '$(date +%Y-%m-%d)'\n#"
#+END_SRC

#+RESULTS:
#+BEGIN_RESULTS
#
# Date: '2020-04-26'
#
#+END_RESULTS

-- 
Linux Home Automation Neil Cherry   nche...@linuxha.com
http://www.linuxha.com/ Main site
http://linuxha.blogspot.com/My HA Blog
Author of:  Linux Smart Homes For Dummies



Re: [patch suggestion] Mitigating the poor Emacs performance on huge org files: Do not use overlays for PROPERTY and LOGBOOK drawers

2020-04-26 Thread Ihor Radchenko
> You cannot. You may however mimic it with `cursor-sensor-functions' text
> property. These assume Cursor Sensor minor mode is active, tho.
> I haven't tested it, but I assume it would slow down text properties
> a bit, too, but hopefully not as much as overlays.

Unfortunately, isearch sets inhibit-point-motion-hooks to non-nil
internally. Anyway, I came up with some workaround, which seems to work
(see below). Though it would be better if isearch supported hidden text
in addition to overlays.

> Missing `isearch-open-invisible' is a deal breaker, IMO. It may be worth
> experimenting with `cursor-sensor-functions'.

So far, I came up with the following partial solution searching and
showing hidden text.

;; Unfortunately isearch, sets inhibit-point-motion-hooks and we
;; cannot even use cursor-sensor-functions as a workaround
;; I used a less ideas approach with advice to isearch-search-string as
;; a workaround 

(defun org-find-text-property-region (pos prop)
  "Find a region containing PROP text property around point POS."
  (require 'org-macs) ;; org-with-point-at
  (org-with-point-at pos
(let* ((beg (and (get-text-property pos prop) pos))
   (end beg))
  (when beg
(setq beg (or (previous-single-property-change pos prop)
  beg))
(setq end (or (next-single-property-change pos prop)
  end))
(unless (equal beg end)
  (cons beg end))

;; :FIXME: re-hide properties when point moves away
(define-advice isearch-search-string (:after ( _) put-overlay)
  "Reveal hidden text at point."
  (when-let ((region (org-find-text-property-region (point) 'invisible)))
(with-silent-modifications
  (put-text-property (car region) (cdr region) 'org-invisible 
(get-text-property (point) 'invisible)))
  (remove-text-properties (car region) (cdr region) '(invisible nil

;; this seems to be unstable, but I cannot figure out why
(defun org-restore-invisibility-specs ( _)
  ""
   (let ((pos (point-min)))
 (while (< (setq pos (next-single-property-change pos 'org-invisible nil 
(point-max))) (point-max))
   (when-let ((region (org-find-text-property-region pos 'org-invisible)))
   (with-silent-modifications
 (put-text-property (car region) (cdr region) 'invisible 
(get-text-property pos 'org-invisible))
 (remove-text-properties (car region) (cdr region) '(org-invisible 
nil)))

(add-hook 'post-command-hook #'org-restore-invisibility-specs)

(defun org-flag-region (from to flag spec)
  "Hide or show lines from FROM to TO, according to FLAG.
SPEC is the invisibility spec, as a symbol."
  (pcase spec
('outline
 (remove-overlays from to 'invisible spec)
 ;; Use `front-advance' since text right before to the beginning of
 ;; the overlay belongs to the visible line than to the contents.
 (when flag
   (let ((o (make-overlay from to nil 'front-advance)))
 (overlay-put o 'evaporate t)
 (overlay-put o 'invisible spec)
 (overlay-put o 'isearch-open-invisible #'delete-overlay
(_
 (with-silent-modifications
   (remove-text-properties from to '(invisible nil))
   (when flag
 (put-text-property from to 'invisible spec)
 )

;; This normally deletes invisible text property. We do not want this now.
(defun org-unfontify-region (beg end  _maybe_loudly)
  "Remove fontification and activation overlays from links."
  (font-lock-default-unfontify-region beg end)
  (let* ((buffer-undo-list t)
 (inhibit-read-only t) (inhibit-point-motion-hooks t)
 (inhibit-modification-hooks t)
 deactivate-mark buffer-file-name buffer-file-truename)
(decompose-region beg end)
(remove-text-properties beg end
'(mouse-face t keymap t org-linked-text t
 ;; Do not remove invisible during 
fontification 
 ;; invisible t
 intangible t
 org-emphasis t))
(org-remove-font-lock-display-properties beg end)))

> Anyway, the real fix should come from Emacs itself. There are ways to
> make overlays faster. These ways have already been discussed on the
> Emacs devel mailing list, but no one implemented them. It is a bit sad
> that we have to find workarounds for that.

I guess that it is a very old story starting from the times when XEmacs
was a thing [1]. I recently heard about binary tree implementation of
overlays (there should be a branch in emacs git repo) [2], but there was
no update on that branch for a while. So, I do not have much hope on
Emacs implementing efficient overlay access in the near future. (And I
have problems with huge org files already).

[1] 
https://www.reddit.com/r/planetemacs/comments/e9lgwn/history_of_lucid_emacs_fsf_emacs_schism/
[2] 

Re: org-thtml - static html site in pure org + Emacs

2020-04-26 Thread Detlef Steuer
Hi!

I will give it a try. Really useful!
Thx for creating and sharing!

Detlef

Am Sat, 25 Apr 2020 16:27:28 +0200
schrieb Juan José García-Ripoll :

> Hi,
> 
> I have created this standalone framework for building static HTML
> sites using Emacs and org-mode
>https://github.com/juanjosegarciaripoll/org-thtml/
> 
> The github repository has a sample mini-site, but you may want to see
> a more mature one at my homepage https://juanjose.garciaripoll.com It
> only requires emacs.
> 
> The example requires a recent version of org-mode. The stock one seems
> to have a problem resolving file: links in files that have been
> #+include'd.
> 
> Cheers,
> 




Re: 28.0.50; [bug] Inside help buffers escaped symbol[s] causing a problem.

2020-04-26 Thread Nicolas Goaziou
Hello,

Achilles Yuce  writes:

> After using `org-store-link`; i was expecting to jump back to what i
> stored which is the buffer to see after evaluating (describe-symbol '\`)
> but instead i got an `user-error` as you can see in [Recent messages:]
> section in this report. I believe this shouldn't be the case. My exact
> steps included in [Losage:] section.
>
> FWIW I somehow managed to fix it by removing the '\'s from the captured
> string defined in lisp/org/ol.el file. Also adding diff output.

It looks like a bug in Emacs, doesn't it? Why would Info buffer display
"\`" when you write "`"? I suggest to report it to Emacs developers.
Meanwhile, I pushed a work around. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: Adaptive Org faces in headings?

2020-04-26 Thread Ihor Radchenko
> Does the community know of a solution to this issue?

Not precisely answer to your question, but I use the code below to get
more complete fontification in agenda. The code does not consider
heading level, but can be easily modified to do so [ (insert "* ") ->
(insert (s-concat (make-string level ?*) " ")) ]

(define-advice org-agenda-format-item (:filter-args ( args)  fontify-org)
  "Force fontify ageda item. (hack)"
  (cl-multiple-value-bind (extra txt level category tags dotime remove-re 
habitp) (car args)
(with-temp-buffer
  (cl-letf (((symbol-function 'yant/process-att-abbrev) #'identity)
((symbol-function 'yant/process-att-id-abbrev) #'identity)) ;; 
expanding sometimes causes errors when attempting to access ancestors
(org-mode)
(insert "* "
txt
"\t"
(or (and tags (s-join ":" `(nil ,@(cl-remove-duplicates tags) 
nil)))
"")
"\n")
(font-lock-fontify-buffer)
(goto-char (point-min))
(looking-at "^\\* \\(\\([^\t]+\\)[  
]+\\(:\\([[:alnum:]_@#%:]+\\):\\)*\\)[  ]*$")
(setq txt (match-string 2))
(setq tags (and tags (s-split ":" (match-string 3) 't
  (list extra txt level category tags dotime remove-re habitp)))
  )


Protesilaos Stavrou  writes:

> Dear all,
>
> I have noticed that Org faces that combine with headings do not adapt to
> their context.  This applies to keywords, priority cookies, links, and
> possibly other elements as well.
>
> For example, a "todo" keyword (`org-todo' face) will not scale in size
> to match that of the heading level (`org-level-N' face) if the latter
> uses a `:height' property.  Same principle for keywords not inheriting
> the heading's background, overline, etc.
>
> My expectation is to allow `org-level-N' to pass its attributes to any
> element on the same line, unless that element has conflicting face
> attributes of its own.  So, in my example, the heading could pass its
> height to the "todo" keyword when the `org-todo' face does not define a
> `:height' of its own.  Otherwise it would refrain from overriding that
> attribute.
>
> Does the community know of a solution to this issue?
>
> I am running:
>
> * Org mode version 9.3.
>
> * GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.17,
>   cairo version 1.17.3) of 2020-04-20.
>
> Best regards,
> Protesilaos
>
>
> -- 
> Protesilaos Stavrou
> protesilaos.com
>

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg



Adaptive Org faces in headings?

2020-04-26 Thread Protesilaos Stavrou
Dear all,

I have noticed that Org faces that combine with headings do not adapt to
their context.  This applies to keywords, priority cookies, links, and
possibly other elements as well.

For example, a "todo" keyword (`org-todo' face) will not scale in size
to match that of the heading level (`org-level-N' face) if the latter
uses a `:height' property.  Same principle for keywords not inheriting
the heading's background, overline, etc.

My expectation is to allow `org-level-N' to pass its attributes to any
element on the same line, unless that element has conflicting face
attributes of its own.  So, in my example, the heading could pass its
height to the "todo" keyword when the `org-todo' face does not define a
`:height' of its own.  Otherwise it would refrain from overriding that
attribute.

Does the community know of a solution to this issue?

I am running:

* Org mode version 9.3.

* GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.17,
  cairo version 1.17.3) of 2020-04-20.

Best regards,
Protesilaos


-- 
Protesilaos Stavrou
protesilaos.com



28.0.50; [bug] Inside help buffers escaped symbol[s] causing a problem.

2020-04-26 Thread Achilles Yuce


Hello Everyone,

After using `org-store-link`; i was expecting to jump back to what i
stored which is the buffer to see after evaluating (describe-symbol '\`)
but instead i got an `user-error` as you can see in [Recent messages:]
section in this report. I believe this shouldn't be the case. My exact
steps included in [Losage:] section.

FWIW I somehow managed to fix it by removing the '\'s from the captured
string defined in lisp/org/ol.el file. Also adding diff output.

Sincerely,

--
Achilles Yuce   GPG: B631 00A1 35BC 97C2 24A1
 3306 44F9 71F3 1CCF 32E2

=

Emacs Command:
emacs -Q

Starting Buffer:
*scratch*

Lossage: [`self-insert-command`s simplified for readability]
 M-x;; execute-extended-command
 org-mode   ;; self-insert-command
;; minibuffer-complete-and-exit
 C-h o  ;; describe-symbol
 `  ;; self-insert-command
;; minibuffer-complete-and-exit
 C-x o  ;; other-window
 M-x;; execute-extended-command
 org-store-link ;; self-insert-command
;; minibuffer-complete-and-exit
 C-x o  ;; other-window
 C-c C-l;; org-insert-link
 M-p;; previous-history-element
;; exit-minibuffer
 backquote  ;; self-insert-command
;; exit-minibuffer
 C-b;; backward-char
 C-c C-o;; org-open-at-point

Recent messages:
Stored: help:\`
user-error: Unknown function or variable: \`

Diff:
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -1465,10 +1465,11 @@ org-store-link
  (org-link-store-props :type "calendar" :date cd)))

((eq major-mode 'help-mode)
-   (setq link (concat "help:" (save-excursion
-(goto-char (point-min))
-(looking-at "^[^ ]+")
-(match-string 0
+   (setq link (replace-regexp-in-string "" ""
+ (concat "help:" (save-excursion
+ (goto-char (point-min))
+ (looking-at "^[^ ]+")
+ (match-string 0)
(org-link-store-props :type "help"))

((eq major-mode 'w3-mode)


In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.17, cairo 
version 1.17.3)
 of 2020-04-26 built on machine
Repository revision: 9dccaf8a5cdb10dae597345ec3741475477a7d97
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Arch Linux

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Org

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail timezone eieio-opt cl-extra
speedbar ezimage dframe thingatpt help-fns radix-tree help-mode
org-element avl-tree generator ol-eww ol-rmail ol-mhe ol-irc ol-info
ol-gnus nnir gnus-sum url url-proxy url-privacy url-expand url-methods
url-history mailcap shr url-cookie url-domsuf url-util url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs json map
url-vars svg xml dom browse-url gnus-group gnus-undo gnus-start
gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time iso8601
gnus-spec gnus-int gnus-range message rmc puny rfc822 mml mml-sec
password-cache epa derived epg epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search seq byte-opt gv bytecomp byte-compile cconv
mail-utils mm-util mail-prsvr wid-edit ol-docview doc-view jka-compr
image-mode exif dired dired-loaddefs ol-bibtex bibtex ol-bbdb ol-w3m org
ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote
org-src ob-comint org-pcomplete pcomplete comint ansi-color ring
org-list org-faces org-entities time-date subr-x noutline outline
easy-mmode org-version ob-emacs-lisp ob-core ob-eval org-table ol
org-keys org-compat advice org-macs org-loaddefs format-spec find-func
cal-menu easymenu calendar cal-loaddefs cl-loaddefs cl-lib