Re: bi-monthly steps.

2020-03-27 Thread Christian Hopps
Thanks, and thanks for adding the test and doc updates!

Chris.

> On Mar 26, 2020, at 9:12 PM, Kyle Meyer  wrote:
> 
> Christian Hopps  writes:
> 
>> I've attached an updated patch using "semimonth".
> 
> Applied in 8a99404c8, along with a follow-up commit that adds a test,
> updates the manual, and add a NEWS entry.
> 
> Thanks.
> 




Automatic formatting of the table as you type

2020-03-27 Thread ndame

The other day a code was posted on Reddit which automatically formats
the table as you type:

https://i.imgur.com/lorIDhY.gif


The code looks pretty simple, the actual formatting code is only a few lines
and it might even be possible to rewrite it to simplify it even more:

https://reddit.com/r/emacs/comments/fosdi2/orgtableautoalignmode_minor_mode_for_auto/


Org should provide this feature out of the box as an optional minor
mode like org-indent-mode. It provides a much nicer user experience
than the current behavior where the table falls apart when you type in
it until you press TAB or such.

Re: Can't turn off hide-stars

2020-03-27 Thread Ag Ibragimov



Have you tried tweaking org-hide face? Maybe the problem is with the font you 
use, is it monospaced?

On Thu 26 Mar 2020 at 22:40, Lawrence Bottorff  wrote:


