emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [calfw] Better use of space
@ 2011-07-21  8:57 Rasmus
  2011-07-22  7:03 ` SAKURAI Masashi
  0 siblings, 1 reply; 7+ messages in thread
From: Rasmus @ 2011-07-21  8:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi, 

I have a feature request for Calfw.

Masashi, would you prefer these to be posted here or on your github
page?

Anyhow, the month view is just superb!

However, when using especially the two week view (and this is probably
also true for the week view) I would like calfw to utilize vertical
space better. By 'better' I basically mean that I would like calfw to be
greedy.

Refer to the following screenshot:

   http://ompldr.org/vOWtjdA

Compare (the second week) to Google Cal: 

   http://ompldr.org/vOWtjdg

Seeing there is a lot of space left in each of Calfw's day-column it
would be nice if it could be used to enhance the overview. This could
for example be archived mapping events against time on the vertical axis
as the Google calendar does (and also Mozilla Lightning but it no longer
work on my system). This might also allow for printing more text from
the even entry (using multiple lines).

On the other hand we probably also want to make sure that it is still
works on a 800x600 display. Thus, it might be best to introduce a
governing variable.

Unfortunately, my own Emacs Lisp skills are not sufficient to implement
such a thing at the moment.  

Thanks a bunch for Calfw. It a great supplement to Org-Agenda. 

Cheers,
Rasmus

-- 
Sent from my Emacs

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

* Re: [calfw] Better use of space
  2011-07-21  8:57 [calfw] Better use of space Rasmus
@ 2011-07-22  7:03 ` SAKURAI Masashi
  2011-07-22  9:12   ` Rasmus
  0 siblings, 1 reply; 7+ messages in thread
From: SAKURAI Masashi @ 2011-07-22  7:03 UTC (permalink / raw)
  To: rasmus; +Cc: emacs-orgmode

Hi Rasmus,

At Thu, 21 Jul 2011 10:57:45 +0200,
Rasmus wrote:
> :
> I have a feature request for Calfw.
> 
> Masashi, would you prefer these to be posted here or on your github
> page?

I like here because I can get more comments than do in other channels.
I'm sorry that other members does not feel noisy.

I can catch both track and I will manage incoming issues and my
progress. Then, I will announce calfw updates here.


> Anyhow, the month view is just superb!
> 
> However, when using especially the two week view (and this is probably
> also true for the week view) I would like calfw to utilize vertical
> space better. By 'better' I basically mean that I would like calfw to be
> greedy.
> 
> Refer to the following screenshot:
> 
>    http://ompldr.org/vOWtjdA
> 
> Compare (the second week) to Google Cal: 
> 
>    http://ompldr.org/vOWtjdg
> 
> Seeing there is a lot of space left in each of Calfw's day-column it
> would be nice if it could be used to enhance the overview. This could
> for example be archived mapping events against time on the vertical axis
> as the Google calendar does (and also Mozilla Lightning but it no longer
> work on my system). This might also allow for printing more text from
> the even entry (using multiple lines).

Thanks for your request and good images.
I think this request involves 3 functions.

* Time table layout

I think this function is very difficult, because it needs many study
for me to implement, including following functions.
Of course, I consider the time table view is one of the goal of calfw.

* Display multiple-lines items (the source splits an item multiple lines.)

This is not so difficult. In this mechanism, the source objects can
propose some formats, for example, "15:00 appointment" and ("15:00-15:30" 
"appointment"). Then, calfw chooses the suitable format and displays 
in the current layout algorithm.

I will design the interface between cfw:source and calfw, and
implement it.

* Word-wrapping and folding lines (calfw splits lines within a column.)

This is little difficult. I think word-wrapping, folding lines and
truncating strings can not be achieved in the narrow columns
straightforwardly. I need a time to study this issue.

> On the other hand we probably also want to make sure that it is still
> works on a 800x600 display. Thus, it might be best to introduce a
> governing variable.

Yes. It is good idea.

Regards,
--
SAKURAI, Masashi (family, given)
m.sakurai@kiwanami.net

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

* Re: [calfw] Better use of space
  2011-07-22  7:03 ` SAKURAI Masashi
