emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [tip] Export and open a PDF in Android via Termux
@ 2022-05-15 11:54 Juan Manuel Macías
  2022-05-16  8:04 ` Eric S Fraga
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Juan Manuel Macías @ 2022-05-15 11:54 UTC (permalink / raw)
  To: orgmode

Hi all,

I have recently installed TeX live on Android inside Termux:

$ pkg install texlive-installer

(https://wiki.termux.com/wiki/TeX_Live)

And I've managed to open a PDF exported from Org using an external
android viewer (mupdf, downloaded from f-droid). The Termux command is
termux-open. You need to add:

(setq org-file-apps
      '((auto-mode . emacs)
 (directory . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . "termux-open %s")))

It is necessary also to uncomment the line 'allow-external-apps = true' in '~/.termux/termux.properties'.

And to open the PDF from AUCTeX:

(setq TeX-view-program-list '(("termux" "termux-open %o")))

(setq TeX-view-program-selection
'(((output-dvi has-no-display-manager)
  "dvi2tty")
 ((output-dvi style-pstricks)
  "dvips and gv")
 (output-dvi "xdvi")
 (output-pdf "termux")
 (output-html "xdg-open")))

A screencast: https://imgur.com/a/iBvwDTo

Best regards,

Juan Manuel 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-15 11:54 [tip] Export and open a PDF in Android via Termux Juan Manuel Macías
@ 2022-05-16  8:04 ` Eric S Fraga
  2022-05-16 12:35 ` Ihor Radchenko
  2022-05-16 15:00 ` Max Nikulin
  2 siblings, 0 replies; 10+ messages in thread
From: Eric S Fraga @ 2022-05-16  8:04 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Thank you for this. Very helpful.  I use termux to take org notes on the
move.  I don't often have to create a PDF but it's nice to know how to
do it and be able to view it.  And, best of all, is the pointer to
mu-pdf!
-- 
: Eric S Fraga, with org release_9.5.3-504-gcdbb1c in Emacs 29.0.50


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-15 11:54 [tip] Export and open a PDF in Android via Termux Juan Manuel Macías
  2022-05-16  8:04 ` Eric S Fraga
@ 2022-05-16 12:35 ` Ihor Radchenko
  2022-05-16 15:00 ` Max Nikulin
  2 siblings, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2022-05-16 12:35 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Juan Manuel Macías <maciaschain@posteo.net> writes:

> I have recently installed TeX live on Android inside Termux:
>
> $ pkg install texlive-installer
>
> (https://wiki.termux.com/wiki/TeX_Live)
>
> And I've managed to open a PDF exported from Org using an external
> android viewer (mupdf, downloaded from f-droid). The Termux command is
> termux-open. You need to add:
>
> (setq org-file-apps
>       '((auto-mode . emacs)
>  (directory . emacs)
>  ("\\.mm\\'" . default)
>  ("\\.x?html?\\'" . default)
>  ("\\.pdf\\'" . "termux-open %s")))

Thanks for sharing! I am wondering if tips like this should be added to
worg.

Best,
Ihor


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-15 11:54 [tip] Export and open a PDF in Android via Termux Juan Manuel Macías
  2022-05-16  8:04 ` Eric S Fraga
  2022-05-16 12:35 ` Ihor Radchenko
@ 2022-05-16 15:00 ` Max Nikulin
  2022-05-16 16:05   ` Juan Manuel Macías
  2 siblings, 1 reply; 10+ messages in thread
From: Max Nikulin @ 2022-05-16 15:00 UTC (permalink / raw)
  To: emacs-orgmode

On 15/05/2022 18:54, Juan Manuel Macías wrote:
> 
> (setq org-file-apps
>        '((auto-mode . emacs)
>   (directory . emacs)
>   ("\\.mm\\'" . default)
>   ("\\.x?html?\\'" . default)
>   ("\\.pdf\\'" . "termux-open %s")))

Does termux have a notion of mailcap, e.g. mime-support package or 
something similar? I have a hope that

     application/pdf; termux-open %s

in /etc/mailcap or in ~/.mailcap might be enough instead of explicit 
configuration of particular packages.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-16 15:00 ` Max Nikulin
@ 2022-05-16 16:05   ` Juan Manuel Macías
  2022-05-17 16:22     ` Max Nikulin
  0 siblings, 1 reply; 10+ messages in thread
