Re: Read only org view mode

2022-01-24 Thread Russell Adams
On Mon, Jan 24, 2022 at 11:40:05AM +, Neil Jerram wrote:
> On Mon, 24 Jan 2022, 11:14 Russell Adams,  wrote:
>
> > Why not just do an ASCII export to a temporary read only buffer for
> > viewing?
>
> Do you mean that you're agreeing with the concept, but finding the
> implementation unnecessarily complicated?

I'm not being negative about the concept. I'm asking if the poster had
considered using the built-in tools before creating another new
library.

I did a short look at the site and the assertion "view org with less
markup", and that was my first impression.

I had two thoughts. The first was if the markup is a problem and you
want a read only view, why not use the built in ascii export to a
buffer and view that buffer? I just hit C-c C-e t A and M-x
read-only-mode and was able to navigate my ascii org file as a read
only buffer.

Second thought was that Org's syntax was supposed to minimize the
markup so it didn't negatively impact reading. Maybe the poster is
identifying a pain point we should be aware of as a community, ie:
that too much markup makes it hard to read.

My impression is only property drawers and source blocks are
potentially visually loud compared to the other markup. Timestamps are
pretty minimal and links already only show a descriptive text instead
of the full [[]] syntax.


--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: Read only org view mode

2022-01-24 Thread Neil Jerram
On Mon, 24 Jan 2022, 11:14 Russell Adams,  wrote:

> Why not just do an ASCII export to a temporary read only buffer for
> viewing?
>

Do you mean that you're agreeing with the concept, but finding the
implementation unnecessarily complicated?


