From mboxrd@z Thu Jan 1 00:00:00 1970 From: Feng Shu Subject: about truncate line depend context Date: Mon, 24 Mar 2014 22:55:08 +0800 Message-ID: <87y4zz8x4j.fsf@news.tumashu-localhost.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS6WB-00065B-UR for emacs-orgmode@gnu.org; Mon, 24 Mar 2014 11:10:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WS6W3-0002uG-HP for emacs-orgmode@gnu.org; Mon, 24 Mar 2014 11:10:27 -0400 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]:40915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS6Tm-0002Dx-63 for emacs-orgmode@gnu.org; Mon, 24 Mar 2014 11:07:58 -0400 Received: by mail-pd0-f175.google.com with SMTP id x10so5441126pdj.34 for ; Mon, 24 Mar 2014 08:07:56 -0700 (PDT) Received: from news.tumashu-localhost.org ([120.4.235.135]) by mx.google.com with ESMTPSA id c7sm33751852pbt.0.2014.03.24.08.07.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 24 Mar 2014 08:07:55 -0700 (PDT) Received: from feng by news.tumashu-localhost.org with local (Exim 4.80) (envelope-from ) id 1WS6HM-000853-3G for emacs-orgmode@gnu.org; Mon, 24 Mar 2014 22:55:08 +0800 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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 --