From: Juan Manuel Macías @ 2022-05-16 16:05 UTC (permalink / raw)
  To: Max Nikulin; +Cc: Ihor Radchenko, Eric S. Fraga, orgmode

Max Nikulin writes:

> Does termux have a notion of mailcap, e.g. mime-support package or
> something similar? I have a hope that
>
>     application/pdf; termux-open %s
>
> in /etc/mailcap or in ~/.mailcap might be enough instead of explicit
> configuration of particular packages.

I've been playing with Termux for a short time and what you're
suggesting hadn't occurred to me. Indeed, it works fine with a
~/.mailcap file! I have done a test with an attachment in Gnus:

https://imgur.com/a/g1Auvxp

Termux is quite interesting (and addictive :-)). Now I am playing with
Termux-api to send notifications from Emacs/Gnus to Android (with
gnus-desktop-notifier and the termux-notification command). And also to
send sms from Emacs and bbdb...

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-16 16:05   ` Juan Manuel Macías
@ 2022-05-17 16:22     ` Max Nikulin
  2022-05-17 17:56       ` Juan Manuel Macías
  0 siblings, 1 reply; 10+ messages in thread
From: Max Nikulin @ 2022-05-17 16:22 UTC (permalink / raw)
  To: emacs-orgmode

On 16/05/2022 23:05, Juan Manuel Macías wrote:
> Max Nikulin writes:
> 
> Termux is quite interesting (and addictive :-)). Now I am playing with
> Termux-api to send notifications from Emacs/Gnus to Android (with
> gnus-desktop-notifier and the termux-notification command). And also to
> send sms from Emacs and bbdb...

Do termux and emacs build for it have support of D-Bus or notify-send 
binary? The following thread is related to MacOS, but the discussion was 
a bit more general. Android notification may have more features though.

stardiviner to emacs-orgmode. [PATCH] make org-notify support for macOS 
desktop notification. Sun, 4 Jul 2021 08:23:03 +0800. 
https://list.orgmode.org/5B57CD8B-AA91-4C63-A449-A07364083AEE@gmail.com

I have not tried termux, but I agree that it is an interesting project. 
Unfortunately it is against various policies (only binaries from the 
application package are allowed, even access to filesystem is considered 
unsafe, etc.). Unsure if it is possible to implement a kind of 
virtualization to hide processes from the host system but to keep 
integration with platform. Unfortunately during struggle with 
applications requiring unreasonable permissions and with malware, 
legitimate applications suffer as well (e.g. KDE Connect).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-17 16:22     ` Max Nikulin
@ 2022-05-17 17:56       ` Juan Manuel Macías
  2022-05-18 16:14         ` Max Nikulin
  2022-05-19  9:40         ` Eric S Fraga
  0 siblings, 2 replies; 10+ messages in thread
From: Juan Manuel Macías @ 2022-05-17 17:56 UTC (permalink / raw)
  To: Max Nikulin; +Cc: orgmode

Max Nikulin writes:

> Do termux and emacs build for it have support of D-Bus or notify-send
> binary?

I'm not sure, but I would say yes, because Termux has a repository for
X11 applications and to be able to run desktop environments and
graphical applications (via VNC). But in such a case, I understand that
notify-send would only have life within that frame.

Full GNU/Linux distros can also be installed on termux in a proot
environment. In fact, there is another application, andronix, which
speeds up the process through a series of scripts. Recently I tried
to install using Arch and it worked fine (at least in the installation,
another thing is what can be done in there...).

Anyway, I agree with you about the caveats you mention around termux.
Termux and those other neighboring projects are very notable but they
are still (to put it in some way) juggling games and tightrope walks
without a net. A year ago I made the decision not to use a smartphone,
but lately I have been forced to go back to these devices for work
reasons, so I thought of Termux as the foreigner who is in a strange
land and finds something familiar :- ) The ideal would be a smartphone
running GNU/Linux, but there seems to be a long way to go: hostile
hardware, no drivers... I'm more or less aware of projects like librem
or pinephone, but I'm too lazy to do the disbursement...

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-17 17:56       ` Juan Manuel Macías
@ 2022-05-18 16:14         ` Max Nikulin
  2022-05-19  9:40         ` Eric S Fraga
  1 sibling, 0 replies; 10+ messages in thread
