phillord / lentic

Create views of the same content in two Emacs buffers
183 stars 12 forks source link

The problem of Head1 with tags #33

Closed tumashu closed 8 years ago

tumashu commented 9 years ago
* fff-fff                                                              :test:

This get the unexpected results:

;;; fff:-fff                                                              :test:
phillord commented 9 years ago

Hmm, tricky. The problem is that "-" is not word syntax in org-mode, although the reverse transformation works because it is word syntax in emacs-lisp mode.

Of course, I can just add "-" to the match, but that will only work for "-". Do you have any other characters you want?

Or alternatively, I could try and change the regexp to match anything except for ";" , ":" or space.

Or, I could match spaces also. This would also allow me to match

* Multi Word Lines                         :with-tags:

Although, I can't think how I can identify the end of the last word here, at least not with a regexp.

tumashu commented 9 years ago
Or alternatively, I could try and change the regexp to match anything except for ";" , ":" or space.

I think this is a good idea, but stable and consistent is more important.

phillord commented 9 years ago

Yes, I agree -- and it turns out that multi-word lines is a bit of a pain. I'm am more inclined to just support "-", although for my use of the org -> transformation I just use the "standard" headers "Commentary, Code" and so on.

Shall we leave things as they are for now, till there is a more compelling use case?

tumashu commented 9 years ago

if head1 has tags, don't convert its * to ";;;", just add "#". can this approach solve the issue

tumashu commented 9 years ago

another approach is: add a custom list, convert its element to head1, then we can add ";;;head;" ";;;commentary;" to this list, this may be a simper way

phillord commented 9 years ago

This would mean that you couldn't call but tags on Code::: headers.

The easiest way to achieve this is to just not use Head 2 which uses this transformation. Or just use the org->el transformation which does not special head 1 transform.

tumashu notifications@github.com writes:

if head1 has tags, don't convert its * to ";;;", just add "#". can this approach solve the issue


Reply to this email directly or view it on GitHub: https://github.com/phillord/lentic/issues/33#issuecomment-102197096

Phillip Lord, Phone: +44 (0) 191 208 7827 Lecturer in Bioinformatics, Email: phillip.lord@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU

phillord commented 9 years ago

I'm wary of that one because its even more restrictive than the current "single word header 1" rule.

tumashu notifications@github.com writes:

another approach is: add a custom list, convert its element to head1, then we can add ";;;head;" ";;;commentary;" to this list, this may be a simper way


Reply to this email directly or view it on GitHub: https://github.com/phillord/lentic/issues/33#issuecomment-102198945

tumashu commented 9 years ago
I'm wary of that one because its even more restrictive than the current "single word header 1" rule. 

Yes, but i think it can be regard as "org->el" enhance, but more comfortable, the reason is that:

  1. I think "org -> el" is more stable and consistent than "orgel -> el".
  2. we can use a custom regexp list to match the string convert to head1
  3. head1 is often ";;;head:" ";;;commary;" ";;;Codes:" and ":;;Footer:", custom head1 is seldom used in elisp file.
  4. If I want to custom head1, I can use this style, which very very easy to deal with by org-mode
;;; Codes:
;;* This is codes head1 :export
;;   xxxxxx

output:

* ;;;Code:
* This is codes head1 :export
xxxxxx
tumashu commented 9 years ago

If i want to a clean org file, i just export to org file....

tumashu commented 9 years ago
This would mean that you couldn't call but tags on Code::: headers. 

I don't need to add tags to "Codes:", i just use follow tips and can use a beautiful head1.

;;; Codes:
;; * This is my Codes head  :export:
 Or just use the org->el transformation which does not special head 1 transform. 

org->el has follow issue:

  1. can't deal with first line.
  2. "Header" ""Codes" "Commentary" and "Footer" convert as paragraphy, need use regexp-replace to deal with. which seemd not very easy....
tumashu commented 9 years ago

Maybe we can add another transformation method, for example: "org->el++"

phillord commented 9 years ago

Yes, I agree, that "Code:", "Commentary:" and my own "Header" and "Footer" are perhaps the only ones we need. And, as you say, we can add "normal" header one in other ways. I will think on this, but it does seem to be a reasonable solution to the problem. It would probably simplify the code also.

On the first line issue for org->el I am not hugely keen on fixing this. It adds complexity and sort of defeats the point of having the orgel transformation.

tumashu commented 8 years ago

Is the status of this ?

phillord commented 8 years ago

Well, we have tags on H1, but only single word H1. You can't put dashes in words.

To be honest, at the moment, I think that this is the best compromise, and I am not planning to restrict H1 to specified words. I'd be willing to take a patch which supports "-".

tumashu commented 8 years ago

i want to code and maintain my own version:

  1. base on org-el
  2. deal with header, Codes, Commentary, and Footer

but have failed, could you help me?

phillord commented 8 years ago

I am happy to help with any problems that you have, within reason.

Phil

tumashu notifications@github.com writes:

i want to code and maintain my own version:

  1. base on org-el
  2. deal with header, Codes, Commentary, and Footer

but have failed, could you help me?


Reply to this email directly or view it on GitHub: https://github.com/phillord/lentic/issues/33#issuecomment-147082298

Phillip Lord, Phone: +44 (0) 191 208 7827 Lecturer in Bioinformatics, Email: phillip.lord@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU

tumashu commented 8 years ago

Finally, I realized that "el-org" is more convenient than ‘’orgel-org“ with the help of tip,