> I always thought the point of Org was to have minimal markup so that
> the native file was plainly legible.
>
> On Sun, Jan 23, 2022 at 08:19:12AM +0100, Arthur Miller wrote:
> > Hi mailing list,
> >
> > is something like this of interest to add to org-mode?
> >
> > Attached is a prototype to a read-only view mode. It tries to hide as
> much of
> > markup as possible to make it more "readable". It uses built-in
> view-mode to
> > make the buffer read only and enable some common commands. I plan to add
> more
> > "dired like" movement though.
> >
> > I don't claim it is very well written or efficient; I appreciate input
> on that
> > regard. To note is that I use minor-modes as "toggles", to make the
> > functionality avialable as "solo pieces" as well as a code generation
> tool.
> >
> > I am just checking interest here. More info and a screencast are
> avialable at:
> >
> > https://github.com/amno1/org-view-mode
> >
>
> > ;;; org-view-mode.el --- Read-only viewer with less markup clutter in
> org mode files  -*- lexical-binding: t; -*-
> >
> > ;; Copyright (C) 2021  Arthur Miller
> >
> > ;; Author: Arthur Miller 
> > ;; Keywords: convenience, outlines, tools
> >
> > ;; This program is free software; you can redistribute it and/or modify
> > ;; it under the terms of the GNU General Public License as published by
> > ;; the Free Software Foundation, either version 3 of the License, or
> > ;; (at your option) any later version.
> >
> > ;; This program is distributed in the hope that it will be useful,
> > ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> > ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > ;; GNU General Public License for more details.
> >
> > ;; You should have received a copy of the GNU General Public License
> > ;; along with this program.  If not, see  >.
> >
> > ;; Author: Arthur Miller
> > ;; Version: 0.0.1
> > ;; Keywords: tools convenience
> > ;; Package-Requires: ((emacs "24.1"))
> > ;; URL: https://github.com/amno1/org-view-mode
> >
> > ;;; Commentary:
> >
> > ;; A minor mode to help reduce clutter in org-mode files by
> > ;; hiding/unhiding org-mode markup language
> > ;;
> > ;; To turn it on execute:
> > ;;
> > ;;  `M-x org-view-mode'.
> > ;;
> > ;; To turn it off execute the same command.
> >
> > ;;; Issues
> >
> > ;;; Code:
> > (require 'org)
> >
> > (defgroup org-view nil
> >   "Hide tags in org-headings."
> >   :prefix "org-view-"
> >   :group 'org)
> >
> > (defvar-local org-view-center-credentials nil
> >   "Whether to align title and author in center or not.
> >
> > Centering is done pixel wise relative to window width.")
> >
> > (defcustom org-view-diminish-mode t
> >   "Hide lighters for individual minor modes when org-view-mode is on."
> >   :type 'boolean
> >   :group 'org-view)
> >
> > (defvar org-view-stars-re "^[ \t]*\\*+"
> >   "Regex used to recognize leading stars in org-headings.")
> >
> > (defvar org-view-credentials-re "[ \t]*#\\+\\(TITLE\\|AUTHOR\\):"
> >   "Regex used to update author and title lines.")
> >
> > (defun org-view--update-tags (visibility)
> >   "Update invisible property to VISIBILITY for tags in the current
> buffer."
> >   (save-excursion
> > (goto-char (point-min))
> > (with-silent-modifications
> >   (while (re-search-forward org-view-stars-re nil t)
> > (goto-char (line-end-position))
> > (when (re-search-backward org-tag-line-re
> (line-beginning-position) t)
> > (put-text-property
> >  (match-beginning 1) (match-end 1) 'invisible visibility))
> >   (forward-line)
> >
> > (defun org-view--update-keywords (visibility)
> >   "Set VISIBILITY for each line starting with a keyword from KEYWORDS
> list."
> >   (org-with-wide-buffer
> >(save-excursion
> >  (with-silent-modifications
> >(goto-char (point-min))
> >(while (re-search-forward "^[ \t]*#\\+.*$" nil t)
> >  (goto-char (match-beginning 0))
> >  (unless (looking-at-p org-view-credentials-re)
> >(put-text-property
> > (1- (match-beginning 0)) (match-end 0) 'invisible
> visibility))
> >  (goto-char (match-end 0)))
> >
> > (defun org-view--update-properties (visibility)
> >   "Set invisible property to VISIBILITY for properties in the current
> buffer."
> >   (org-with-wide-buffer
> >(save-excursion
> >  (with-silent-modifications
> >(goto-char (point-min))
> >(while (re-search-forward org-property-drawer-re nil t)
> >  (put-text-property
> >   (match-beginning 0) (match-end 0) 'invisible visibility))
> >(goto-char (point-min))
> >(while (re-search-forward "^[ 

Re: Read only org view mode

2022-01-24 Thread Russell Adams
Why not just do an ASCII export to a temporary read only buffer for
viewing?

I always thought the point of Org was to have minimal markup so that
the native file was plainly legible.

On Sun, Jan 23, 2022 at 08:19:12AM +0100, Arthur Miller wrote:
> Hi mailing list,
>
> is something like this of interest to add to org-mode?
>
> Attached is a prototype to a read-only view mode. It tries to hide as much of
> markup as possible to make it more "readable". It uses built-in view-mode to
> make the buffer read only and enable some common commands. I plan to add more
> "dired like" movement though.
>
> I don't claim it is very well written or efficient; I appreciate input on that
> regard. To note is that I use minor-modes as "toggles", to make the
> functionality avialable as "solo pieces" as well as a code generation tool.
>
> I am just checking interest here. More info and a screencast are avialable at:
>
> https://github.com/amno1/org-view-mode
>

> ;;; org-view-mode.el --- Read-only viewer with less markup clutter in org 
> mode files  -*- lexical-binding: t; -*-
>
> ;; Copyright (C) 2021  Arthur Miller
>
> ;; Author: Arthur Miller 
> ;; Keywords: convenience, outlines, tools
>
> ;; This program is free software; you can redistribute it and/or modify
> ;; it under the terms of the GNU General Public License as published by
> ;; the Free Software Foundation, either version 3 of the License, or
> ;; (at your option) any later version.
>
> ;; This program is distributed in the hope that it will be useful,
> ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;; GNU General Public License for more details.
>
> ;; You should have received a copy of the GNU General Public License
> ;; along with this program.  If not, see .
>
> ;; Author: Arthur Miller
> ;; Version: 0.0.1
> ;; Keywords: tools convenience
> ;; Package-Requires: ((emacs "24.1"))
> ;; URL: https://github.com/amno1/org-view-mode
>
> ;;; Commentary:
>
> ;; A minor mode to help reduce clutter in org-mode files by
> ;; hiding/unhiding org-mode markup language
> ;;
> ;; To turn it on execute:
> ;;
> ;;  `M-x org-view-mode'.
> ;;
> ;; To turn it off execute the same command.
>
> ;;; Issues
>
> ;;; Code:
> (require 'org)
>
> (defgroup org-view nil
>   "Hide tags in org-headings."
>   :prefix "org-view-"
>   :group 'org)
>
> (defvar-local org-view-center-credentials nil
>   "Whether to align title and author in center or not.
>
> Centering is done pixel wise relative to window width.")
>
> (defcustom org-view-diminish-mode t
>   "Hide lighters for individual minor modes when org-view-mode is on."
>   :type 'boolean
>   :group 'org-view)
>
> (defvar org-view-stars-re "^[ \t]*\\*+"
>   "Regex used to recognize leading stars in org-headings.")
>
> (defvar org-view-credentials-re "[ \t]*#\\+\\(TITLE\\|AUTHOR\\):"
>   "Regex used to update author and title lines.")
>
> (defun org-view--update-tags (visibility)
>   "Update invisible property to VISIBILITY for tags in the current buffer."
>   (save-excursion
> (goto-char (point-min))
> (with-silent-modifications
>   (while (re-search-forward org-view-stars-re nil t)
> (goto-char (line-end-position))
> (when (re-search-backward org-tag-line-re (line-beginning-position) t)
> (put-text-property
>  (match-beginning 1) (match-end 1) 'invisible visibility))
>   (forward-line)
>
> (defun org-view--update-keywords (visibility)
>   "Set VISIBILITY for each line starting with a keyword from KEYWORDS list."
>   (org-with-wide-buffer
>(save-excursion
>  (with-silent-modifications
>(goto-char (point-min))
>(while (re-search-forward "^[ \t]*#\\+.*$" nil t)
>  (goto-char (match-beginning 0))
>  (unless (looking-at-p org-view-credentials-re)
>(put-text-property
> (1- (match-beginning 0)) (match-end 0) 'invisible visibility))
>  (goto-char (match-end 0)))
>
> (defun org-view--update-properties (visibility)
>   "Set invisible property to VISIBILITY for properties in the current buffer."
>   (org-with-wide-buffer
>(save-excursion
>  (with-silent-modifications
>(goto-char (point-min))
>(while (re-search-forward org-property-drawer-re nil t)
>  (put-text-property
>   (match-beginning 0) (match-end 0) 'invisible visibility))
>(goto-char (point-min))
>(while (re-search-forward "^[ \t]*#\\+PROPERTY:.*$" nil t)
>  (put-text-property
>   (1- (match-beginning 0)) (1+ (match-end 0)) 'invisible 
> visibility))
>
> (defun org-view--update-stars (visibility)
>   "Update invisible property to VISIBILITY for markers in the current buffer."
>   (org-with-wide-buffer
>(save-excursion
>  (goto-char (point-min))
>  (with-silent-modifications
>(while (re-search-forward org-view-stars-re nil t)
>  

Re: Read only org view mode

2022-01-24 Thread Neil Jerram
Hi Arthur,

On Sun, 23 Jan 2022 at 07:53, Arthur Miller  wrote:
>
> Hi mailing list,
>
> is something like this of interest to add to org-mode?

I'm interested in Linux-native smartphones (e.g. the Pine Phone) and
in using Org there as fully as possible.  I probably wouldn't _alter_
my Org content on the phone as extensively as I do on a laptop, but
I'd certainly like to _see_ all my Org content and have something like
an agenda.  Then the question arises of how best to display that
content and support occasional editing of it.  Apps like Orgzly have
been developed to meet this need, but (a) Orgzly is Android-specific,
and (b) I would really love if a good answer could be: simply run
Emacs on the phone and view your Org content that way.  A read-only
Org view mode feels like it could be a very useful ingredient for
that!

Best wishes,
   Neil



Re: Read only org view mode

2022-01-23 Thread Marcin Borkowski


On 2022-01-23, at 08:19, Arthur Miller  wrote:

> Hi mailing list,
>
> is something like this of interest to add to org-mode?

Yes! Yes! Yes!

I can see all sorts of stuff going from here.  Three examples follow.

1. I have a daily journal in Org-mode, and I wrote a simple function
showing me "what happened on this day in all previous years of
journaling".  Making that read-only, with view-mode-like bindings is an
obvious thing to do.  (In fact, I plan to blog about that function
soon.)

2. I imagine this could be used to create menus, a bit like Magit, with
toggleable sections etc.

3. I once coded myself a kind of "dashboard", showing various things in
(almost) real time - think current time, weather, departures of busses
from a nearby bus stop, Emacs uptime, number of open buffers, a todo
list for today etc.  (Sadly, I didn't finish it, though.)  A mode
derived from your mode could be great for that.

Thanks a lot for working on this,

-- 
Marcin Borkowski
http://mbork.pl



Read only org view mode

2022-01-22 Thread Arthur Miller
Hi mailing list,

is something like this of interest to add to org-mode?

Attached is a prototype to a read-only view mode. It tries to hide as much of
markup as possible to make it more "readable". It uses built-in view-mode to
make the buffer read only and enable some common commands. I plan to add more
"dired like" movement though.

I don't claim it is very well written or efficient; I appreciate input on that
regard. To note is that I use minor-modes as "toggles", to make the
functionality avialable as "solo pieces" as well as a code generation tool.

I am just checking interest here. More info and a screencast are avialable at:

https://github.com/amno1/org-view-mode

;;; org-view-mode.el --- Read-only viewer with less markup clutter in org mode 
files  -*- lexical-binding: t; -*-

;; Copyright (C) 2021  Arthur Miller

;; Author: Arthur Miller 
;; Keywords: convenience, outlines, tools

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see .

;; Author: Arthur Miller
;; Version: 0.0.1
;; Keywords: tools convenience
;; Package-Requires: ((emacs "24.1"))
;; URL: https://github.com/amno1/org-view-mode

;;; Commentary:

;; A minor mode to help reduce clutter in org-mode files by
;; hiding/unhiding org-mode markup language
;;
;; To turn it on execute:
;;
;;  `M-x org-view-mode'.
;;
;; To turn it off execute the same command.

;;; Issues

;;; Code:
(require 'org)

(defgroup org-view nil
  "Hide tags in org-headings."
  :prefix "org-view-"
  :group 'org)

(defvar-local org-view-center-credentials nil
  "Whether to align title and author in center or not.

Centering is done pixel wise relative to window width.")

(defcustom org-view-diminish-mode t
  "Hide lighters for individual minor modes when org-view-mode is on."
  :type 'boolean
  :group 'org-view)

(defvar org-view-stars-re "^[ \t]*\\*+"
  "Regex used to recognize leading stars in org-headings.")

(defvar org-view-credentials-re "[ \t]*#\\+\\(TITLE\\|AUTHOR\\):"
  "Regex used to update author and title lines.")

(defun org-view--update-tags (visibility)
  "Update invisible property to VISIBILITY for tags in the current buffer."
  (save-excursion
(goto-char (point-min))
(with-silent-modifications
  (while (re-search-forward org-view-stars-re nil t)
(goto-char (line-end-position))
(when (re-search-backward org-tag-line-re (line-beginning-position) t)
(put-text-property
 (match-beginning 1) (match-end 1) 'invisible visibility))
  (forward-line)

(defun org-view--update-keywords (visibility)
  "Set VISIBILITY for each line starting with a keyword from KEYWORDS list."
  (org-with-wide-buffer
   (save-excursion
 (with-silent-modifications
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*#\\+.*$" nil t)
 (goto-char (match-beginning 0))
 (unless (looking-at-p org-view-credentials-re)
   (put-text-property
(1- (match-beginning 0)) (match-end 0) 'invisible visibility))
 (goto-char (match-end 0)))

(defun org-view--update-properties (visibility)
  "Set invisible property to VISIBILITY for properties in the current buffer."
  (org-with-wide-buffer
   (save-excursion
 (with-silent-modifications
   (goto-char (point-min))
   (while (re-search-forward org-property-drawer-re nil t)
 (put-text-property
  (match-beginning 0) (match-end 0) 'invisible visibility))
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*#\\+PROPERTY:.*$" nil t)
 (put-text-property
  (1- (match-beginning 0)) (1+ (match-end 0)) 'invisible 
visibility))

(defun org-view--update-stars (visibility)
  "Update invisible property to VISIBILITY for markers in the current buffer."
  (org-with-wide-buffer
   (save-excursion
 (goto-char (point-min))
 (with-silent-modifications
   (while (re-search-forward org-view-stars-re nil t)
 (put-text-property
  (match-beginning 0) (match-end 0) 'invisible visibility))

(defun org-view--update-credentials (visibility)
  "Set invisible property to VISIBILITY for export settings."
  (org-with-wide-buffer
   (save-excursion
 (with-silent-modifications
   (goto-char (point-min)) 
   (while (re-search-forward org-view-credentials-re nil t)
 (put-text-property
  (match-beginning 0) (match-end 0) 'invisible visibility)