From: Max Nikulin @ 2022-05-18 16:14 UTC (permalink / raw)
  To: emacs-orgmode

On 18/05/2022 00:56, Juan Manuel Macías wrote:
> Max Nikulin writes:
> 
>> Do termux and emacs build for it have support of D-Bus or notify-send
>> binary?
> 
> I'm not sure, but I would say yes, because Termux has a repository for
> X11 applications and to be able to run desktop environments and
> graphical applications (via VNC). But in such a case, I understand that
> notify-send would only have life within that frame.

I expected some drop-in replacement for notify-send that creates native 
android notifications might exist
https://github.com/termux/termux-packages/issues/9923

or even more generally an implementation of d-bus server that is 
interface to android API
https://specifications.freedesktop.org/notification-spec/latest/ar01s09.html



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-17 17:56       ` Juan Manuel Macías
  2022-05-18 16:14         ` Max Nikulin
@ 2022-05-19  9:40         ` Eric S Fraga
  2022-05-19 18:01           ` Juan Manuel Macías
  1 sibling, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2022-05-19  9:40 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

On Tuesday, 17 May 2022 at 17:56, Juan Manuel Macías wrote:
> but lately I have been forced to go back to these devices for work
> reasons, so I thought of Termux as the foreigner who is in a strange

Same with me.  I have to have a smartphone as our institution made the
decision to remove all landlines and have all staff use MS Teams as our
work "phone".  I use termux to give me access to Emacs + org so that I
at least get some real use out of the "smart"phone.

-- 
: Eric S Fraga, with org release_9.5.3-504-gcdbb1c in Emacs 29.0.50


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip] Export and open a PDF in Android via Termux
  2022-05-19  9:40         ` Eric S Fraga
@ 2022-05-19 18:01           ` Juan Manuel Macías
  0 siblings, 0 replies; 10+ messages in thread
From: Juan Manuel Macías @ 2022-05-19 18:01 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: orgmode

Eric S Fraga writes:

> Same with me.  I have to have a smartphone as our institution made the
> decision to remove all landlines and have all staff use MS Teams as our
> work "phone".  I use termux to give me access to Emacs + org so that I
> at least get some real use out of the "smart"phone.

Smartphones are the opium of the 21st century... And worst of all, they
will become the new identity cards. For example, until recently I could
do transactions with my bank through its website. But now it is
mandatory to have a smartphone and download an application, of course
proprietary.

Anyway, termux and Emacs, without a physical keyboard, is torture. I
usually connect a compact mechanical keyboard that I have for my laptop.

By the way, I've noticed how easy it is to write Elisp functions that
call Termux commands from Emacs. I recently wrote this to send SMS (you
can enter the phone number directly or choose a contact saved in BBDB
data base, if you use BBDB). To see the list of contacts it works better
if you use also some completion framework like ivy or helm:

(defun send-sms ()
  (interactive)
  (save-window-excursion (bbdb ".+"))
  (let* ((tlf (if (yes-or-no-p "Enter a contact: ")
		  (let ((record (bbdb-get-records "Contact: ")))
		    (aref
		     (car (aref (car record) 5)) 1))
		(read-from-minibuffer "Phone number: ")))
	 (sms (read-from-minibuffer "Texto del SMS: "))
	 (cmd (format "termux-sms-send -n %s %s" tlf sms)))
    (call-process-shell-command cmd)))

Best regards,

Juan Manuel


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-19 18:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-15 11:54 [tip] Export and open a PDF in Android via Termux Juan Manuel Macías
2022-05-16  8:04 ` Eric S Fraga
2022-05-16 12:35 ` Ihor Radchenko
2022-05-16 15:00 ` Max Nikulin
2022-05-16 16:05   ` Juan Manuel Macías
2022-05-17 16:22     ` Max Nikulin
2022-05-17 17:56       ` Juan Manuel Macías
2022-05-18 16:14         ` Max Nikulin
2022-05-19  9:40         ` Eric S Fraga
2022-05-19 18:01           ` Juan Manuel Macías

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).