unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: emacs-devel@gnu.org
Cc: Stefan Kangas <stefan@marxist.se>
Subject: Re: master 262a7c9ea0: New minor mode elide-head-mode
Date: Sun, 09 Jan 2022 18:22:37 +0800	[thread overview]
Message-ID: <87ee5htdhu.fsf@yahoo.com> (raw)
In-Reply-To: <20220109101221.E3FDAC0DA16@vcs2.savannah.gnu.org> (Stefan Kangas's message of "Sun, 9 Jan 2022 05:12:21 -0500 (EST)")

Stefan Kangas <stefankangas@gmail.com> writes:

>  (defun elide-head (&optional arg)
>    "Hide header material in buffer according to `elide-head-headers-to-hide'.
> @@ -88,43 +151,17 @@ The header is made invisible with an overlay.  With a prefix arg, show
>  an elided material again.
>  
>  This is suitable as an entry on `find-file-hook' or appropriate mode hooks."
> +  (declare (obsolete elide-head-mode "29.1"))
>    (interactive "P")
>    (if arg
> -      (elide-head-show)
> -    (save-excursion
> -      (save-restriction
> -	(let ((rest elide-head-headers-to-hide)
> -	      beg end)
> -	  (widen)
> -	  (goto-char (point-min))
> -	  (while rest
> -	    (save-excursion
> -	      (when (re-search-forward (caar rest) nil t)
> -		(setq beg (point))
> -		(when (re-search-forward (cdar rest) nil t)
> -		  (setq end (point-marker)
> -			rest nil))))
> -	    (if rest (setq rest (cdr rest))))
> -	  (if (not (and beg end))
> -	      (if (called-interactively-p 'interactive)
> -		  (message "No header found"))
> -	    (goto-char beg)
> -	    (end-of-line)
> -	    (if (overlayp elide-head-overlay)
> -		(move-overlay elide-head-overlay (point-marker) end)
> -	      (setq elide-head-overlay (make-overlay (point-marker) end)))
> -	    (overlay-put elide-head-overlay 'invisible t)
> -	    (overlay-put elide-head-overlay 'evaporate t)
> -	    (overlay-put elide-head-overlay 'after-string "...")))))))
> +      (elide-head--show)
> +    (elide-head--hide)))
>  
>  (defun elide-head-show ()
>    "Show a header in the current buffer elided by \\[elide-head]."
> +  (declare (obsolete elide-head-mode "29.1"))
>    (interactive)
> -  (if (and (overlayp elide-head-overlay)
> -	   (overlay-buffer elide-head-overlay))
> -      (delete-overlay elide-head-overlay)
> -    (if (called-interactively-p 'interactive)
> -	(message "No header hidden"))))
> +  (elide-head--show))

Hmm... couldn't those two obsolete commands be made wrappers around
`elide-head-mode'?

For example:

   (defun elide-head-show ()
     "Show a header in the current buffer elided by \\[elide-head]."
     (interactive)
     (elide-head-mode 0))

And if those commands are made such simple wrappers, they could be
un-obsoleted as well, since it would be useful to explictly disable or
enable elide-head-mode inside `find-file-hook' and other similar places.

Thanks.



       reply	other threads:[~2022-01-09 10:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <164172314114.31544.13495331125988316383@vcs2.savannah.gnu.org>
     [not found] ` <20220109101221.E3FDAC0DA16@vcs2.savannah.gnu.org>
2022-01-09 10:22   ` Po Lu [this message]
2022-01-09 10:59     ` master 262a7c9ea0: New minor mode elide-head-mode Stefan Kangas
2022-01-09 11:58       ` Po Lu
2022-01-10  3:35         ` Stefan Monnier
2022-01-10 12:35           ` Po Lu
2022-01-10 17:36             ` Stefan Monnier
2022-01-10  4:16         ` Stefan Kangas
2022-01-11  0:45           ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ee5htdhu.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).