;;; Codes:
;; * This is my code     :code:

I will use "el-org" and hack org-exporter, this seem more easy and stable

tumashu commented 8 years ago
;;; chinese-pyim-core.el --- The core of Chinese pinyin input method

As for the above problem, may be i can use "before-save-hook"..

phillord commented 8 years ago

tumashu notifications@github.com writes:

;;; chinese-pyim-core.el --- The core of Chinese pinyin input method

As for the above problem, may be i can use "before-save-hook"..

I've rather lost context here. Is this a question?

tumashu commented 8 years ago

now i think el-org is more stable than orgel-org, one problem is that ";;;" will be translate to ";; ;;;", i want to deal with it by before-save-hook ,but fail

tumashu commented 8 years ago

i just want "el-org" + ";;, ;;; fix",

phillord commented 8 years ago

tumashu notifications@github.com writes:

now i think el-org is more stable than orgel-org,

Yes, that's undoubtedly true. It's simpler, which makes stability more straight-forward.

one problem is that ";;;" will be translate to ";; ;;;", i want to deal with it by before-save-hook ,but fail

Well, the code to detal with that is in orgel-org. Not sure using before-save-hook will help -- any changes you make there will be percolated by lentic.

Phil

tumashu commented 8 years ago

The below is the code current used, any suggestion? thanks!

https://github.com/tumashu/emacs-helper/blob/master/eh-lentic.el

phillord commented 8 years ago

If you are after general suggestions, then I wouldn't nest all of this in a use-package macro. I am not sure what the eh-lentic function is doing -- if there is something about the UI that you don't like, then let me know and I will incorporate. The rest seems okay.

Or is it broken?

tumashu notifications@github.com writes:

The below is the code current used, any suggestion? thanks!

https://github.com/tumashu/emacs-helper/blob/master/eh-lentic.el


Reply to this email directly or view it on GitHub: https://github.com/phillord/lentic/issues/33#issuecomment-149147063

tumashu commented 8 years ago

"eh-lentic" is my own quick lentic command, which just "split-below" and "active the below window" maybe "eh-lentic-switch-window" is a good name.

tumashu commented 8 years ago

At the moment, my project "Chinese-pyim" is using "lentic-el2org-init", and works well: https://github.com/tumashu/chinese-pyim

This is my custom lentic-doc :-) https://github.com/tumashu/chinese-pyim/blob/master/chinese-pyim-devtools.el

This is the website generated from elisp with the help of lentic and org-webpage http://tumashu.github.io/chinese-pyim/

tumashu commented 8 years ago

test7

phillord commented 8 years ago

Thanks for uploading the gif, it's really nice to see lentic in action for someone else. If you have the time, you couldn't do a brief gif using chinese-pyim? I'd love to see lentic working with a non-latin character set.

tumashu commented 8 years ago

test11

OK!

tumashu commented 8 years ago

gif is too big, suggest download and view.

tumashu commented 8 years ago

I have changed my lentic config a little, now i only use a command eh-lenitc-switch-window' to do all my lentic switch work, very easy use, this command is bound to 'C-c j', This behavier is more likeorg-edit-special'

2

phillord commented 8 years ago

I switch views on F1 - although I normally look at one view at a time.

These gifs are really, really nice. Do you mind if I use them from my lentic front page?

tumashu commented 8 years ago

Feel free to use these gifs

tumashu commented 8 years ago

by the way, my own lentic-el2org-init is very similar lentic-el-org-init, is it possible to merge it to lentic-el-org-init? if not, I will build a new melpa package to hold `lentic-el2org-init', this package's feature will be like el2markdown.

phillord commented 8 years ago

Not sure how I could merge these to be honest. I could do this...

(defun lentic-org-oset (conf)
  (lentic-m-oset
   conf
   :this-buffer (current-buffer)
   :comment ";; "
   :comment-stop "#\\\+BEGIN_SRC emacs-lisp.*"
   :comment-start "#\\\+END_SRC"
   :lentic-file (concat
     (file-name-sans-extension
      (buffer-file-name))
     ".el")))

Which would make org-el-init this.

(defun lentic-org-el-init ()
  (lentic-org-oset
   (lentic-unmatched-uncommented-chunk-configuration
    "lb-org-to-el")))

and likewise for el-org-init. This would reduce your own lentic-el2org-init as well.

Phil

tumashu notifications@github.com writes:

by the way, my own lentic-el2org-init‘ is very similarlentic-el-org-init’, is it possible to merge it to ·lentic-el-org-init‘? if not, I will build a new melpa package to hold `lentic-el2org-init', this package's feature will be like el2markdown.


Reply to this email directly or view it on GitHub: https://github.com/phillord/lentic/issues/33#issuecomment-150728002

tumashu commented 8 years ago

now, i refactor my lentic config, as a module of org-webpage, which only focus write org format comment , simple and useful...

tumashu commented 8 years ago

https://github.com/tumashu/org-webpage/blob/master/owp-lentic.el

phillord commented 8 years ago

It's nice to see that it is working well for you!

tumashu commented 8 years ago

i have refacted my owp-lentic.el file to a new package: easy-lentic. may be you are interesting it too... https://github.com/tumashu/easy-lentic

phillord commented 8 years ago

It's good that this is all working for you. I've been debating adding tools for adding markers, but haven't as I just use yasnippet, or org-mode tools but see you have done this already.

Will close this now, as I don't think it's outstanding, but feel free to re-open.

tumashu commented 8 years ago

Ok, thanks for your help!