ãããã¡å ã®ã³ã¡ã³ããé表示ã«ãã
TeXã§æç« ãæ¸ãã¦ããã¨ãã«ã³ã¡ã³ãé¨åãä¸æ¬ãã¦é表示ã«ããããªã£ããä¼¼ããããªæ©è½ã¨ãã¦ã¯outline-modeãhide-ifdef-modeããããããã®ãã®ãã°ãã®æ©è½ã¯è¦ã¤ãããªãã£ãã®ã§ãããããåèã«ããªããã¡ããã£ã¨æ¸ãã¦ã¿ãã
(2006.3.6 11:21 ã¡ãã£ã¨ä¿®æ£)
(defun beginning-of-comment () (interactive) (let ((pos (comment-beginning))) (and pos (goto-char pos))) (while (and (save-excursion (let ((pos (point))) (and (forward-comment -1) (forward-comment 1) (= pos (point))))) (forward-comment -1)))) (defun end-of-comment () (interactive) (let ((pos (comment-beginning))) (if pos (goto-char pos) (setq pos (point)))) (let ((n 0)) (while (and (save-excursion (let ((pos (point))) (and (forward-comment 1) (forward-comment -1) (= pos (point))))) (forward-comment 1)) (setq n (1+ n))) (if (> n 0) (backward-char)))) (defun enable-hide-comment () (let ((elem '(hide-comment . t))) (if (or (atom buffer-invisibility-spec) (member elem buffer-invisibility-spec)) (add-to-invisibility-spec elem)))) (defun disable-hide-comment () (remove-overlays (point-min) (point-max) 'invisible 'hide-comment) (remove-from-invisibility-spec '(hide-comment . t))) (defun hide-comment () (interactive) (enable-hide-comment) (let* ((beg (progn (beginning-of-comment) (point))) (end (progn (end-of-comment) (point)))) (if (< beg end) (overlay-put (make-overlay beg end) 'invisible 'hide-comment)))) (defun hide-comment-buffer () (interactive) (enable-hide-comment) (save-excursion (goto-char (point-min)) (while (comment-search-forward nil t) (hide-comment)))) (defun toggle-hide-comment () (interactive) (let ((ovls (remove-if-not (lambda (o) (overlay-get o 'invisible)) (let ((beg (max (1- (point)) (point-min))) (end (min (1+ (point)) (point-max)))) (overlays-in beg end))))) (if ovls (mapc (lambda (o) (and (eq (overlay-get o 'invisible) 'hide-comment) (delete-overlay o))) ovls) (hide-comment))))
M-x hide-comment-bufferã§ãããã¡ä¸ã®å ¨ã³ã¡ã³ããé表示ã«ãªããM-x toggle-hide-commentã§åå¥ã«ã³ã¡ã³ãã®è¡¨ç¤ºï¼é表示ãåãæ¿ãããã¨ãã§ããã
ãã¾ããé表示ã«ãªã£ãã¨ãã®çç¥è¨å·("...")ãå¤æ´ããæ¹æ³ã調ã¹ã¦ãããã¡ã«ããããªé¢¨ã«ããã¨çç¥è¨å·ãã«ã¹ã¿ãã¤ãºã§ãããã¨ãåãã£ãã
(defvar highlight-selective-display nil) (make-variable-buffer-local 'highlight-selective-display) (defun highlight-selective-display (flag &optional ellipsis) (interactive "P") (or ellipsis (setq ellipsis "...")) (setq highlight-selective-display (cond ((null flag) (not highlight-selective-display)) ((numberp flag) (positivep flag)) (t t))) (let ((v (if highlight-selective-display (apply 'vector (mapcar (lambda (c) (logior c (ash (face-id 'highlight) 19))) (string-to-list ellipsis))) (string-to-vector ellipsis)))) (or buffer-display-table (setq buffer-display-table (make-display-table))) (set-display-table-slot buffer-display-table 'selective-display v)))
ãããªãã¨ãã¦ãå ´åãããªãã®ã«ãæéããªãã¨ãã«éã£ã¦æ·±è¿½ãããããªããã ããªã