* a quick way to switch orgmode notes between read-only/editing?
@ 2014-07-17 12:40 Xebar Saram
2014-07-17 13:13 ` Thorsten Jolitz
2014-07-17 14:46 ` Jorge A. Alfaro-Murillo
0 siblings, 2 replies; 16+ messages in thread
From: Xebar Saram @ 2014-07-17 12:40 UTC (permalink / raw)
To: org mode
[-- Attachment #1: Type: text/plain, Size: 565 bytes --]
hi all
i keep once and a while screwing up my notes with unintended editing
(erroneous key presses etc) and was wondering if any one knew of a way
to to switch orgmode notes between read-only/editing? i have used such
options in previous note taking apps that had that option build in but i
understand that since orgmode notes are just text files its a bit more
complicated
i would love to hear any suggestions on how you guys deal with protecting
notes/data that still needs to be edited (i do use git ofc but i dont
always know i screwed my notes :))
best
Z.
[-- Attachment #2: Type: text/html, Size: 880 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 12:40 a quick way to switch orgmode notes between read-only/editing? Xebar Saram
@ 2014-07-17 13:13 ` Thorsten Jolitz
2014-07-17 13:22 ` Xebar Saram
2014-07-17 14:46 ` Jorge A. Alfaro-Murillo
1 sibling, 1 reply; 16+ messages in thread
From: Thorsten Jolitz @ 2014-07-17 13:13 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> hi all
>
> i keep once and a while screwing up my notes with unintended editing
> (erroneous key presses etc) and was wondering if any one knew of a way
> to to switch orgmode notes between read-only/editing? i have used such
> options in previous note taking apps that had that option build in but
> i understand that since orgmode notes are just text files its a bit
> more complicated
>
> i would love to hear any suggestions on how you guys deal with
> protecting notes/data that still needs to be edited (i do use git ofc
> but i dont always know i screwed my notes :))
,----[ C-h f view-mode RET ]
| view-mode is an interactive autoloaded compiled Lisp function in
| `view.el'.
|
| (view-mode &optional ARG)
|
| Toggle View mode, a minor mode for viewing text but not editing it.
| With a prefix argument ARG, enable View mode if ARG is positive,
| and disable it otherwise. If called from Lisp, enable View mode
| if ARG is omitted or nil.
|
| When View mode is enabled, commands that do not change the buffer
| contents are available as usual. Kill commands insert text in
| kill buffers but do not delete. Most other commands beep and
| tell the user that the buffer is read-only.
|
|
|
| The following additional commands are provided. Most commands
| take prefix arguments. Page commands default to "page size"
| lines which is almost a whole window, or number of lines set by
| z or w.
| Half page commands default to and set "half page size" lines
| which initially is half a window full. Search commands default
| to a repeat count of one.
|
| H, h, ? This message.
| Digits provide prefix arguments.
| - negative prefix argument.
| < move to the beginning of buffer.
| > move to the end of buffer.
| o scroll so that buffer end is at last line of window.
| SPC scroll forward "page size" lines.
| With prefix scroll forward prefix lines.
| DEL scroll backward "page size" lines.
| With prefix scroll backward prefix lines.
| z like SPC but with prefix sets "page size" to prefix.
| w like DEL but with prefix sets "page size" to prefix.
| d scroll forward "half page size" lines. With prefix, sets
| "half page size" to prefix lines and scrolls forward that much.
| u scroll backward "half page size" lines. With prefix, sets
| "half page size" to prefix lines and scrolls backward that much.
| RET, LFD scroll forward one line. With prefix scroll forward prefix line(s).
| y scroll backward one line. With prefix scroll backward prefix line(s).
| F revert-buffer if necessary and scroll forward.
| Use this to view a changing file.
| = prints the current line number.
| % goes prefix argument (default 100) percent into buffer.
| g goes to line given by prefix argument (default first line).
| . set the mark.
| x exchanges point and mark.
| @ return to mark and pops mark ring.
| Mark ring is pushed at start of every successful search and when
| jump to line occurs. The mark is set on jump to buffer start or end.
| m save current position in character register.
| ' go to position saved in character register.
| s do forward incremental search.
| r do reverse incremental search.
| / searches forward for regular expression, starting after current page.
| ! and @ have a special meaning at the beginning of the regexp.
| ! means search for a line with no match for regexp. @ means start
| search at beginning (end for backward search) of buffer.
| \ searches backward for regular expression, starting before current page.
| n searches forward for last regular expression.
| p searches backward for last regular expression.
| q quit View mode, restoring this window and buffer to previous state.
| q is the normal way to leave view mode.
| e exit View mode but stay in current buffer. Use this if you started
| viewing a buffer (file) and find out you want to edit it.
| This command restores the previous read-only status of the buffer.
| E exit View mode, and make the current buffer editable
| even if it was not editable before entry to View mode.
| Q quit View mode, restoring all windows to previous state.
| c quit View mode and maybe switch buffers, but don't kill this buffer.
| C quit View mode, kill current buffer and go back to other buffer.
|
| The effect of c, q and C depends on how view-mode was entered. If it was
| entered by view-file, view-file-other-window, view-file-other-frame, or
| M-x dired-view-file (M-x view-file, M-x view-file-other-window,
| M-x view-file-other-frame, or the Dired mode v command),
| then q will try to kill the current buffer.
| If view-mode was entered from another buffer, by C-c v,
| M-x view-buffer-other-window, M-x view-buffer-other frame, M-x view-file,
| M-x view-file-other-window, or M-x view-file-other-frame,
| then c, q and C will return to that buffer.
|
| Entry to view-mode runs the normal hook `view-mode-hook'.
|
| [back]
`----
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 13:13 ` Thorsten Jolitz
@ 2014-07-17 13:22 ` Xebar Saram
2014-07-17 13:23 ` Xebar Saram
2014-07-17 13:57 ` Thorsten Jolitz
0 siblings, 2 replies; 16+ messages in thread
From: Xebar Saram @ 2014-07-17 13:22 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 5670 bytes --]
Thx Thorston this looks great
can you recommend a way to open all orgmode notes in view mode by default,
i guess i would then bind a key to disable view mode to start editing right?
thanks alot again
Z
On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > hi all
> >
> > i keep once and a while screwing up my notes with unintended editing
> > (erroneous key presses etc) and was wondering if any one knew of a way
> > to to switch orgmode notes between read-only/editing? i have used such
> > options in previous note taking apps that had that option build in but
> > i understand that since orgmode notes are just text files its a bit
> > more complicated
> >
> > i would love to hear any suggestions on how you guys deal with
> > protecting notes/data that still needs to be edited (i do use git ofc
> > but i dont always know i screwed my notes :))
>
> ,----[ C-h f view-mode RET ]
> | view-mode is an interactive autoloaded compiled Lisp function in
> | `view.el'.
> |
> | (view-mode &optional ARG)
> |
> | Toggle View mode, a minor mode for viewing text but not editing it.
> | With a prefix argument ARG, enable View mode if ARG is positive,
> | and disable it otherwise. If called from Lisp, enable View mode
> | if ARG is omitted or nil.
> |
> | When View mode is enabled, commands that do not change the buffer
> | contents are available as usual. Kill commands insert text in
> | kill buffers but do not delete. Most other commands beep and
> | tell the user that the buffer is read-only.
> |
> |
> |
> | The following additional commands are provided. Most commands
> | take prefix arguments. Page commands default to "page size"
> | lines which is almost a whole window, or number of lines set by
> | z or w.
> | Half page commands default to and set "half page size" lines
> | which initially is half a window full. Search commands default
> | to a repeat count of one.
> |
> | H, h, ? This message.
> | Digits provide prefix arguments.
> | - negative prefix argument.
> | < move to the beginning of buffer.
> | > move to the end of buffer.
> | o scroll so that buffer end is at last line of window.
> | SPC scroll forward "page size" lines.
> | With prefix scroll forward prefix lines.
> | DEL scroll backward "page size" lines.
> | With prefix scroll backward prefix lines.
> | z like SPC but with prefix sets "page size" to prefix.
> | w like DEL but with prefix sets "page size" to prefix.
> | d scroll forward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls forward that much.
> | u scroll backward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls backward that much.
> | RET, LFD scroll forward one line. With prefix scroll forward prefix
> line(s).
> | y scroll backward one line. With prefix scroll backward prefix
> line(s).
> | F revert-buffer if necessary and scroll forward.
> | Use this to view a changing file.
> | = prints the current line number.
> | % goes prefix argument (default 100) percent into buffer.
> | g goes to line given by prefix argument (default first line).
> | . set the mark.
> | x exchanges point and mark.
> | @ return to mark and pops mark ring.
> | Mark ring is pushed at start of every successful search and when
> | jump to line occurs. The mark is set on jump to buffer start or
> end.
> | m save current position in character register.
> | ' go to position saved in character register.
> | s do forward incremental search.
> | r do reverse incremental search.
> | / searches forward for regular expression, starting after current
> page.
> | ! and @ have a special meaning at the beginning of the regexp.
> | ! means search for a line with no match for regexp. @ means
> start
> | search at beginning (end for backward search) of buffer.
> | \ searches backward for regular expression, starting before current
> page.
> | n searches forward for last regular expression.
> | p searches backward for last regular expression.
> | q quit View mode, restoring this window and buffer to previous state.
> | q is the normal way to leave view mode.
> | e exit View mode but stay in current buffer. Use this if you started
> | viewing a buffer (file) and find out you want to edit it.
> | This command restores the previous read-only status of the
> buffer.
> | E exit View mode, and make the current buffer editable
> | even if it was not editable before entry to View mode.
> | Q quit View mode, restoring all windows to previous state.
> | c quit View mode and maybe switch buffers, but don't kill this
> buffer.
> | C quit View mode, kill current buffer and go back to other buffer.
> |
> | The effect of c, q and C depends on how view-mode was entered. If it was
> | entered by view-file, view-file-other-window, view-file-other-frame, or
> | M-x dired-view-file (M-x view-file, M-x view-file-other-window,
> | M-x view-file-other-frame, or the Dired mode v command),
> | then q will try to kill the current buffer.
> | If view-mode was entered from another buffer, by C-c v,
> | M-x view-buffer-other-window, M-x view-buffer-other frame, M-x view-file,
> | M-x view-file-other-window, or M-x view-file-other-frame,
> | then c, q and C will return to that buffer.
> |
> | Entry to view-mode runs the normal hook `view-mode-hook'.
> |
> | [back]
> `----
>
> --
> cheers,
> Thorsten
>
>
>
[-- Attachment #2: Type: text/html, Size: 6820 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 13:22 ` Xebar Saram
@ 2014-07-17 13:23 ` Xebar Saram
2014-07-17 13:50 ` Thorsten Jolitz
2014-07-17 13:53 ` Nick Dokos
2014-07-17 13:57 ` Thorsten Jolitz
1 sibling, 2 replies; 16+ messages in thread
From: Xebar Saram @ 2014-07-17 13:23 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 5996 bytes --]
PS. Also can anyone think of a way to get a visual cue when the file is in
"view mode"?
thx!
Z
On Thu, Jul 17, 2014 at 4:22 PM, Xebar Saram <zeltakc@gmail.com> wrote:
> Thx Thorston this looks great
>
> can you recommend a way to open all orgmode notes in view mode by default,
> i guess i would then bind a key to disable view mode to start editing right?
>
> thanks alot again
>
> Z
>
>
> On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz <tjolitz@gmail.com>
> wrote:
>
>> Xebar Saram <zeltakc@gmail.com> writes:
>>
>> > hi all
>> >
>> > i keep once and a while screwing up my notes with unintended editing
>> > (erroneous key presses etc) and was wondering if any one knew of a way
>> > to to switch orgmode notes between read-only/editing? i have used such
>> > options in previous note taking apps that had that option build in but
>> > i understand that since orgmode notes are just text files its a bit
>> > more complicated
>> >
>> > i would love to hear any suggestions on how you guys deal with
>> > protecting notes/data that still needs to be edited (i do use git ofc
>> > but i dont always know i screwed my notes :))
>>
>> ,----[ C-h f view-mode RET ]
>> | view-mode is an interactive autoloaded compiled Lisp function in
>> | `view.el'.
>> |
>> | (view-mode &optional ARG)
>> |
>> | Toggle View mode, a minor mode for viewing text but not editing it.
>> | With a prefix argument ARG, enable View mode if ARG is positive,
>> | and disable it otherwise. If called from Lisp, enable View mode
>> | if ARG is omitted or nil.
>> |
>> | When View mode is enabled, commands that do not change the buffer
>> | contents are available as usual. Kill commands insert text in
>> | kill buffers but do not delete. Most other commands beep and
>> | tell the user that the buffer is read-only.
>> |
>> |
>> |
>> | The following additional commands are provided. Most commands
>> | take prefix arguments. Page commands default to "page size"
>> | lines which is almost a whole window, or number of lines set by
>> | z or w.
>> | Half page commands default to and set "half page size" lines
>> | which initially is half a window full. Search commands default
>> | to a repeat count of one.
>> |
>> | H, h, ? This message.
>> | Digits provide prefix arguments.
>> | - negative prefix argument.
>> | < move to the beginning of buffer.
>> | > move to the end of buffer.
>> | o scroll so that buffer end is at last line of window.
>> | SPC scroll forward "page size" lines.
>> | With prefix scroll forward prefix lines.
>> | DEL scroll backward "page size" lines.
>> | With prefix scroll backward prefix lines.
>> | z like SPC but with prefix sets "page size" to prefix.
>> | w like DEL but with prefix sets "page size" to prefix.
>> | d scroll forward "half page size" lines. With prefix, sets
>> | "half page size" to prefix lines and scrolls forward that much.
>> | u scroll backward "half page size" lines. With prefix, sets
>> | "half page size" to prefix lines and scrolls backward that much.
>> | RET, LFD scroll forward one line. With prefix scroll forward prefix
>> line(s).
>> | y scroll backward one line. With prefix scroll backward prefix
>> line(s).
>> | F revert-buffer if necessary and scroll forward.
>> | Use this to view a changing file.
>> | = prints the current line number.
>> | % goes prefix argument (default 100) percent into buffer.
>> | g goes to line given by prefix argument (default first line).
>> | . set the mark.
>> | x exchanges point and mark.
>> | @ return to mark and pops mark ring.
>> | Mark ring is pushed at start of every successful search and when
>> | jump to line occurs. The mark is set on jump to buffer start
>> or end.
>> | m save current position in character register.
>> | ' go to position saved in character register.
>> | s do forward incremental search.
>> | r do reverse incremental search.
>> | / searches forward for regular expression, starting after current
>> page.
>> | ! and @ have a special meaning at the beginning of the regexp.
>> | ! means search for a line with no match for regexp. @ means
>> start
>> | search at beginning (end for backward search) of buffer.
>> | \ searches backward for regular expression, starting before current
>> page.
>> | n searches forward for last regular expression.
>> | p searches backward for last regular expression.
>> | q quit View mode, restoring this window and buffer to previous
>> state.
>> | q is the normal way to leave view mode.
>> | e exit View mode but stay in current buffer. Use this if you
>> started
>> | viewing a buffer (file) and find out you want to edit it.
>> | This command restores the previous read-only status of the
>> buffer.
>> | E exit View mode, and make the current buffer editable
>> | even if it was not editable before entry to View mode.
>> | Q quit View mode, restoring all windows to previous state.
>> | c quit View mode and maybe switch buffers, but don't kill this
>> buffer.
>> | C quit View mode, kill current buffer and go back to other buffer.
>> |
>> | The effect of c, q and C depends on how view-mode was entered. If it
>> was
>> | entered by view-file, view-file-other-window, view-file-other-frame, or
>> | M-x dired-view-file (M-x view-file, M-x view-file-other-window,
>> | M-x view-file-other-frame, or the Dired mode v command),
>> | then q will try to kill the current buffer.
>> | If view-mode was entered from another buffer, by C-c v,
>> | M-x view-buffer-other-window, M-x view-buffer-other frame, M-x
>> view-file,
>> | M-x view-file-other-window, or M-x view-file-other-frame,
>> | then c, q and C will return to that buffer.
>> |
>> | Entry to view-mode runs the normal hook `view-mode-hook'.
>> |
>> | [back]
>> `----
>>
>> --
>> cheers,
>> Thorsten
>>
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 7376 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 13:23 ` Xebar Saram
@ 2014-07-17 13:50 ` Thorsten Jolitz
2014-07-17 13:53 ` Nick Dokos
1 sibling, 0 replies; 16+ messages in thread
From: Thorsten Jolitz @ 2014-07-17 13:50 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> PS. Also can anyone think of a way to get a visual cue when the file
> is in "view mode"?
There is a visual cue in the mode-line:
,----
| 1-UUU:**--
`----
changes to
,----
| 1-UUU:%%--
`----
when view-mode is active
> On Thu, Jul 17, 2014 at 4:22 PM, Xebar Saram <zeltakc@gmail.com>
> wrote:
>
> Thx Thorston this looks great
>
>
> can you recommend a way to open all orgmode notes in view mode by
> default, i guess i would then bind a key to disable view mode to
> start editing right?
>
>
> thanks alot again
>
>
> Z
>
>
>
>
>
> On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz
> <tjolitz@gmail.com> wrote:
>
>
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > hi all
> >
> > i keep once and a while screwing up my notes with unintended
> editing
> > (erroneous key presses etc) and was wondering if any one
> knew of a way
> > to to switch orgmode notes between read-only/editing? i have
> used such
> > options in previous note taking apps that had that option
> build in but
> > i understand that since orgmode notes are just text files
> its a bit
> > more complicated
> >
> > i would love to hear any suggestions on how you guys deal
> with
> > protecting notes/data that still needs to be edited (i do
> use git ofc
> > but i dont always know i screwed my notes :))
>
>
> ,----[ C-h f view-mode RET ]
> | view-mode is an interactive autoloaded compiled Lisp
> function in
> | `view.el'.
> |
> | (view-mode &optional ARG)
> |
> | Toggle View mode, a minor mode for viewing text but not
> editing it.
> | With a prefix argument ARG, enable View mode if ARG is
> positive,
> | and disable it otherwise. If called from Lisp, enable View
> mode
> | if ARG is omitted or nil.
> |
> | When View mode is enabled, commands that do not change the
> buffer
> | contents are available as usual. Kill commands insert text
> in
> | kill buffers but do not delete. Most other commands beep and
> | tell the user that the buffer is read-only.
> |
> |
> |
> | The following additional commands are provided. Most
> commands
> | take prefix arguments. Page commands default to "page size"
> | lines which is almost a whole window, or number of lines set
> by
> | z or w.
> | Half page commands default to and set "half page size" lines
> | which initially is half a window full. Search commands
> default
> | to a repeat count of one.
> |
> | H, h, ? This message.
> | Digits provide prefix arguments.
> | - negative prefix argument.
> | < move to the beginning of buffer.
> | > move to the end of buffer.
> | o scroll so that buffer end is at last line of window.
> | SPC scroll forward "page size" lines.
> | With prefix scroll forward prefix lines.
> | DEL scroll backward "page size" lines.
> | With prefix scroll backward prefix lines.
> | z like SPC but with prefix sets "page size" to prefix.
> | w like DEL but with prefix sets "page size" to prefix.
> | d scroll forward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls forward that
> much.
> | u scroll backward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls backward that
> much.
> | RET, LFD scroll forward one line. With prefix scroll forward
> prefix line(s).
> | y scroll backward one line. With prefix scroll backward
> prefix line(s).
> | F revert-buffer if necessary and scroll forward.
> | Use this to view a changing file.
> | = prints the current line number.
> | % goes prefix argument (default 100) percent into buffer.
> | g goes to line given by prefix argument (default first
> line).
> | . set the mark.
> | x exchanges point and mark.
> | @ return to mark and pops mark ring.
> | Mark ring is pushed at start of every successful search and
> when
> | jump to line occurs. The mark is set on jump to buffer start
> or end.
> | m save current position in character register.
> | ' go to position saved in character register.
> | s do forward incremental search.
> | r do reverse incremental search.
> | / searches forward for regular expression, starting after
> current page.
> | ! and @ have a special meaning at the beginning of the
> regexp.
> | ! means search for a line with no match for regexp. @ means
> start
> | search at beginning (end for backward search) of buffer.
> | \ searches backward for regular expression, starting before
> current page.
> | n searches forward for last regular expression.
> | p searches backward for last regular expression.
> | q quit View mode, restoring this window and buffer to
> previous state.
> | q is the normal way to leave view mode.
> | e exit View mode but stay in current buffer. Use this if you
> started
> | viewing a buffer (file) and find out you want to edit it.
> | This command restores the previous read-only status of the
> buffer.
> | E exit View mode, and make the current buffer editable
> | even if it was not editable before entry to View mode.
> | Q quit View mode, restoring all windows to previous state.
> | c quit View mode and maybe switch buffers, but don't kill
> this buffer.
> | C quit View mode, kill current buffer and go back to other
> buffer.
> |
> | The effect of c, q and C depends on how view-mode was
> entered. If it was
> | entered by view-file, view-file-other-window,
> view-file-other-frame, or
> | M-x dired-view-file (M-x view-file, M-x
> view-file-other-window,
> | M-x view-file-other-frame, or the Dired mode v command),
> | then q will try to kill the current buffer.
> | If view-mode was entered from another buffer, by C-c v,
> | M-x view-buffer-other-window, M-x view-buffer-other frame,
> M-x view-file,
> | M-x view-file-other-window, or M-x view-file-other-frame,
> | then c, q and C will return to that buffer.
> |
> | Entry to view-mode runs the normal hook `view-mode-hook'.
> |
> | [back]
> `----
>
> --
> cheers,
> Thorsten
>
>
>
>
>
>
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 13:23 ` Xebar Saram
2014-07-17 13:50 ` Thorsten Jolitz
@ 2014-07-17 13:53 ` Nick Dokos
1 sibling, 0 replies; 16+ messages in thread
From: Nick Dokos @ 2014-07-17 13:53 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> PS. Also can anyone think of a way to get a visual cue when the file
> is in "view mode"?
>
> thx!
>
> Z
>
> On Thu, Jul 17, 2014 at 4:22 PM, Xebar Saram <zeltakc@gmail.com> wrote:
>
>
> can you recommend a way to open all orgmode notes in view mode by
> default, i guess i would then bind a key to disable view mode to
> start editing right?
>
Add a function that enables the minor mode to org-mode-hook (this is a
completely general emacs mechanism and worth understanding thoroughly):
(add-hook 'org-mode-hook (lambda () (view-mode 1)))
As for visual cues, you get "View" added to the list of modes in the
mode-line.
Nick
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 13:22 ` Xebar Saram
2014-07-17 13:23 ` Xebar Saram
@ 2014-07-17 13:57 ` Thorsten Jolitz
1 sibling, 0 replies; 16+ messages in thread
From: Thorsten Jolitz @ 2014-07-17 13:57 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> Thx Thorston this looks great
>
> can you recommend a way to open all orgmode notes in view mode by
> default
you could try (untested!!)
,----
| (add-hook 'org-mode-hook 'view-mode)
`----
> i guess i would then bind a key to disable view mode to start
> editing right?
That key is 'e' for editing (or 'q' for quitting), already defined in
view-mode.
I usually open files directly from dired with 'v' instead of 'f' in
view-mode to just have a look, and then either do 'e' or 'q'.
> On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz <tjolitz@gmail.com>
> wrote:
>
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > hi all
> >
> > i keep once and a while screwing up my notes with unintended
> editing
> > (erroneous key presses etc) and was wondering if any one knew of
> a way
> > to to switch orgmode notes between read-only/editing? i have
> used such
> > options in previous note taking apps that had that option build
> in but
> > i understand that since orgmode notes are just text files its a
> bit
> > more complicated
> >
> > i would love to hear any suggestions on how you guys deal with
> > protecting notes/data that still needs to be edited (i do use
> git ofc
> > but i dont always know i screwed my notes :))
>
>
> ,----[ C-h f view-mode RET ]
> | view-mode is an interactive autoloaded compiled Lisp function in
> | `view.el'.
> |
> | (view-mode &optional ARG)
> |
> | Toggle View mode, a minor mode for viewing text but not editing
> it.
> | With a prefix argument ARG, enable View mode if ARG is positive,
> | and disable it otherwise. If called from Lisp, enable View mode
> | if ARG is omitted or nil.
> |
> | When View mode is enabled, commands that do not change the
> buffer
> | contents are available as usual. Kill commands insert text in
> | kill buffers but do not delete. Most other commands beep and
> | tell the user that the buffer is read-only.
> |
> |
> |
> | The following additional commands are provided. Most commands
> | take prefix arguments. Page commands default to "page size"
> | lines which is almost a whole window, or number of lines set by
> | z or w.
> | Half page commands default to and set "half page size" lines
> | which initially is half a window full. Search commands default
> | to a repeat count of one.
> |
> | H, h, ? This message.
> | Digits provide prefix arguments.
> | - negative prefix argument.
> | < move to the beginning of buffer.
> | > move to the end of buffer.
> | o scroll so that buffer end is at last line of window.
> | SPC scroll forward "page size" lines.
> | With prefix scroll forward prefix lines.
> | DEL scroll backward "page size" lines.
> | With prefix scroll backward prefix lines.
> | z like SPC but with prefix sets "page size" to prefix.
> | w like DEL but with prefix sets "page size" to prefix.
> | d scroll forward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls forward that much.
> | u scroll backward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls backward that much.
> | RET, LFD scroll forward one line. With prefix scroll forward
> prefix line(s).
> | y scroll backward one line. With prefix scroll backward prefix
> line(s).
> | F revert-buffer if necessary and scroll forward.
> | Use this to view a changing file.
> | = prints the current line number.
> | % goes prefix argument (default 100) percent into buffer.
> | g goes to line given by prefix argument (default first line).
> | . set the mark.
> | x exchanges point and mark.
> | @ return to mark and pops mark ring.
> | Mark ring is pushed at start of every successful search and when
> | jump to line occurs. The mark is set on jump to buffer start or
> end.
> | m save current position in character register.
> | ' go to position saved in character register.
> | s do forward incremental search.
> | r do reverse incremental search.
> | / searches forward for regular expression, starting after
> current page.
> | ! and @ have a special meaning at the beginning of the regexp.
> | ! means search for a line with no match for regexp. @ means
> start
> | search at beginning (end for backward search) of buffer.
> | \ searches backward for regular expression, starting before
> current page.
> | n searches forward for last regular expression.
> | p searches backward for last regular expression.
> | q quit View mode, restoring this window and buffer to previous
> state.
> | q is the normal way to leave view mode.
> | e exit View mode but stay in current buffer. Use this if you
> started
> | viewing a buffer (file) and find out you want to edit it.
> | This command restores the previous read-only status of the
> buffer.
> | E exit View mode, and make the current buffer editable
> | even if it was not editable before entry to View mode.
> | Q quit View mode, restoring all windows to previous state.
> | c quit View mode and maybe switch buffers, but don't kill this
> buffer.
> | C quit View mode, kill current buffer and go back to other
> buffer.
> |
> | The effect of c, q and C depends on how view-mode was entered.
> If it was
> | entered by view-file, view-file-other-window,
> view-file-other-frame, or
> | M-x dired-view-file (M-x view-file, M-x view-file-other-window,
> | M-x view-file-other-frame, or the Dired mode v command),
> | then q will try to kill the current buffer.
> | If view-mode was entered from another buffer, by C-c v,
> | M-x view-buffer-other-window, M-x view-buffer-other frame, M-x
> view-file,
> | M-x view-file-other-window, or M-x view-file-other-frame,
> | then c, q and C will return to that buffer.
> |
> | Entry to view-mode runs the normal hook `view-mode-hook'.
> |
> | [back]
> `----
>
> --
> cheers,
> Thorsten
>
>
>
>
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 12:40 a quick way to switch orgmode notes between read-only/editing? Xebar Saram
2014-07-17 13:13 ` Thorsten Jolitz
@ 2014-07-17 14:46 ` Jorge A. Alfaro-Murillo
2014-07-17 15:15 ` Xebar Saram
1 sibling, 1 reply; 16+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-07-17 14:46 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> i keep once and a while screwing up my notes with unintended editing
> (erroneous key presses etc) and was wondering if any one knew of a way
> to to switch orgmode notes between read-only/editing?
Hi Xebar. Use C-x C-q. This works for every file, I use it in particular
for notes that I do not want to edit.
It runs the command read-only-mode which changes whether the current
buffer is read-only. Actually the command switches the local variable
buffer-read-only, so you can use that variable as local for every file
that you do not want to edit by default. At the end of those files add:
#+BEGIN_EXAMPLE
%%% Local Variables:
%%% buffer-read-only: t
%%% End:
#+END_EXAMPLE
And every time that you want to edit them just do C-x C-q
Best,
Jorge.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 14:46 ` Jorge A. Alfaro-Murillo
@ 2014-07-17 15:15 ` Xebar Saram
2014-07-17 23:42 ` Eric Abrahamsen
0 siblings, 1 reply; 16+ messages in thread
From: Xebar Saram @ 2014-07-17 15:15 UTC (permalink / raw)
To: Jorge A. Alfaro-Murillo; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]
Thanks guys. really appreciate all your help
im now using view-mode with hooks as suggested. btw whats the advantages of
viewer-mode over read-only-mode
best
Z
On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
jorge.a.alfaro@gmail.com> wrote:
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > i keep once and a while screwing up my notes with unintended editing
> > (erroneous key presses etc) and was wondering if any one knew of a way
> > to to switch orgmode notes between read-only/editing?
>
> Hi Xebar. Use C-x C-q. This works for every file, I use it in particular
> for notes that I do not want to edit.
>
> It runs the command read-only-mode which changes whether the current
> buffer is read-only. Actually the command switches the local variable
> buffer-read-only, so you can use that variable as local for every file
> that you do not want to edit by default. At the end of those files add:
>
> #+BEGIN_EXAMPLE
> %%% Local Variables:
> %%% buffer-read-only: t
> %%% End:
> #+END_EXAMPLE
>
> And every time that you want to edit them just do C-x C-q
>
> Best,
>
> Jorge.
>
>
>
[-- Attachment #2: Type: text/html, Size: 1643 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 15:15 ` Xebar Saram
@ 2014-07-17 23:42 ` Eric Abrahamsen
2014-07-18 7:50 ` Xebar Saram
0 siblings, 1 reply; 16+ messages in thread
From: Eric Abrahamsen @ 2014-07-17 23:42 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> Thanks guys. really appreciate all your help
>
> im now using view-mode with hooks as suggested. btw whats the
> advantages of viewer-mode over read-only-mode
Mostly that you get more convenient navigation commands. Scrolling and
searching etc don't require control modifiers, and it becomes a bit
easier to move around files.
> best
>
> Z
>
>
> On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> jorge.a.alfaro@gmail.com> wrote:
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > i keep once and a while screwing up my notes with unintended
> editing
> > (erroneous key presses etc) and was wondering if any one knew
> of a way
> > to to switch orgmode notes between read-only/editing?
>
> Hi Xebar. Use C-x C-q. This works for every file, I use it in
> particular
> for notes that I do not want to edit.
>
> It runs the command read-only-mode which changes whether the
> current
> buffer is read-only. Actually the command switches the local
> variable
> buffer-read-only, so you can use that variable as local for every
> file
> that you do not want to edit by default. At the end of those
> files add:
>
> #+BEGIN_EXAMPLE
> %%% Local Variables:
> %%% buffer-read-only: t
> %%% End:
> #+END_EXAMPLE
>
> And every time that you want to edit them just do C-x C-q
>
> Best,
>
> Jorge.
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-17 23:42 ` Eric Abrahamsen
@ 2014-07-18 7:50 ` Xebar Saram
2014-07-18 8:54 ` Thorsten Jolitz
0 siblings, 1 reply; 16+ messages in thread
From: Xebar Saram @ 2014-07-18 7:50 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]
Thx again all, really cool.
one last question. anyone mind pasting code to revert an open buffer to
read only when idle for lets say 5 minutes?
thx alot!
Z
On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thanks guys. really appreciate all your help
> >
> > im now using view-mode with hooks as suggested. btw whats the
> > advantages of viewer-mode over read-only-mode
>
> Mostly that you get more convenient navigation commands. Scrolling and
> searching etc don't require control modifiers, and it becomes a bit
> easier to move around files.
>
> > best
> >
> > Z
> >
> >
> > On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> > jorge.a.alfaro@gmail.com> wrote:
> >
> > Xebar Saram <zeltakc@gmail.com> writes:
> >
> > > i keep once and a while screwing up my notes with unintended
> > editing
> > > (erroneous key presses etc) and was wondering if any one knew
> > of a way
> > > to to switch orgmode notes between read-only/editing?
> >
> > Hi Xebar. Use C-x C-q. This works for every file, I use it in
> > particular
> > for notes that I do not want to edit.
> >
> > It runs the command read-only-mode which changes whether the
> > current
> > buffer is read-only. Actually the command switches the local
> > variable
> > buffer-read-only, so you can use that variable as local for every
> > file
> > that you do not want to edit by default. At the end of those
> > files add:
> >
> > #+BEGIN_EXAMPLE
> > %%% Local Variables:
> > %%% buffer-read-only: t
> > %%% End:
> > #+END_EXAMPLE
> >
> > And every time that you want to edit them just do C-x C-q
> >
> > Best,
> >
> > Jorge.
> >
> >
>
>
>
[-- Attachment #2: Type: text/html, Size: 2754 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-18 7:50 ` Xebar Saram
@ 2014-07-18 8:54 ` Thorsten Jolitz
2014-07-18 12:14 ` Xebar Saram
0 siblings, 1 reply; 16+ messages in thread
From: Thorsten Jolitz @ 2014-07-18 8:54 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> Thx again all, really cool.
>
> one last question. anyone mind pasting code to revert an open buffer
> to read only when idle for lets say 5 minutes?
you could try this (untested!):
#+begin_src emacs-lisp
(defvar tj/last-buffer-tick nil)
(make-variable-buffer-local 'tj/last-buffer-tick)
(add-hook 'org-mode-hook
(lambda ()
(setq tj/last-buffer-tick (buffer-modified-tick))))
(defun tj/new-buffer-ticks-p ()
(let ((curr-tick (buffer-modified-tick))
(last-tick tj/last-buffer-tick))
(setq tj/last-buffer-tick curr-tick)
(< last-tick curr-tick)))
(defun tj/reset-view-mode ()
(run-with-timer (* 5 60) (* 5 60)
(lambda ()
(when (tj/new-buffer-ticks-p)
(view-mode t)))))
#+end_src
> On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen
> <eric@ericabrahamsen.net> wrote:
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thanks guys. really appreciate all your help
> >
> > im now using view-mode with hooks as suggested. btw whats the
> > advantages of viewer-mode over read-only-mode
>
>
> Mostly that you get more convenient navigation commands. Scrolling
> and
> searching etc don't require control modifiers, and it becomes a
> bit
> easier to move around files.
>
>
>
> > best
> >
> > Z
> >
> >
> > On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> > jorge.a.alfaro@gmail.com> wrote:
> >
> > Xebar Saram <zeltakc@gmail.com> writes:
> >
> > > i keep once and a while screwing up my notes with unintended
> > editing
> > > (erroneous key presses etc) and was wondering if any one knew
> > of a way
> > > to to switch orgmode notes between read-only/editing?
> >
> > Hi Xebar. Use C-x C-q. This works for every file, I use it in
> > particular
> > for notes that I do not want to edit.
> >
> > It runs the command read-only-mode which changes whether the
> > current
> > buffer is read-only. Actually the command switches the local
> > variable
> > buffer-read-only, so you can use that variable as local for
> every
> > file
> > that you do not want to edit by default. At the end of those
> > files add:
> >
> > #+BEGIN_EXAMPLE
> > %%% Local Variables:
> > %%% buffer-read-only: t
> > %%% End:
> > #+END_EXAMPLE
> >
> > And every time that you want to edit them just do C-x C-q
> >
> > Best,
> >
> > Jorge.
> >
> >
>
>
>
>
>
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-18 8:54 ` Thorsten Jolitz
@ 2014-07-18 12:14 ` Xebar Saram
2014-07-18 12:35 ` Thorsten Jolitz
0 siblings, 1 reply; 16+ messages in thread
From: Xebar Saram @ 2014-07-18 12:14 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 3053 bytes --]
Thx Thorsten
i tried that but that dosent seem to work :) any way i can try to debug
this (i apologize in advance for my zero lisp knowledge :)
best
Z
On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thx again all, really cool.
> >
> > one last question. anyone mind pasting code to revert an open buffer
> > to read only when idle for lets say 5 minutes?
>
> you could try this (untested!):
>
> #+begin_src emacs-lisp
> (defvar tj/last-buffer-tick nil)
> (make-variable-buffer-local 'tj/last-buffer-tick)
>
> (add-hook 'org-mode-hook
> (lambda ()
> (setq tj/last-buffer-tick (buffer-modified-tick))))
>
> (defun tj/new-buffer-ticks-p ()
> (let ((curr-tick (buffer-modified-tick))
> (last-tick tj/last-buffer-tick))
> (setq tj/last-buffer-tick curr-tick)
> (< last-tick curr-tick)))
>
> (defun tj/reset-view-mode ()
> (run-with-timer (* 5 60) (* 5 60)
> (lambda ()
> (when (tj/new-buffer-ticks-p)
> (view-mode t)))))
> #+end_src
>
>
> > On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen
> > <eric@ericabrahamsen.net> wrote:
> >
> > Xebar Saram <zeltakc@gmail.com> writes:
> >
> > > Thanks guys. really appreciate all your help
> > >
> > > im now using view-mode with hooks as suggested. btw whats the
> > > advantages of viewer-mode over read-only-mode
> >
> >
> > Mostly that you get more convenient navigation commands. Scrolling
> > and
> > searching etc don't require control modifiers, and it becomes a
> > bit
> > easier to move around files.
> >
> >
> >
> > > best
> > >
> > > Z
> > >
> > >
> > > On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> > > jorge.a.alfaro@gmail.com> wrote:
> > >
> > > Xebar Saram <zeltakc@gmail.com> writes:
> > >
> > > > i keep once and a while screwing up my notes with unintended
> > > editing
> > > > (erroneous key presses etc) and was wondering if any one knew
> > > of a way
> > > > to to switch orgmode notes between read-only/editing?
> > >
> > > Hi Xebar. Use C-x C-q. This works for every file, I use it in
> > > particular
> > > for notes that I do not want to edit.
> > >
> > > It runs the command read-only-mode which changes whether the
> > > current
> > > buffer is read-only. Actually the command switches the local
> > > variable
> > > buffer-read-only, so you can use that variable as local for
> > every
> > > file
> > > that you do not want to edit by default. At the end of those
> > > files add:
> > >
> > > #+BEGIN_EXAMPLE
> > > %%% Local Variables:
> > > %%% buffer-read-only: t
> > > %%% End:
> > > #+END_EXAMPLE
> > >
> > > And every time that you want to edit them just do C-x C-q
> > >
> > > Best,
> > >
> > > Jorge.
> > >
> > >
> >
> >
> >
> >
> >
>
> --
> cheers,
> Thorsten
>
>
>
[-- Attachment #2: Type: text/html, Size: 4640 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-18 12:14 ` Xebar Saram
@ 2014-07-18 12:35 ` Thorsten Jolitz
2014-07-18 15:31 ` Xebar Saram
0 siblings, 1 reply; 16+ messages in thread
From: Thorsten Jolitz @ 2014-07-18 12:35 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> Thx Thorsten
>
> i tried that but that dosent seem to work :) any way i can try to
> debug this (i apologize in advance for my zero lisp knowledge :)
it actually worked, but only with calling the reset function manually
once.
try this:
#+begin_src emacs-lisp
(defvar tj/last-buffer-tick nil)
(make-variable-buffer-local 'tj/last-buffer-tick)
(defun tj/new-buffer-ticks-p ()
(let ((curr-tick (buffer-modified-tick))
(last-tick tj/last-buffer-tick))
(setq tj/last-buffer-tick curr-tick)
(and last-tick (< last-tick curr-tick))))
(defun tj/reset-view-mode ()
(run-with-timer 0 (* 5 60)
(lambda ()
(when (tj/new-buffer-ticks-p)
(view-mode t)))))
(add-hook 'org-mode-hook 'tj/reset-view-mode)
#+end_src
> On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz <tjolitz@gmail.com>
> wrote:
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thx again all, really cool.
> >
> > one last question. anyone mind pasting code to revert an open
> buffer
> > to read only when idle for lets say 5 minutes?
>
>
> you could try this (untested!):
>
> #+begin_src emacs-lisp
> (defvar tj/last-buffer-tick nil)
> (make-variable-buffer-local 'tj/last-buffer-tick)
>
> (add-hook 'org-mode-hook
> (lambda ()
> (setq tj/last-buffer-tick (buffer-modified-tick))))
>
> (defun tj/new-buffer-ticks-p ()
> (let ((curr-tick (buffer-modified-tick))
> (last-tick tj/last-buffer-tick))
> (setq tj/last-buffer-tick curr-tick)
> (< last-tick curr-tick)))
>
> (defun tj/reset-view-mode ()
> (run-with-timer (* 5 60) (* 5 60)
> (lambda ()
> (when (tj/new-buffer-ticks-p)
> (view-mode t)))))
> #+end_src
>
>
>
>
> > On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen
> > <eric@ericabrahamsen.net> wrote:
> >
> > Xebar Saram <zeltakc@gmail.com> writes:
> >
> > > Thanks guys. really appreciate all your help
> > >
> > > im now using view-mode with hooks as suggested. btw whats the
> > > advantages of viewer-mode over read-only-mode
> >
> >
> > Mostly that you get more convenient navigation commands.
> Scrolling
> > and
> > searching etc don't require control modifiers, and it becomes a
> > bit
> > easier to move around files.
> >
> >
> >
> > > best
> > >
> > > Z
> > >
> > >
> > > On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> > > jorge.a.alfaro@gmail.com> wrote:
> > >
> > > Xebar Saram <zeltakc@gmail.com> writes:
> > >
> > > > i keep once and a while screwing up my notes with unintended
> > > editing
> > > > (erroneous key presses etc) and was wondering if any one
> knew
> > > of a way
> > > > to to switch orgmode notes between read-only/editing?
> > >
> > > Hi Xebar. Use C-x C-q. This works for every file, I use it in
> > > particular
> > > for notes that I do not want to edit.
> > >
> > > It runs the command read-only-mode which changes whether the
> > > current
> > > buffer is read-only. Actually the command switches the local
> > > variable
> > > buffer-read-only, so you can use that variable as local for
> > every
> > > file
> > > that you do not want to edit by default. At the end of those
> > > files add:
> > >
> > > #+BEGIN_EXAMPLE
> > > %%% Local Variables:
> > > %%% buffer-read-only: t
> > > %%% End:
> > > #+END_EXAMPLE
> > >
> > > And every time that you want to edit them just do C-x C-q
> > >
> > > Best,
> > >
> > > Jorge.
> > >
> > >
> >
> >
> >
> >
> >
>
>
> --
> cheers,
> Thorsten
>
>
>
>
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-18 12:35 ` Thorsten Jolitz
@ 2014-07-18 15:31 ` Xebar Saram
2014-07-18 20:37 ` Thorsten Jolitz
0 siblings, 1 reply; 16+ messages in thread
From: Xebar Saram @ 2014-07-18 15:31 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 4497 bytes --]
Thx again Thorsten
for some reason it wont work here. i evaluated it and have in in my config.
i open notes in view mode (the other hook i used) and then edit them. i
leave the pc for 5-10 minutes but it dosent revert to view mode for some
reason. am i missing something?
thx!
Z
On Fri, Jul 18, 2014 at 3:35 PM, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thx Thorsten
> >
> > i tried that but that dosent seem to work :) any way i can try to
> > debug this (i apologize in advance for my zero lisp knowledge :)
>
> it actually worked, but only with calling the reset function manually
> once.
>
> try this:
>
> #+begin_src emacs-lisp
> (defvar tj/last-buffer-tick nil)
> (make-variable-buffer-local 'tj/last-buffer-tick)
>
> (defun tj/new-buffer-ticks-p ()
> (let ((curr-tick (buffer-modified-tick))
> (last-tick tj/last-buffer-tick))
> (setq tj/last-buffer-tick curr-tick)
> (and last-tick (< last-tick curr-tick))))
>
> (defun tj/reset-view-mode ()
> (run-with-timer 0 (* 5 60)
> (lambda ()
> (when (tj/new-buffer-ticks-p)
> (view-mode t)))))
>
> (add-hook 'org-mode-hook 'tj/reset-view-mode)
> #+end_src
>
> > On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz <tjolitz@gmail.com>
> > wrote:
> >
> > Xebar Saram <zeltakc@gmail.com> writes:
> >
> > > Thx again all, really cool.
> > >
> > > one last question. anyone mind pasting code to revert an open
> > buffer
> > > to read only when idle for lets say 5 minutes?
> >
> >
> > you could try this (untested!):
> >
> > #+begin_src emacs-lisp
> > (defvar tj/last-buffer-tick nil)
> > (make-variable-buffer-local 'tj/last-buffer-tick)
> >
> > (add-hook 'org-mode-hook
> > (lambda ()
> > (setq tj/last-buffer-tick (buffer-modified-tick))))
> >
> > (defun tj/new-buffer-ticks-p ()
> > (let ((curr-tick (buffer-modified-tick))
> > (last-tick tj/last-buffer-tick))
> > (setq tj/last-buffer-tick curr-tick)
> > (< last-tick curr-tick)))
> >
> > (defun tj/reset-view-mode ()
> > (run-with-timer (* 5 60) (* 5 60)
> > (lambda ()
> > (when (tj/new-buffer-ticks-p)
> > (view-mode t)))))
> > #+end_src
> >
> >
> >
> >
> > > On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen
> > > <eric@ericabrahamsen.net> wrote:
> > >
> > > Xebar Saram <zeltakc@gmail.com> writes:
> > >
> > > > Thanks guys. really appreciate all your help
> > > >
> > > > im now using view-mode with hooks as suggested. btw whats the
> > > > advantages of viewer-mode over read-only-mode
> > >
> > >
> > > Mostly that you get more convenient navigation commands.
> > Scrolling
> > > and
> > > searching etc don't require control modifiers, and it becomes a
> > > bit
> > > easier to move around files.
> > >
> > >
> > >
> > > > best
> > > >
> > > > Z
> > > >
> > > >
> > > > On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> > > > jorge.a.alfaro@gmail.com> wrote:
> > > >
> > > > Xebar Saram <zeltakc@gmail.com> writes:
> > > >
> > > > > i keep once and a while screwing up my notes with unintended
> > > > editing
> > > > > (erroneous key presses etc) and was wondering if any one
> > knew
> > > > of a way
> > > > > to to switch orgmode notes between read-only/editing?
> > > >
> > > > Hi Xebar. Use C-x C-q. This works for every file, I use it in
> > > > particular
> > > > for notes that I do not want to edit.
> > > >
> > > > It runs the command read-only-mode which changes whether the
> > > > current
> > > > buffer is read-only. Actually the command switches the local
> > > > variable
> > > > buffer-read-only, so you can use that variable as local for
> > > every
> > > > file
> > > > that you do not want to edit by default. At the end of those
> > > > files add:
> > > >
> > > > #+BEGIN_EXAMPLE
> > > > %%% Local Variables:
> > > > %%% buffer-read-only: t
> > > > %%% End:
> > > > #+END_EXAMPLE
> > > >
> > > > And every time that you want to edit them just do C-x C-q
> > > >
> > > > Best,
> > > >
> > > > Jorge.
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > cheers,
> > Thorsten
> >
> >
> >
> >
>
> --
> cheers,
> Thorsten
>
>
>
[-- Attachment #2: Type: text/html, Size: 6831 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: a quick way to switch orgmode notes between read-only/editing?
2014-07-18 15:31 ` Xebar Saram
@ 2014-07-18 20:37 ` Thorsten Jolitz
0 siblings, 0 replies; 16+ messages in thread
From: Thorsten Jolitz @ 2014-07-18 20:37 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> Thx again Thorsten
>
> for some reason it wont work here. i evaluated it and have in in my
> config. i open notes in view mode (the other hook i used) and then
> edit them. i leave the pc for 5-10 minutes but it dosent revert to
> view mode for some reason. am i missing something?
it should probably be
(= last-tick curr-tick) ; was (< last-tick curr-tick)
but anyway, I'm not sure if this whole idea is a good one, and trying it
out here had some unwanted side-effects that had me restart Emacs.
maybe try it out with the = (instead of <) and set (* 5 60) to (* 1 60)
so you only have to wait one minute...
if it does not work then, or wrecks havoc on you system, better omit
the whole thing.
> On Fri, Jul 18, 2014 at 3:35 PM, Thorsten Jolitz <tjolitz@gmail.com>
> wrote:
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thx Thorsten
> >
> > i tried that but that dosent seem to work :) any way i can try
> to
> > debug this (i apologize in advance for my zero lisp knowledge :)
>
>
> it actually worked, but only with calling the reset function
> manually
> once.
>
> try this:
>
>
> #+begin_src emacs-lisp
> (defvar tj/last-buffer-tick nil)
> (make-variable-buffer-local 'tj/last-buffer-tick)
>
>
> (defun tj/new-buffer-ticks-p ()
> (let ((curr-tick (buffer-modified-tick))
> (last-tick tj/last-buffer-tick))
> (setq tj/last-buffer-tick curr-tick)
>
> (and last-tick (< last-tick curr-tick))))
>
> (defun tj/reset-view-mode ()
> (run-with-timer 0 (* 5 60)
>
> (lambda ()
> (when (tj/new-buffer-ticks-p)
> (view-mode t)))))
>
>
> (add-hook 'org-mode-hook 'tj/reset-view-mode)
>
>
> #+end_src
>
> > On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz
> <tjolitz@gmail.com>
> > wrote:
> >
> > Xebar Saram <zeltakc@gmail.com> writes:
> >
> > > Thx again all, really cool.
> > >
> > > one last question. anyone mind pasting code to revert an open
> > buffer
> > > to read only when idle for lets say 5 minutes?
> >
> >
> > you could try this (untested!):
> >
> > #+begin_src emacs-lisp
> > (defvar tj/last-buffer-tick nil)
> > (make-variable-buffer-local 'tj/last-buffer-tick)
> >
> > (add-hook 'org-mode-hook
> > (lambda ()
> > (setq tj/last-buffer-tick (buffer-modified-tick))))
> >
> > (defun tj/new-buffer-ticks-p ()
> > (let ((curr-tick (buffer-modified-tick))
> > (last-tick tj/last-buffer-tick))
> > (setq tj/last-buffer-tick curr-tick)
> > (< last-tick curr-tick)))
> >
> > (defun tj/reset-view-mode ()
> > (run-with-timer (* 5 60) (* 5 60)
> > (lambda ()
> > (when (tj/new-buffer-ticks-p)
> > (view-mode t)))))
> > #+end_src
> >
> >
> >
> >
> > > On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen
> > > <eric@ericabrahamsen.net> wrote:
> > >
> > > Xebar Saram <zeltakc@gmail.com> writes:
> > >
> > > > Thanks guys. really appreciate all your help
> > > >
> > > > im now using view-mode with hooks as suggested. btw whats
> the
> > > > advantages of viewer-mode over read-only-mode
> > >
> > >
> > > Mostly that you get more convenient navigation commands.
> > Scrolling
> > > and
> > > searching etc don't require control modifiers, and it becomes
> a
> > > bit
> > > easier to move around files.
> > >
> > >
> > >
> > > > best
> > > >
> > > > Z
> > > >
> > > >
> > > > On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> > > > jorge.a.alfaro@gmail.com> wrote:
> > > >
> > > > Xebar Saram <zeltakc@gmail.com> writes:
> > > >
> > > > > i keep once and a while screwing up my notes with
> unintended
> > > > editing
> > > > > (erroneous key presses etc) and was wondering if any one
> > knew
> > > > of a way
> > > > > to to switch orgmode notes between read-only/editing?
> > > >
> > > > Hi Xebar. Use C-x C-q. This works for every file, I use it
> in
> > > > particular
> > > > for notes that I do not want to edit.
> > > >
> > > > It runs the command read-only-mode which changes whether the
> > > > current
> > > > buffer is read-only. Actually the command switches the local
> > > > variable
> > > > buffer-read-only, so you can use that variable as local for
> > > every
> > > > file
> > > > that you do not want to edit by default. At the end of those
> > > > files add:
> > > >
> > > > #+BEGIN_EXAMPLE
> > > > %%% Local Variables:
> > > > %%% buffer-read-only: t
> > > > %%% End:
> > > > #+END_EXAMPLE
> > > >
> > > > And every time that you want to edit them just do C-x C-q
> > > >
> > > > Best,
> > > >
> > > > Jorge.
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > cheers,
> > Thorsten
> >
> >
> >
> >
>
>
> --
> cheers,
> Thorsten
>
>
>
>
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2014-07-18 20:37 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-17 12:40 a quick way to switch orgmode notes between read-only/editing? Xebar Saram
2014-07-17 13:13 ` Thorsten Jolitz
2014-07-17 13:22 ` Xebar Saram
2014-07-17 13:23 ` Xebar Saram
2014-07-17 13:50 ` Thorsten Jolitz
2014-07-17 13:53 ` Nick Dokos
2014-07-17 13:57 ` Thorsten Jolitz
2014-07-17 14:46 ` Jorge A. Alfaro-Murillo
2014-07-17 15:15 ` Xebar Saram
2014-07-17 23:42 ` Eric Abrahamsen
2014-07-18 7:50 ` Xebar Saram
2014-07-18 8:54 ` Thorsten Jolitz
2014-07-18 12:14 ` Xebar Saram
2014-07-18 12:35 ` Thorsten Jolitz
2014-07-18 15:31 ` Xebar Saram
2014-07-18 20:37 ` Thorsten Jolitz
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.