emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] about truncate line depend context


From: Feng Shu
Subject: [O] about truncate line depend context
Date: Mon, 24 Mar 2014 22:55:08 +0800
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3.50 (gnu/linux)

Now I set  truncate-lines to -1 in my org file, but the table shows
ugly, So I use below code.

Can I use a hook to do this job?

#+begin_src elisp
(defun eh-org-truncate-lines (&optional arg)
  (interactive "P")
  (cond
   ((or (and (boundp 'org-clock-overlays) org-clock-overlays)
        org-occur-highlights
        org-latex-fragment-image-overlays)
    (and (boundp 'org-clock-overlays) (org-clock-remove-overlays))
    (org-remove-occur-highlights)
    (org-remove-latex-fragment-image-overlays)
    (message "Temporary highlights/overlays removed from current buffer"))
   (t
    (let* ((context (org-element-context)) (type (org-element-type context)))
      (case type
        ((table table-cell table-row item plain-list)
         (toggle-truncate-lines 1))
        (t (toggle-truncate-lines -1)))))))

(defun eh-org-ctrl-c-ctrl-c (&optional arg)
  (interactive)
  (eh-org-truncate-lines arg)
  (org-ctrl-c-ctrl-c arg))

(org-defkey org-mode-map "\C-c\C-c" 'eh-org-ctrl-c-ctrl-c)

#+end_src

-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]