I have searched high and low through my init/config and I can't find where
orgmode is suppressing the display of leading asterisks of headings. I've
got org-hide-leading-stars set to nil -- but it turns itself back on
whenever I open an org file. I can start a clean, blank org file (no
#+STARTUP hidestars/showstars) and create a few headings -- to see, once
again, the leading stars suppressed. My org-bullets is commented out in
init-land. I try an emacs -Q and of course I have leading stars on
sub-headings, however deep. Yes, it's something in my init/config, but I
just can't find what's suppressing leading stars.

The whole reason I'm trying to do this is I'm tinkering with babel SML and
whenever I have a code block under a heading -- depending on the depth of
the heading -- the SML code block can be mis-justified. And if I
promote/demote the heading around with M- the SML code
alignment dances around depending on the depth. I can do C-c ' and the
alignment is perfect; but come back the org file and it's wonky. So if I
set up an SML babel environment in an emacs -Q environment -- with leading
starts -- no problem.

This is maddening, to say the least. I need to turn off suppression or
figure out why suppressed stars and babel SML blocks don't mix.

LB





Re: Automatic formatting of the table as you type

2020-03-27 Thread Nicolas Goaziou
Hello,

ndame  writes:

> The other day a code was posted on Reddit which automatically formats
> the table as you type:
>
> https://i.imgur.com/lorIDhY.gif
>
>
> The code looks pretty simple, the actual formatting code is only a few lines
> and it might even be possible to rewrite it to simplify it even more:
>
> https://reddit.com/r/emacs/comments/fosdi2/orgtableautoalignmode_minor_mode_for_auto/
>
>
> Org should provide this feature out of the box as an optional minor
> mode like org-indent-mode. It provides a much nicer user experience
> than the current behavior where the table falls apart when you type in
> it until you press TAB or such.

The idea is nice, and probably a step in the right direction, but
`org-at-table-p' and `org-table-align' are not lightweight functions. In
some common situations, e.g., when the table is a bit large, or when it
is located away from the start of a section, typing in the table may
feel sluggish.

Therefore, I wonder if Org should include it unless it is optimized in
most situations.

As a side note, the table doesn't realign when you add a space in
a cell.

Regards,

-- 
Nicolas Goaziou



Re: Can't turn off hide-stars

2020-03-27 Thread Lawrence Bottorff
Changing my theme didn't help. The foreground-color of hide-face is set to
the background color of my theme. What I suspect the problem is is the
spaces and tabs used by sml-mode for indentations. I don't think other
languages use a mix of spaces and tabs. They use just spaces. Is there a
way to convert every tab to its size in spaces?

On Fri, Mar 27, 2020 at 2:52 PM Ag Ibragimov 
wrote:

>
> > As far as "org-hide face", I'm not sure what you mean.
>
> You've said:
>
> > I can't find where orgmode is suppressing the display of leading
> asterisks of headings.
>
> The asterisks being displayed/hidden is controlled by 'org-hide' face. Run
> "M-x describe-face org-hide RET" and see what the foreground of that face
> is set to. Alternatively, you can try switching to another theme and see if
> that makes any difference.
>
> On Fri 27 Mar 2020 at 12:30, Lawrence Bottorff  wrote:
>
> > I did have a monospace font, but changing to a vari-spaced one didn't
> help.
> > I can promote/demote the heading above the code block and the alignment
> of
> > the code shifts along with it, specifically this sort of block with a let
> >
> > #+begin_src sml
> > fun countUpFrom1 (x : int) =
> > let
> > fun count (from : int, to : int) =
> >if from = to
> >then to :: []
> >else from :: count (from+1, to)
> > in
> > count (1, x)
> > end
> > #+end_src
> >
> > Note, this is copied into my gmail from below a heading 4 -- which in the
> > sml code block looks good. However, as I pasted this into gmail, the
> spaces
> > and tabs are behaving differently, e.g., the let is exactly 4 spaces
> over,
> > while the second nested fun is just a single tab over, which gmail isn't
> > honoring. This
> > is the same behavior I'm seeing at, e.g., a level 3 heading.
> >
> > Again, when this file is brought up in a clean emacs -Q where only SML
> > mode/ob is set up and stars are all showing there is no (spaces v. tabs)
> > shifting around trouble. If I could definitively turn off star hiding I
> > could get around this shifting problem. But why this is happening is very
> > mysterious. As far as "org-hide face", I'm not sure what you mean.
> >
> > On Fri, Mar 27, 2020 at 12:19 PM Ag Ibragimov  >
> > wrote:
> >
> >>
> >> Have you tried tweaking org-hide face? Maybe the problem is with the
> font
> >> you use, is it monospaced?
> >>
> >> On Thu 26 Mar 2020 at 22:40, Lawrence Bottorff 
> wrote:
> >>
> >> > I have searched high and low through my init/config and I can't find
> >> where
> >> > orgmode is suppressing the display of leading asterisks of headings.
> I've
> >> > got org-hide-leading-stars set to nil -- but it turns itself back on
> >> > whenever I open an org file. I can start a clean, blank org file (no
> >> > #+STARTUP hidestars/showstars) and create a few headings -- to see,
> once
> >> > again, the leading stars suppressed. My org-bullets is commented out
> in
> >> > init-land. I try an emacs -Q and of course I have leading stars on
> >> > sub-headings, however deep. Yes, it's something in my init/config,
> but I
> >> > just can't find what's suppressing leading stars.
> >> >
> >> > The whole reason I'm trying to do this is I'm tinkering with babel SML
> >> and
> >> > whenever I have a code block under a heading -- depending on the
> depth of
> >> > the heading -- the SML code block can be mis-justified. And if I
> >> > promote/demote the heading around with M- the SML
> code
> >> > alignment dances around depending on the depth. I can do C-c ' and the
> >> > alignment is perfect; but come back the org file and it's wonky. So
> if I
> >> > set up an SML babel environment in an emacs -Q environment -- with
> >> leading
> >> > starts -- no problem.
> >> >
> >> > This is maddening, to say the least. I need to turn off suppression or
> >> > figure out why suppressed stars and babel SML blocks don't mix.
> >> >
> >> > LB
> >>
> >>
> >>
>
>


is it possible doing a "smart tri-fold brochure" with org-mode?

2020-03-27 Thread rrandresf
Hi.

The tri-fold brochure is also known as 'tryptich'

A simple web search defines it as:
--8<---cut here---start->8---
Promotional brochures come in many sizes and can be folded many different ways, 
the most common being the tri-fold
brochure. This fold creates three equal sections by folding the sides over the 
middle. Most tri-folds bend the right
side first and then the left so that when opened, the brochure reads from left 
to right.
--8<---cut here---end--->8---

If Any of You have an example. It would be nice. As the other
alternative is using a propietary tool for it :(.

Best Regards



Re: Automatic formatting of the table as you type

2020-03-27 Thread ndame
> The idea is nice, and probably a step in the right direction, but
> `org-at-table-p' and `org-table-align' are not lightweight functions. In
> some common situations, e.g., when the table is a bit large, or when it
> is located away from the start of a section, typing in the table may
> feel sluggish.
>
> Therefore, I wonder if Org should include it unless it is optimized in
> most situations.

Apparently, the code is more like a proof of concept, not a fully
optimized solution. I didn't mean it should be included as is, rather
the concept itself is very promising and provides a better user
experience. As some of the commenters put it on reddit this is how
they expected Org tables to work in the first place and I feel the
same way.

As for org-at-table-p being slow storing the start and end position of
the table could be a solution, so if point is between them then there
is no need to check org-at-table-p again.

org-table-align seemed fast enough for me when I tried the posted
code, but if it's slower for large tables then the code could measure
the time it takes to perform the alignment for the current table and
if it's above a certain threshold then it could introduce a bit of
idle delay for the update, so it doesn't hold back the user from
typing, and if the alignment is fast then it could perform the update
without delay.

Anyway, I think if implemented properly then this feature could be a
worthy addition to org, even as default if it works well, because it's
a much better user experience and a much better first impression for
new users, instead of the current default fragile table which falls
apart during typing and fixed only when TAB is pressed.

 

Re: Can't turn off hide-stars

2020-03-27 Thread Lawrence Bottorff
I've found a way to side-step this issue by simply evaluating (setq-default
indent-tabs-mode nil). From then on any formatting is just spaces and the
shifting doesn't occur. Still, this is odd behavior.

On Fri, Mar 27, 2020 at 3:26 PM Lawrence Bottorff  wrote:

> Changing my theme didn't help. The foreground-color of hide-face is set to
> the background color of my theme. What I suspect the problem is is the
> spaces and tabs used by sml-mode for indentations. I don't think other
> languages use a mix of spaces and tabs. They use just spaces. Is there a
> way to convert every tab to its size in spaces?
>
> On Fri, Mar 27, 2020 at 2:52 PM Ag Ibragimov 
> wrote:
>
>>
>> > As far as "org-hide face", I'm not sure what you mean.
>>
>> You've said:
>>
>> > I can't find where orgmode is suppressing the display of leading
>> asterisks of headings.
>>
>> The asterisks being displayed/hidden is controlled by 'org-hide' face.
>> Run "M-x describe-face org-hide RET" and see what the foreground of that
>> face is set to. Alternatively, you can try switching to another theme and
>> see if that makes any difference.
>>
>> On Fri 27 Mar 2020 at 12:30, Lawrence Bottorff  wrote:
>>
>> > I did have a monospace font, but changing to a vari-spaced one didn't
>> help.
>> > I can promote/demote the heading above the code block and the alignment
>> of
>> > the code shifts along with it, specifically this sort of block with a
>> let
>> >
>> > #+begin_src sml
>> > fun countUpFrom1 (x : int) =
>> > let
>> > fun count (from : int, to : int) =
>> >if from = to
>> >then to :: []
>> >else from :: count (from+1, to)
>> > in
>> > count (1, x)
>> > end
>> > #+end_src
>> >
>> > Note, this is copied into my gmail from below a heading 4 -- which in
>> the
>> > sml code block looks good. However, as I pasted this into gmail, the
>> spaces
>> > and tabs are behaving differently, e.g., the let is exactly 4 spaces
>> over,
>> > while the second nested fun is just a single tab over, which gmail isn't
>> > honoring. This
>> > is the same behavior I'm seeing at, e.g., a level 3 heading.
>> >
>> > Again, when this file is brought up in a clean emacs -Q where only SML
>> > mode/ob is set up and stars are all showing there is no (spaces v. tabs)
>> > shifting around trouble. If I could definitively turn off star hiding I
>> > could get around this shifting problem. But why this is happening is
>> very
>> > mysterious. As far as "org-hide face", I'm not sure what you mean.
>> >
>> > On Fri, Mar 27, 2020 at 12:19 PM Ag Ibragimov <
>> agzam.ibragi...@gmail.com>
>> > wrote:
>> >
>> >>
>> >> Have you tried tweaking org-hide face? Maybe the problem is with the
>> font
>> >> you use, is it monospaced?
>> >>
>> >> On Thu 26 Mar 2020 at 22:40, Lawrence Bottorff 
>> wrote:
>> >>
>> >> > I have searched high and low through my init/config and I can't find
>> >> where
>> >> > orgmode is suppressing the display of leading asterisks of headings.
>> I've
>> >> > got org-hide-leading-stars set to nil -- but it turns itself back on
>> >> > whenever I open an org file. I can start a clean, blank org file (no
>> >> > #+STARTUP hidestars/showstars) and create a few headings -- to see,
>> once
>> >> > again, the leading stars suppressed. My org-bullets is commented out
>> in
>> >> > init-land. I try an emacs -Q and of course I have leading stars on
>> >> > sub-headings, however deep. Yes, it's something in my init/config,
>> but I
>> >> > just can't find what's suppressing leading stars.
>> >> >
>> >> > The whole reason I'm trying to do this is I'm tinkering with babel
>> SML
>> >> and
>> >> > whenever I have a code block under a heading -- depending on the
>> depth of
>> >> > the heading -- the SML code block can be mis-justified. And if I
>> >> > promote/demote the heading around with M- the SML
>> code
>> >> > alignment dances around depending on the depth. I can do C-c ' and
>> the
>> >> > alignment is perfect; but come back the org file and it's wonky. So
>> if I
>> >> > set up an SML babel environment in an emacs -Q environment -- with
>> >> leading
>> >> > starts -- no problem.
>> >> >
>> >> > This is maddening, to say the least. I need to turn off suppression
>> or
>> >> > figure out why suppressed stars and babel SML blocks don't mix.
>> >> >
>> >> > LB
>> >>
>> >>
>> >>
>>
>>


Indirect trace-function results to org-babel current-buffer

2020-03-27 Thread abst.proc.do
When tried to apply =trace-function= to a recursive-factorial which
print the tracing course to the current buffer:

#+BEGIN_SRC elisp
(defun factorial(n)
  (if (= n 1)
  1
  (* n (factorial (- n 1)
(trace-function #'factorial (current-buffer))
(factorial 4)
#+END_SRC==

1 -> (factorial 4)
| 2 -> (factorial 3)
| | 3 -> (factorial 2)
| | | 4 -> (factorial 1)
| | | 4 <- factorial: 1
| | 3 <- factorial: 2
| 2 <- factorial: 6
1 <- factorial: 24


It works as expected but report in the echo area the error :
: org-babel-insert-result: Wrong type argument: markerp, nil

Additionally, the tracing result does not append immediately to the
source code but join to its next heading.

#+BEGIN_SRC elisp
(defun factorial(n)
  (if (= n 1)
  1
  (* n (factorial (- n 1)
(trace-function #'factorial (current-buffer))
(factorial 4)
#+END_SRC

* Result
==
1 -> (factorial 4)
| 2 -> (factorial 3)
| | 3 -> (factorial 2)
| | | 4 -> (factorial 1)
| | | 4 <- factorial: 1
| | 3 <- factorial: 2
| 2 <- factorial: 6
1 <- factorial: 24