emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* about truncate line depend context
@ 2014-03-24 14:55 Feng Shu
  0 siblings, 0 replies; only message in thread
From: Feng Shu @ 2014-03-24 14:55 UTC (permalink / raw)
  To: orgmode


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

-- 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-24 15:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-24 14:55 about truncate line depend context Feng Shu

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).