@ 2011-07-22  9:12   ` Rasmus
  2011-07-25  3:41     ` SAKURAI Masashi
  0 siblings, 1 reply; 7+ messages in thread
From: Rasmus @ 2011-07-22  9:12 UTC (permalink / raw)
  To: emacs-orgmode

Hi Masashi,

> I like here
We're trilled that you're here! 

> Thanks for your request and good images.
> I think this request involves 3 functions.

You are probably right. 

> * Time table layout
>
> I think this function is very difficult, because it needs many study
> for me to implement, including following functions.
> Of course, I consider the time table view is one of the goal of calfw.

Oh, right; it could be done as a seperate view or layout. 

> * Display multiple-lines items (the source splits an item multiple lines.)
>
> This is not so difficult. In this mechanism, the source objects can
> propose some formats, for example, "15:00 appointment" and ("15:00-15:30" 
> "appointment"). Then, calfw chooses the suitable format and displays 
> in the current layout algorithm.

It could be a string similar to how BBDB, Gnus and other Emacs mode does
it. See for example (describe-variable 'gnus-summary-line-format).

User could specify calfw:timeview-format "%Starttime-%Endtime: %Event"
or whatever. 

> * Word-wrapping and folding lines (calfw splits lines within a column.)
>
> This is little difficult. I think word-wrapping, folding lines and
> truncating strings can not be achieved in the narrow columns
> straightforwardly. I need a time to study this issue.

Hmm, 
I guess the width of column is calculated when generating the view. 
I'll use pseudo-code as my Emacs Lisp isn't great.  
#+begin_src emacs-lisp
  (if (> (calfw:timeview-entry-length) (calfw:column-length))
   (#split-entry after column-length, preferbly after word
    # and retur
   )    
#+end_src
I hope it makes sense. . . 

–Rasmus

-- 
Sent from my Emacs

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

* Re: [calfw] Better use of space
  2011-07-22  9:12   ` Rasmus
@ 2011-07-25  3:41     ` SAKURAI Masashi
  2011-09-06  2:11       ` SAKURAI Masashi
  0 siblings, 1 reply; 7+ messages in thread
From: SAKURAI Masashi @ 2011-07-25  3:41 UTC (permalink / raw)
  To: rasmus; +Cc: emacs-orgmode

Hi Rasmus,

At Fri, 22 Jul 2011 11:12:46 +0200,
Rasmus wrote:
> :
> > * Display multiple-lines items (the source splits an item multiple lines.)
> >
> > This is not so difficult. In this mechanism, the source objects can
> > propose some formats, for example, "15:00 appointment" and ("15:00-15:30" 
> > "appointment"). Then, calfw chooses the suitable format and displays 
> > in the current layout algorithm.
> 
> It could be a string similar to how BBDB, Gnus and other Emacs mode does
> it. See for example (describe-variable 'gnus-summary-line-format).
> 
> User could specify calfw:timeview-format "%Starttime-%Endtime: %Event"
> or whatever. 

Thanks for references.
I will check them.

> > * Word-wrapping and folding lines (calfw splits lines within a column.)
> >
> > This is little difficult. I think word-wrapping, folding lines and
> > truncating strings can not be achieved in the narrow columns
> > straightforwardly. I need a time to study this issue.
> 
> Hmm, 
> I guess the width of column is calculated when generating the view. 
> I'll use pseudo-code as my Emacs Lisp isn't great.  
> #+begin_src emacs-lisp
>   (if (> (calfw:timeview-entry-length) (calfw:column-length))
>    (#split-entry after column-length, preferbly after word
>     # and retur
>    )    
> #+end_src
> I hope it makes sense. . . 

Yes. The code is the start point. I would discuss how to split a line.
I show two simple code as following:
(Note: These codes include Japanese characters.)

* Simple counting and splitting

This code splits words mechanically. I think it is bad for the Western
languages. However, for the Eastern Asian languages, this result is
not bad.

#+begin_src emacs-lisp
(let ((str "The quick brown fox jumped over the lazy dog. The internationalization and Localization are long words. 日本語を含むときの場合。")
      (fill-column 10))
  (loop with ret = nil
        with curcol = 0 with lastpos = 0
        with endpos = (1- (length str))
        for i from 0 upto endpos
        for c = (aref str i)
        for w = (char-width c)
        if (or (= endpos i) (<= fill-column (+ curcol w))) do
        (push (substring str lastpos (1+ i)) ret)
        (setq lastpos (1+ i) curcol 0)
        else do
        (incf curcol w)
        finally return (mapconcat 'identity (nreverse ret) "\n")))
; => 
"The quick 
brown fox 
jumped ove
r the lazy
 dog. The 
internatio
nalization
 and Local
ization ar
e long wor
ds. 日本語
を含むとき
の場合。"
#+end_src

* Word-wrapping by fill function of Emacs

This splitting is smarter, but not perfect.
Long words are still need truncation or hyphenation.

#+begin_src emacs-lisp
(let ((str "The quick brown fox jumped over the lazy dog. The internationalization and Localization are long words. 日本語を含むときの場合。")
      (fill-column 10))
  (with-temp-buffer
    (insert str)
    (fill-region (point-min) (point-max))
    (buffer-string)))
; => 
"The quick
brown fox
jumped
over the
lazy
dog. The
internationalization
and
Localization
are long
words. 日本
語を含むと
きの場合。"
#+end_src


So, I think I should study the word-wrapping algorithm.
If someone knows better algorithm or implementations, please let me
know.

Regards,
--
SAKURAI, Masashi (family, given)
m.sakurai@kiwanami.net

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

* Re: [calfw] Better use of space
  2011-07-25  3:41     ` SAKURAI Masashi
@ 2011-09-06  2:11       ` SAKURAI Masashi
  2011-09-07  8:32         ` Rasmus
  0 siblings, 1 reply; 7+ messages in thread
From: SAKURAI Masashi @ 2011-09-06  2:11 UTC (permalink / raw)
  To: rasmus; +Cc: emacs-orgmode

Hi Rasmus,

I implemented simple multi line breaking.
Here is a screenshot.
http://twitpic.com/6gpgz7/full

I pushed the multiline branch on the github.
https://github.com/kiwanami/emacs-calfw/tree/multiline
(including some minor updating)

I have studied some line breaking algorithms.

- Word wrap - Wikipedia, the free encyclopedia
  - http://en.wikipedia.org/wiki/Word_wrap
- Other implementations
  - Python implementation
  - Perl Text::Reflow 
- The Knuth/Plass line-breaking Algorithm
  - http://defoe.sourceforge.net/folio/knuth-plass.html
- Some command line programs
  - fmt, groff

Then, I found that the complicated algorithms, such as 'Knuth/Plass
line-breaking Algorithm', are difficult to implement on the Emacs Lisp
efficiently, because the line breaking function is called many time
during rendering the view.  (I hope that Emacs support native
line-breaking function.)

So, I introduced a pluggable design for the line breaking algorithm
and I just implement simple line breaking code.  I will use this code
for a while and evaluate use-feeling.

If you have a time, will you check it out?
I would like to hear feeling from the not East Asians users,
using line breaking without no smart word-wrapping and hyphenation.


Thank you,
--
SAKURAI, Masashi (family, given)
m.sakurai@kiwanami.net

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

* Re: [calfw] Better use of space
  2011-09-06  2:11       ` SAKURAI Masashi
@ 2011-09-07  8:32         ` Rasmus
  2011-09-08  1:50           ` SAKURAI Masashi
  0 siblings, 1 reply; 7+ messages in thread
From: Rasmus @ 2011-09-07  8:32 UTC (permalink / raw)
  To: emacs-orgmode

SAKURAI Masashi <m.sakurai@kiwanami.net> writes:

> I pushed the multiline branch on the github.
> https://github.com/kiwanami/emacs-calfw/tree/multiline(including some minor updating)

Thanks!

>
> Then, I found that the complicated algorithms, such as 'Knuth/Plass
> line-breaking Algorithm', are difficult to implement on the Emacs Lisp
> efficiently, because the line breaking function is called many time
> during rendering the view.  (I hope that Emacs support native
> line-breaking function.)

Emacs has several built-in word wrapping mechanisms.  See
   Options → Line Wrapping in this buffer 
for an overview.  My preferred method is Word Wrap.  Whether this can
   easily be utilized by calfw I don't know.

> If you have a time, will you check it out?
> I would like to hear feeling from the not East Asians users,
> using line breaking without no smart word-wrapping and hyphenation.

It works okay.  The problem is not so much the line breaking as the lack
of appropriately segregating entries.  

The following view is decent, and word wrap certainly improves
the ease of obtaining information:
   http://ompldr.org/vYThpOQ

On the other hand information is not easily obtained from a week with
lots of scheduled class from a single file: 
   http://ompldr.org/vYThpYQ

 - An easy solution might be do add a `\n' but this might not always be
   desirable.
 - Events could also be separated by lines.
 - Different shades might also be a possibility. Here is a screenshot of
   my Gnus group buffer which is striped. 
      http://ompldr.org/vYThpZQ

Cheers,
Rasmus

-- 
Sent from my Emacs

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

* Re: [calfw] Better use of space
  2011-09-07  8:32         ` Rasmus
@ 2011-09-08  1:50           ` SAKURAI Masashi
  0 siblings, 0 replies; 7+ messages in thread
From: SAKURAI Masashi @ 2011-09-08  1:50 UTC (permalink / raw)
  To: rasmus; +Cc: emacs-orgmode

Thanks for your comment!

At Wed, 07 Sep 2011 10:32:48 +0200,
Rasmus wrote:
> :
> 
> Emacs has several built-in word wrapping mechanisms.  See
>    Options → Line Wrapping in this buffer 
> for an overview.  My preferred method is Word Wrap.  Whether this can
>    easily be utilized by calfw I don't know.

Yes. I seem this word wrapping algorithm is a simple one (it may be
the same as 'fill-region'), which is shown at the Wikipedia. To fill
out the narrow space efficiently, I think hyphenation is needed.
I will continue to search the better algorithm.


> > If you have a time, will you check it out?
> > I would like to hear feeling from the not East Asians users,
> > using line breaking without no smart word-wrapping and hyphenation.
> 
> It works okay.  The problem is not so much the line breaking as the lack
> of appropriately segregating entries.  
> 
> The following view is decent, and word wrap certainly improves
> the ease of obtaining information:
>    http://ompldr.org/vYThpOQ
> 
> On the other hand information is not easily obtained from a week with
> lots of scheduled class from a single file: 
>    http://ompldr.org/vYThpYQ
> 
>  - An easy solution might be do add a `\n' but this might not always be
>    desirable.
>  - Events could also be separated by lines.
>  - Different shades might also be a possibility. Here is a screenshot of
>    my Gnus group buffer which is striped. 
>       http://ompldr.org/vYThpZQ

I think the current look needs to improve in the case of many
schedules too.

Many schedule items, like Japanese TV programs guides...
https://twitter.com/#!/kiwanami/status/110721726375145472/photo/1/large

I'm going to try some improvement, such as inserting a horizontal
line, applying different face on the first lines and shading like gnus
group buffer.

I will inform here again.
Thank you,

--
SAKURAI, Masashi (family, given)
m.sakurai@kiwanami.net

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

end of thread, other threads:[~2011-09-08  1:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-21  8:57 [calfw] Better use of space Rasmus
2011-07-22  7:03 ` SAKURAI Masashi
2011-07-22  9:12   ` Rasmus
2011-07-25  3:41     ` SAKURAI Masashi
2011-09-06  2:11       ` SAKURAI Masashi
2011-09-07  8:32         ` Rasmus
2011-09-08  1:50           ` SAKURAI Masashi

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

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

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