unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* wrap-search 3.3.5
@ 2022-08-25 18:28 Emanuel Berg
  2022-08-25 18:34 ` Philip Kaludercic
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-25 18:28 UTC (permalink / raw)
  To: emacs-devel

;;; wrap-search.el --- wrapped, non-incremental search -*- lexical-binding: t -*-
;;
;;; Commentary:
;;
;; Author: Emanuel Berg <incal@dataswamp.org>
;; Created: 2021-05-23 (package)
;; Keywords: matching
;; License: GPL3+
;; URL: https://dataswamp.org/~incal/emacs-init/wrap-search.el
;; Version: 3.3.5
;;
;; The `wrap-search' package offers non-incremental search.
;; It shows hitss - hits and only hits.
;;
;; `wrap-search' searches forward by default, but it wraps
;; and continues up and until the search start position if
;; necessary. This is so one doesn't have to wonder if the
;; target is north or south in the buffer.
;;
;; The philosophy is that `wrap-search' mostly shouldn't be
;; used for searching - that is possible as well, of course,
;; using the same command - rather, it is used to quickly
;; navigate a buffer.
;;
;; To use the package without keyboard shortcuts isn't
;; recommended. Instead, do for example
;;
;;   (global-set-key "\C-s" #'wrap-search)
;;   (global-set-key "\C-r" #'wrap-search-again)
;;
;;; Code:

(defun wrap-string-data-p (str)
  "Return STR if it is a string but not the empty string, \"\"."
  (and (stringp str)
       (not (string= str ""))
       str) )

(let ((prev-str)
      (prev-case)
      (prev-rev)
      (prev-beg)
      (prev-end) )
  (defun wrap-search-again ()
    (interactive)
    (if (wrap-string-data-p prev-str)
        (wrap-search prev-str prev-case prev-rev prev-beg prev-end)
      (message "no search has been done") ))
  (declare-function wrap-search-again nil)

  (defun show-prev-str ()
    (if (wrap-string-data-p prev-str)
        (let*((len   (length prev-str))
              (max   10)
              (short (when (< max len)
                       (substring prev-str 0 max) )))
          (format "[%s] " (if short
                              (format "%s..." short)
                            prev-str) ))
      ""))
  (declare-function show-prev-str nil)

  (defun wrap-search (str &optional case rev beg end)
    "Search for STR.

With CASE the search is case-sensitive.
With REV the search direction is reversed, i.e. north in the buffer from point.
BEG and END, or a region, delimits the search area. (default: whole buffer)

Interactively,
\\[universal-argument] sets CASE;
\\[universal-argument] \\[universal-argument] sets REV; and
\\[universal-argument] \\[universal-argument] \\[universal-argument] sets CASE and REV.

Do \\[wrap-search-again] to repeat, with `wrap-search-again'."
    (interactive
     `(,(read-string (format "search: %s" (show-prev-str)))
       ,(or (equal current-prefix-arg '( 4))
            (equal current-prefix-arg '(64)) )
       ,(or (equal current-prefix-arg '(16))
            (equal current-prefix-arg '(64)) )
       ,@(if (use-region-p)
             (list (region-beginning) (region-end))
           (list (point-min) (point-max)) )))
    (if (string= "" str)
        (wrap-search-again)
      (setq prev-str  str)
      (setq prev-case case)
      (setq prev-rev  rev)
      (setq prev-beg  beg)
      (setq prev-end  end)
      (let*((case-fold-search (not case))
            (pos (point))
            (data (if rev (list #'search-backward end beg)
                    (list #'search-forward beg end) ))
            (search-f (car data))
            (search-beg (cadr data))
            (search-end (caddr data)) )
        (if (apply (list search-f str search-end t))
            (message "hit: %s" (point))
          (goto-char search-beg)
          (if (apply (list search-f str (+ pos (if rev 0 (length str))) t))
              (if (= pos (point))
                  (message "this is the one occurrence")
                (message "hit: %s (wrap)" (point)) )
            (goto-char pos)
            (message "no hit") ))) ))
  (declare-function wrap-search nil) )

(provide 'wrap-search)
;;; wrap-search.el ends here

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 18:28 wrap-search 3.3.5 Emanuel Berg
@ 2022-08-25 18:34 ` Philip Kaludercic
  2022-08-25 18:50   ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-25 18:34 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg <incal@dataswamp.org> writes:

Could you elaborate what you meant to say with this message.  Should it
be added to ELPA?

>
> ;;; wrap-search.el --- wrapped, non-incremental search -*- lexical-binding: t -*-
> ;;
> ;;; Commentary:

Btw. the commentary section should start after the header section.

> ;; Author: Emanuel Berg <incal@dataswamp.org>
> ;; Created: 2021-05-23 (package)
> ;; Keywords: matching
> ;; License: GPL3+
> ;; URL: https://dataswamp.org/~incal/emacs-init/wrap-search.el
> ;; Version: 3.3.5
> ;;
> ;; The `wrap-search' package offers non-incremental search.
> ;; It shows hitss - hits and only hits.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 18:34 ` Philip Kaludercic
@ 2022-08-25 18:50   ` Emanuel Berg
  2022-08-25 19:05     ` Philip Kaludercic
  2022-08-25 20:26     ` Stefan Monnier
  0 siblings, 2 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-25 18:50 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

> Could you elaborate what you meant to say with this message.
> Should it be added to ELPA?

Sure!

> Btw. the commentary section should start after the
> header section.

Okay, note that `checkdoc' don't say that, nor does the
byte-compiler ...

But thanks, you mean like this?

;;; wrap-search.el --- wrapped, non-incremental search -*- lexical-binding: t -*-
;;
;; Author: Emanuel Berg <incal@dataswamp.org>
;; Created: 2021-05-23 (package)
;; Keywords: matching
;; License: GPL3+
;; URL: https://dataswamp.org/~incal/emacs-init/wrap-search.el
;; Version: 3.3.6
;;
;;; Commentary:
;;
;; The `wrap-search' package offers non-incremental search.
;; It shows hitss - hits and only hits.
;;
;; `wrap-search' searches forward by default, but it wraps
;; and continues up and until the search start position if
;; necessary. This is so one doesn't have to wonder if the
;; target is north or south in the buffer.
;;
;; The philosophy is that `wrap-search' mostly shouldn't be
;; used for searching - that is possible as well, of course,
;; using the same command - rather, it is used to quickly
;; navigate a buffer.
;;
;; To use the package without keyboard shortcuts isn't
;; recommended. Instead, do for example
;;
;;   (global-set-key "\C-s" #'wrap-search)
;;   (global-set-key "\C-r" #'wrap-search-again)
;;
;;; Code:

(defun wrap-string-data-p (str)
  "Return STR if it is a string but not the empty string, \"\"."
  (and (stringp str)
       (not (string= str ""))
       str) )

(let ((prev-str)
      (prev-case)
      (prev-rev)
      (prev-beg)
      (prev-end) )
  (defun wrap-search-again ()
    (interactive)
    (if (wrap-string-data-p prev-str)
        (wrap-search prev-str prev-case prev-rev prev-beg prev-end)
      (message "no search has been done") ))
  (declare-function wrap-search-again nil)

  (defun show-prev-str ()
    (if (wrap-string-data-p prev-str)
        (let*((len   (length prev-str))
              (max   10)
              (short (when (< max len)
                       (substring prev-str 0 max) )))
          (format "[%s] " (if short
                              (format "%s..." short)
                            prev-str) ))
      ""))
  (declare-function show-prev-str nil)

  (defun wrap-search (str &optional case rev beg end)
    "Search for STR.

With CASE the search is case-sensitive.
With REV the search direction is reversed, i.e. north in the buffer from point.
BEG and END, or a region, delimits the search area. (default: whole buffer)

Interactively,
\\[universal-argument] sets CASE;
\\[universal-argument] \\[universal-argument] sets REV; and
\\[universal-argument] \\[universal-argument] \\[universal-argument] sets CASE and REV.

Do \\[wrap-search-again] to repeat, with `wrap-search-again'."
    (interactive
     `(,(read-string (format "search: %s" (show-prev-str)))
       ,(or (equal current-prefix-arg '( 4))
            (equal current-prefix-arg '(64)) )
       ,(or (equal current-prefix-arg '(16))
            (equal current-prefix-arg '(64)) )
       ,@(if (use-region-p)
             (list (region-beginning) (region-end))
           (list (point-min) (point-max)) )))
    (if (string= "" str)
        (wrap-search-again)
      (setq prev-str  str)
      (setq prev-case case)
      (setq prev-rev  rev)
      (setq prev-beg  beg)
      (setq prev-end  end)
      (let*((case-fold-search (not case))
            (pos (point))
            (data (if rev (list #'search-backward end beg)
                    (list #'search-forward beg end) ))
            (search-f (car data))
            (search-beg (cadr data))
            (search-end (caddr data)) )
        (if (apply (list search-f str search-end t))
            (message "hit: %s" (point))
          (goto-char search-beg)
          (if (apply (list search-f str (+ pos (if rev 0 (length str))) t))
              (if (= pos (point))
                  (message "this is the one occurrence")
                (message "hit: %s (wrap)" (point)) )
            (goto-char pos)
            (message "no hit") ))) ))
  (declare-function wrap-search nil) )

(provide 'wrap-search)
;;; wrap-search.el ends here

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 18:50   ` Emanuel Berg
@ 2022-08-25 19:05     ` Philip Kaludercic
  2022-08-25 19:15       ` Emanuel Berg
  2022-08-25 21:46       ` [External] : " Drew Adams
  2022-08-25 20:26     ` Stefan Monnier
  1 sibling, 2 replies; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-25 19:05 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg <incal@dataswamp.org> writes:

>
> Philip Kaludercic wrote:
>
>> Could you elaborate what you meant to say with this message.
>> Should it be added to ELPA?
>
> Sure!

Do you have a git repository?

>> Btw. the commentary section should start after the
>> header section.
>
> Okay, note that `checkdoc' don't say that, nor does the
> byte-compiler ...

From what I believe, it would only matter if the header is parsed, which
is not what checkdoc ensures, let alone the byte-compiler.  The only
thing that I see it breaks is that `lm-commentary' returns the headers,
which would look bad in describe-package.

> But thanks, you mean like this?

Yes.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 19:05     ` Philip Kaludercic
@ 2022-08-25 19:15       ` Emanuel Berg
  2022-08-25 20:48         ` Philip Kaludercic
  2022-08-25 21:46       ` [External] : " Drew Adams
  1 sibling, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-25 19:15 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

>>> Could you elaborate what you meant to say with this
>>> message. Should it be added to ELPA?
>>
>> Sure!
>
> Do you have a git repository?

No.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 18:50   ` Emanuel Berg
  2022-08-25 19:05     ` Philip Kaludercic
@ 2022-08-25 20:26     ` Stefan Monnier
  2022-08-25 22:08       ` Emanuel Berg
  2022-08-25 22:19       ` Emanuel Berg
  1 sibling, 2 replies; 56+ messages in thread
From: Stefan Monnier @ 2022-08-25 20:26 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg [2022-08-25 20:50:26] wrote:
> Philip Kaludercic wrote:
>> Could you elaborate what you meant to say with this message.
>> Should it be added to ELPA?
> Sure!

For GNU ELPA, you'd first need to sign the relevant paperwork
(see further down).
For NonGNU ELPA, you'd need to put this in a public Git repository.
(I think for MELPA, the same would apply).

Some comments about your code:

> ;; `wrap-search' searches forward by default, but it wraps
> ;; and continues up and until the search start position if
> ;; necessary. This is so one doesn't have to wonder if the
> ;; target is north or south in the buffer.

You might want to mention `isearch-wrap-pause` and explain the advantage
of your package over what we get with (setq isearch-wrap-pause 'no).

> (defun wrap-string-data-p (str)
>   "Return STR if it is a string but not the empty string, \"\"."
>   (and (stringp str)
>        (not (string= str ""))
>        str) )

Since you package is small, I'd prefer it doesn't use up the whole
`wrap-` namespace, so I'd recommend you rename this function
`wrap-search-string-data-p`.

Also, in all the places where you use this function, you use the return
value as a boolean, so you could simplify it to

    (defun wrap-search-string-data-p (str)
      "Return non-nil if it is a string but not the empty string, \"\"."
      (and (stringp str)
           (not (string= str ""))) )

But in addition, I notice that it's only ever called with `prev-str` as
argument and that variable can never hold anything else than nil or
a non-empty string (because we test (string= "") before setting it).
So you can just remove the function altogether and just test
`prev-str` instead.  Also that var is global and it's never set back to
nil, so so the nil case should only occur once per Emacs session, and
I'd simplify the code by initializing the var not to nil but to some
dummy default like "unspecified search string" so you don't even need to
handle the nil case.

> (let ((prev-str)
>       (prev-case)
>       (prev-rev)
>       (prev-beg)
>       (prev-end) )
>   (defun wrap-search-again ()
>     (interactive)
>     (if (wrap-string-data-p prev-str)
>         (wrap-search prev-str prev-case prev-rev prev-beg prev-end)
>       (message "no search has been done") ))
>   (declare-function wrap-search-again nil)

Yeah, I'd welcome patches to `bytecomp.el` to handle such code better so
you don't need `declare-function`.

>   (defun show-prev-str ()
>     (if (wrap-string-data-p prev-str)
>         (let*((len   (length prev-str))
>               (max   10)
>               (short (when (< max len)
>                        (substring prev-str 0 max) )))
>           (format "[%s] " (if short
>                               (format "%s..." short)
>                             prev-str) ))
>       ""))

You can use `truncate-string-to-width` here.

>     (interactive
>      `(,(read-string (format "search: %s" (show-prev-str)))

The convention is to put the default before the `:` and wrapped in
"(default ...)" rather than "[...]".  Since Emacs-28 you can use
`format-prompt` to do that.

If (like me) you prefer the "[...]" format, you might like to use
`minibuffer-electric-default-mode` and (setq
minibuffer-eldef-shorten-default t).

>        ,(or (equal current-prefix-arg '( 4))
>             (equal current-prefix-arg '(64)) )

AKA
     ,(member current-prefix-arg '((4) (64)))

>        ,(or (equal current-prefix-arg '(16))
>             (equal current-prefix-arg '(64)) )

AKA
     ,(member current-prefix-arg '((16) (64)))

>       (let*((case-fold-search (not case))
>             (pos (point))
>             (data (if rev (list #'search-backward end beg)
>                     (list #'search-forward beg end) ))
>             (search-f (car data))
>             (search-beg (cadr data))
>             (search-end (caddr data)) )

You can also write this as

    (pcase-let* ((case-fold-search (not case))
                 (pos (point))
                 (`(,search-f ,search-beg ,search-end)
                  (if rev (list #'search-backward end beg)
                    (list #'search-forward beg end))))

>         (if (apply (list search-f str search-end t))

AKA

    (if (funcall search-f str search-end t)

which is not just shorter but also more efficient.

>           (if (apply (list search-f str (+ pos (if rev 0 (length str))) t))

Same here.

As for the paperwork, you'd want to fill the form below and send it as
instructed so the FSF can send you the relevant paperwork to sign.


        Stefan




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 19:15       ` Emanuel Berg
@ 2022-08-25 20:48         ` Philip Kaludercic
  2022-08-26 19:46           ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-25 20:48 UTC (permalink / raw)
  To: emacs-devel


Please CC all participants when responding to a message, it is much
easier to miss a response if you don't do so.

Emanuel Berg <incal@dataswamp.org> writes:

> Philip Kaludercic wrote:
>
>>>> Could you elaborate what you meant to say with this
>>>> message. Should it be added to ELPA?
>>>
>>> Sure!
>>
>> Do you have a git repository?
>
> No.

Could you create one?



^ permalink raw reply	[flat|nested] 56+ messages in thread

* RE: [External] : Re: wrap-search 3.3.5
  2022-08-25 19:05     ` Philip Kaludercic
  2022-08-25 19:15       ` Emanuel Berg
@ 2022-08-25 21:46       ` Drew Adams
  1 sibling, 0 replies; 56+ messages in thread
From: Drew Adams @ 2022-08-25 21:46 UTC (permalink / raw)
  To: Philip Kaludercic, emacs-devel@gnu.org

> From what I believe, it would only matter if the header is parsed, which
> is not what checkdoc ensures, let alone the byte-compiler.  The only
> thing that I see it breaks is that `lm-commentary' returns the headers,
> which would look bad in describe-package.

And `finder-commentary', which is a command, not
just a helper function - it uses `lm-commentary'.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 20:26     ` Stefan Monnier
@ 2022-08-25 22:08       ` Emanuel Berg
  2022-08-25 22:23         ` Emanuel Berg
  2022-08-25 22:47         ` Emanuel Berg
  2022-08-25 22:19       ` Emanuel Berg
  1 sibling, 2 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-25 22:08 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier wrote:

> You might want to mention `isearch-wrap-pause` and explain
> the advantage of your package over what we get with (setq
> isearch-wrap-pause 'no).

It is not incremental so it never shows you "please help" when
you search for "please her" ... there is no flash update of
what you see until you are done. If you search for something
that exists, when you are done searching for it and not
before, that and nothing else is what is displayed. So it is
very civilized and not rushed, you don't get stressed
or distracted.

> If (like me) you prefer the "[...]" format, you might like
> to use `minibuffer-electric-default-mode` and (setq
> minibuffer-eldef-shorten-default t).

It looks good to me even after that, however I have that
configured another way

  (setq minibuffer-default-prompt-format " [%s]")

> As for the paperwork, you'd want to fill the form below and
> send it as instructed so the FSF can send you the relevant
> paperwork to sign.

OK, I think I did everything you said (not the byte compiler
patch LOL), here it is:

;;; wrap-search.el --- wrapped, non-incremental search -*- lexical-binding: t -*-
;;
;; Author: Emanuel Berg <incal@dataswamp.org>
;; Created: 2021-05-23
;; Keywords: matching
;; License: GPL3+
;; URL: https://dataswamp.org/~incal/emacs-init/wrap-search.el
;; Version: 4.3.7
;;
;;; Commentary:
;;
;; The `wrap-search' package offers non-incremental search.
;; It shows hitss - hits and only hits.
;;
;; `wrap-search' searches forward by default, but it wraps
;; and continues up and until the search start position if
;; necessary. This is so one doesn't have to wonder if the
;; target is north or south in the buffer.
;;
;; The philosophy is that `wrap-search' mostly shouldn't be
;; used for searching - that is possible as well, of course,
;; using the same command - rather, it is used to quickly
;; navigate a buffer.
;;
;; To use the package without keyboard shortcuts isn't
;; recommended. Instead, do for example
;;
;;   (global-set-key "\C-s" #'wrap-search)
;;   (global-set-key "\C-r" #'wrap-search-again)
;;
;;; Code:

(let ((prev-str "unspecified search string")
      (prev-case)
      (prev-rev)
      (prev-beg)
      (prev-end) )
  (defun wrap-search-again ()
    (interactive)
    (wrap-search prev-str prev-case prev-rev prev-beg prev-end) )
  (declare-function wrap-search-again nil)

  (defun show-prev-str ()
    (let*((short (truncate-string-to-width prev-str 10))
          (str   (format "%s%s" short
                                  (when (not (string= short prev-str))
                                    "...") )))
      str) )
  (declare-function show-prev-str nil)

  (defun wrap-search (str &optional case rev beg end)
    "Search for STR.

With CASE the search is case-sensitive.
With REV the search direction is reversed, i.e. north in the buffer from point.
BEG and END, or a region, delimits the search area. (default: whole buffer)

Interactively,
\\[universal-argument] sets CASE;
\\[universal-argument] \\[universal-argument] sets REV; and
\\[universal-argument] \\[universal-argument] \\[universal-argument] sets CASE and REV.

Do \\[wrap-search-again] to repeat, with `wrap-search-again'."
    (interactive
     `(,(read-string (format-prompt "search" (show-prev-str)))
       ,(member current-prefix-arg '( (4) (64)))
       ,(member current-prefix-arg '((16) (64)))
       ,@(if (use-region-p)
             (list (region-beginning) (region-end))
           (list (point-min) (point-max)) )))
    (if (string= "" str)
        (wrap-search-again)
      (setq prev-str  str)
      (setq prev-case case)
      (setq prev-rev  rev)
      (setq prev-beg  beg)
      (setq prev-end  end)
      (pcase-let*((case-fold-search (not case))
                  (pos (point))
                  (`(,search-f ,search-beg ,search-end)
                   (if rev
                       (list #'search-backward end beg)
                     (list #'search-forward beg end) )))
        (if (funcall search-f str search-end t)
            (message "hit: %s" (point))
          (goto-char search-beg)
          (if (funcall search-f str (+ pos (if rev 0 (length str))) t)
              (if (= pos (point))
                  (message "this is the one occurrence")
                (message "hit: %s (wrap)" (point)) )
            (goto-char pos)
            (message "no hit") ))) ))
  (declare-function wrap-search nil) )

(provide 'wrap-search)
;;; wrap-search.el ends here

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 20:26     ` Stefan Monnier
  2022-08-25 22:08       ` Emanuel Berg
@ 2022-08-25 22:19       ` Emanuel Berg
  2022-08-26 10:17         ` Emanuel Berg
  1 sibling, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-25 22:19 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier wrote:

>>       (let*((case-fold-search (not case))
>>             (pos (point))
>>             (data (if rev (list #'search-backward end beg)
>>                     (list #'search-forward beg end) ))
>>             (search-f (car data))
>>             (search-beg (cadr data))
>>             (search-end (caddr data)) )
>
> You can also write this as
>
>     (pcase-let* ((case-fold-search (not case))
>                  (pos (point))
>                  (`(,search-f ,search-beg ,search-end)
>                   (if rev (list #'search-backward end beg)
>                     (list #'search-forward beg end))))

`pcase-let'?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 22:08       ` Emanuel Berg
@ 2022-08-25 22:23         ` Emanuel Berg
  2022-08-26  1:10           ` Stefan Monnier
  2022-08-25 22:47         ` Emanuel Berg
  1 sibling, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-25 22:23 UTC (permalink / raw)
  To: emacs-devel

>   (defun show-prev-str ()
>     (let*((short (truncate-string-to-width prev-str 10))
>           (str   (format "%s%s" short
>                                   (when (not (string= short prev-str))
>                                     "...") )))
>       str) )

Is now in version 4.5.7

(defun show-prev-str ()
    (let*((short (truncate-string-to-width prev-str 10))
          (str   (format "%s%s" short
                                (if (not (string= short prev-str))
                                    "..."
                                  "") )))
      str) )

https://dataswamp.org/~incal/emacs-init/wrap-search.el

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 22:08       ` Emanuel Berg
  2022-08-25 22:23         ` Emanuel Berg
@ 2022-08-25 22:47         ` Emanuel Berg
  1 sibling, 0 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-25 22:47 UTC (permalink / raw)
  To: emacs-devel

>     (interactive
>      `(,(read-string (format-prompt "search" (show-prev-str)))
>        ,(member current-prefix-arg '( (4) (64)))
>        ,(member current-prefix-arg '((16) (64)))
>        ,@(if (use-region-p)
>              (list (region-beginning) (region-end))
>            (list (point-min) (point-max)) )))

    (interactive
     `(,(read-string (format-prompt "search" (show-prev-str)))
       ,(member current-prefix-arg '( (4) (64)))
       ,(member current-prefix-arg '((16) (64)))
       ,@(when (use-region-p)
           (list (region-beginning) (region-end)) )))
    (or beg (setq beg (point-min)))
    (or end (setq end (point-max)))

;; URL: https://dataswamp.org/~incal/emacs-init/wrap-search.el
;; Version: 4.6.7

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 22:23         ` Emanuel Berg
@ 2022-08-26  1:10           ` Stefan Monnier
  2022-08-26  2:17             ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Stefan Monnier @ 2022-08-26  1:10 UTC (permalink / raw)
  To: emacs-devel

> (defun show-prev-str ()
>     (let*((short (truncate-string-to-width prev-str 10))
>           (str   (format "%s%s" short
>                                 (if (not (string= short prev-str))
>                                     "..."
>                                   "") )))

Try (truncate-string-to-width prev-str 10 nil nil t)


        Stefan




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-26  1:10           ` Stefan Monnier
@ 2022-08-26  2:17             ` Emanuel Berg
  0 siblings, 0 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-26  2:17 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier wrote:

>> (defun show-prev-str ()
>>     (let*((short (truncate-string-to-width prev-str 10))
>>           (str   (format "%s%s" short
>>                                 (if (not (string= short prev-str))
>>                                     "..."
>>                                   "") )))
>
> Try (truncate-string-to-width prev-str 10 nil nil t)

OK, thanks, done, one still needs a function, as refering to
the closure variable from interactive doesn't work, if that
strikes anyone as strange ...

;;; wrap-search.el --- wrapped, non-incremental search -*- lexical-binding: t -*-
;;
;; Author: Emanuel Berg <incal@dataswamp.org>
;; Created: 2021-05-23
;; Keywords: matching
;; License: GPL3+
;; URL: https://dataswamp.org/~incal/emacs-init/wrap-search.el
;; Version: 4.7.8
;;
;;; Commentary:
;;
;; The `wrap-search' package offers non-incremental search.
;; It shows hitss (hits and only hits) and search only starts
;; when one hits RET.
;;
;; `wrap-search' searches forward by default, but it wraps
;; and continues up and until the search start position if
;; necessary. This is so one doesn't have to wonder if the
;; target is north or south in the buffer.
;;
;; The philosophy is that `wrap-search' mostly shouldn't be
;; used for searching - that is possible as well, of course,
;; using the same command - rather, it is used to quickly
;; navigate a buffer.
;;
;; To use the package without keyboard shortcuts isn't
;; recommended. Instead, do for example
;;
;;   (global-set-key "\C-s" #'wrap-search)
;;   (global-set-key "\C-r" #'wrap-search-again)
;;
;;; Code:

(let ((prev-str "unspecified search string")
      (prev-case)
      (prev-rev)
      (prev-beg)
      (prev-end) )
  (defun wrap-search-again ()
    (interactive)
    (wrap-search prev-str prev-case prev-rev prev-beg prev-end) )
  (declare-function wrap-search-again nil)

  (defun wrap-search-show-default ()
    (truncate-string-to-width prev-str 10 nil nil t) )
  (declare-function wrap-search-show-default nil)

  (defun wrap-search (str &optional case rev beg end)
    "Search for STR.

With CASE the search is case-sensitive.
With REV the search direction is reversed, i.e. north in the buffer from point.
BEG and END, or a region, delimits the search area. (default: whole buffer)

Interactively,
\\[universal-argument] sets CASE;
\\[universal-argument] \\[universal-argument] sets REV; and
\\[universal-argument] \\[universal-argument] \\[universal-argument] sets CASE and REV.

Do \\[wrap-search-again] to repeat, with `wrap-search-again'."
    (interactive
     `(,(read-string (format-prompt "search" (wrap-search-show-default)))
       ,(member current-prefix-arg '( (4) (64)))
       ,(member current-prefix-arg '((16) (64)))
       ,@(when (use-region-p)
           (list (region-beginning) (region-end)) )))
    (or beg (setq beg (point-min)))
    (or end (setq end (point-max)))
    (if (string= "" str)
        (wrap-search-again)
      (setq prev-str  str)
      (setq prev-case case)
      (setq prev-rev  rev)
      (setq prev-beg  beg)
      (setq prev-end  end)
      (pcase-let ((case-fold-search (not case))
                  (pos (point))
                  (`(,search-f ,search-beg ,search-end)
                   (if rev
                       (list #'search-backward end beg)
                     (list #'search-forward beg end) )))
        (if (funcall search-f str search-end t)
            (message "hit: %s" (point))
          (goto-char search-beg)
          (if (funcall search-f str (+ pos (if rev 0 (length str))) t)
              (if (= pos (point))
                  (message "this is the one occurrence")
                (message "hit: %s (wrap)" (point)) )
            (goto-char pos)
            (message "no hit") ))) ))
  (declare-function wrap-search nil) )

(provide 'wrap-search)
;;; wrap-search.el ends here

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 22:19       ` Emanuel Berg
@ 2022-08-26 10:17         ` Emanuel Berg
  0 siblings, 0 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-26 10:17 UTC (permalink / raw)
  To: emacs-devel

OK, just tell me if anything is supposed to happen ...

;;; wrap-search.el --- wrapped, non-incremental search -*- lexical-binding: t -*-
;;
;; Author: Emanuel Berg <incal@dataswamp.org>
;; Created: 2021-05-23
;; Keywords: matching
;; License: GPL3+
;; URL: https://dataswamp.org/~incal/emacs-init/wrap-search.el
;; Version: 4.7.8
;;
;;; Commentary:
;;
;; The `wrap-search' package offers non-incremental search.
;; It shows hitss (hits and only hits) and search only starts
;; when one hits RET.
;;
;; `wrap-search' searches forward by default, but it wraps
;; and continues up and until the search start position if
;; necessary. This is so one doesn't have to wonder if the
;; target is north or south in the buffer.
;;
;; The philosophy is that `wrap-search' mostly shouldn't be
;; used for searching - that is possible as well, of course,
;; using the same command - rather, it is used to quickly
;; navigate a buffer.
;;
;; To use the package without keyboard shortcuts isn't
;; recommended. Instead, do for example
;;
;;   (global-set-key "\C-s" #'wrap-search)
;;   (global-set-key "\C-r" #'wrap-search-again)
;;
;;; Code:

(let ((prev-str "unspecified search string")
      (prev-case)
      (prev-rev)
      (prev-beg)
      (prev-end) )
  (defun wrap-search-again ()
    (interactive)
    (wrap-search prev-str prev-case prev-rev prev-beg prev-end) )
  (declare-function wrap-search-again nil)

  (defun wrap-search-show-default ()
    (truncate-string-to-width prev-str 10 nil nil t) )
  (declare-function wrap-search-show-default nil)

  (defun wrap-search (str &optional case rev beg end)
    "Search for STR.

With CASE the search is case-sensitive.
With REV the search direction is reversed, i.e. north in the buffer from point.
BEG and END, or a region, delimits the search area. (default: whole buffer)

Interactively,
\\[universal-argument] sets CASE;
\\[universal-argument] \\[universal-argument] sets REV; and
\\[universal-argument] \\[universal-argument] \\[universal-argument] sets CASE and REV.

Do \\[wrap-search-again] to repeat, with `wrap-search-again'."
    (interactive
     `(,(read-string (format-prompt "search" (wrap-search-show-default)))
       ,(member current-prefix-arg '( (4) (64)))
       ,(member current-prefix-arg '((16) (64)))
       ,@(when (use-region-p)
           (list (region-beginning) (region-end)) )))
    (or beg (setq beg (point-min)))
    (or end (setq end (point-max)))
    (if (string= "" str)
        (wrap-search-again)
      (setq prev-str  str)
      (setq prev-case case)
      (setq prev-rev  rev)
      (setq prev-beg  beg)
      (setq prev-end  end)
      (pcase-let ((case-fold-search (not case))
                  (pos (point))
                  (`(,search-f ,search-beg ,search-end)
                   (if rev
                       (list #'search-backward end beg)
                     (list #'search-forward beg end) )))
        (if (funcall search-f str search-end t)
            (message "hit: %s" (point))
          (goto-char search-beg)
          (if (funcall search-f str (+ pos (if rev 0 (length str))) t)
              (if (= pos (point))
                  (message "this is the one occurrence")
                (message "hit: %s (wrap)" (point)) )
            (goto-char pos)
            (message "no hit") ))) ))
  (declare-function wrap-search nil) )

(provide 'wrap-search)
;;; wrap-search.el ends here

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-25 20:48         ` Philip Kaludercic
@ 2022-08-26 19:46           ` Emanuel Berg
  2022-08-26 23:46             ` Philip Kaludercic
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-26 19:46 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

> Please CC all participants when responding to a message, it
> is much easier to miss a response if you don't do so.

I don't know why that doesn't happen?

>>>>> Could you elaborate what you meant to say with this
>>>>> message. Should it be added to ELPA?
>>>>
>>>> Sure!
>>>
>>> Do you have a git repository?
>>
>> No.
>
> Could you create one?

Is that required/the conventional method? If so, absolutely.
No insurance and no guarantee - but that's more than wait
and see.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-26 19:46           ` Emanuel Berg
@ 2022-08-26 23:46             ` Philip Kaludercic
  2022-08-27  0:06               ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-26 23:46 UTC (permalink / raw)
  To: emacs-devel; +Cc: Emanuel Berg

Emanuel Berg <incal@dataswamp.org> writes:

>
> Philip Kaludercic wrote:
>
>> Please CC all participants when responding to a message, it
>> is much easier to miss a response if you don't do so.
>
> I don't know why that doesn't happen?

I am guessing it has to do with the

    Mail-Followup-To: emacs-devel@gnu.org
    Mail-Copies-To: never

headers your MUA is inserting.

>>>>>> Could you elaborate what you meant to say with this
>>>>>> message. Should it be added to ELPA?
>>>>>
>>>>> Sure!
>>>>
>>>> Do you have a git repository?
>>>
>>> No.
>>
>> Could you create one?
>
> Is that required/the conventional method? If so, absolutely.
> No insurance and no guarantee - but that's more than wait
> and see.

Yes it is.  If nothing else it will make it easier to automatically keep
the package up to date.  Any Git repo should do the job, so you should
be able to create a bare repository on your website and host it via HTTP
if you prefer that.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-26 23:46             ` Philip Kaludercic
@ 2022-08-27  0:06               ` Emanuel Berg
  2022-08-27  8:24                 ` Philip Kaludercic
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-27  0:06 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

> I am guessing it has to do with the
>
>     Mail-Followup-To: emacs-devel@gnu.org
>     Mail-Copies-To: never
>
> headers your MUA is inserting.

Did I configure that?

>>>>>>> Could you elaborate what you meant to say with this
>>>>>>> message. Should it be added to ELPA?
>>>>>>
>>>>>> Sure!
>>>>>
>>>>> Do you have a git repository?
>>>>
>>>> No.
>>>
>>> Could you create one?
>>
>> Is that required/the conventional method? If so,
>> absolutely. No insurance and no guarantee - but that's more
>> than wait and see.
>
> Yes it is. If nothing else it will make it easier to
> automatically keep the package up to date. Any Git repo
> should do the job, so you should be able to create a bare
> repository on your website and host it via HTTP if you
> prefer that.

No, if you are adding the stuff please provide exact
instructions what should happen from my part, or if this
process is described somewhere already, likely?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-27  0:06               ` Emanuel Berg
@ 2022-08-27  8:24                 ` Philip Kaludercic
  2022-08-28  0:13                   ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-27  8:24 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg <incal@dataswamp.org> writes:

>
> Philip Kaludercic wrote:
>
>> I am guessing it has to do with the
>>
>>     Mail-Followup-To: emacs-devel@gnu.org
>>     Mail-Copies-To: never
>>
>> headers your MUA is inserting.
>
> Did I configure that?

I do not know that?

>>>>>>>> Could you elaborate what you meant to say with this
>>>>>>>> message. Should it be added to ELPA?
>>>>>>>
>>>>>>> Sure!
>>>>>>
>>>>>> Do you have a git repository?
>>>>>
>>>>> No.
>>>>
>>>> Could you create one?
>>>
>>> Is that required/the conventional method? If so,
>>> absolutely. No insurance and no guarantee - but that's more
>>> than wait and see.
>>
>> Yes it is. If nothing else it will make it easier to
>> automatically keep the package up to date. Any Git repo
>> should do the job, so you should be able to create a bare
>> repository on your website and host it via HTTP if you
>> prefer that.
>
> No, if you are adding the stuff please provide exact
> instructions what should happen from my part, or if this
> process is described somewhere already, likely?

I am afraid I don't know what you mean.  All {GNU,NonGNU} ELPA will need
is a link to a Git repository, where you track change to your file?
Nothing special.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-27  8:24                 ` Philip Kaludercic
@ 2022-08-28  0:13                   ` Emanuel Berg
  2022-08-28  8:07                     ` Philip Kaludercic
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-28  0:13 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

>>> I am guessing it has to do with the
>>>
>>>   Mail-Followup-To: emacs-devel@gnu.org
>>>   pMail-Copies-To: never
>>>
>>> headers your MUA is inserting.
>>
>> Did I configure that?
>
> I do not know that?

OK, but thanks for the info, I'll look into it after this Git
thing is solved Gw ...

>>>>>>>>> Could you elaborate what you meant to say with this
>>>>>>>>> message. Should it be added to ELPA?
>>>>>>>>
>>>>>>>> Sure!
>>>>>>>
>>>>>>> Do you have a git repository?
>>>>>>
>>>>>> No.
>>>>>
>>>>> Could you create one?
>>>>
>>>> Is that required/the conventional method? If so,
>>>> absolutely. No insurance and no guarantee - but that's
>>>> more than wait and see.
>>>
>>> Yes it is. If nothing else it will make it easier to
>>> automatically keep the package up to date. Any Git repo
>>> should do the job, so you should be able to create a bare
>>> repository on your website and host it via HTTP if you
>>> prefer that.
>>
>> No, if you are adding the stuff please provide exact
>> instructions what should happen from my part, or if this
>> process is described somewhere already, likely?
>
> I am afraid I don't know what you mean. All {GNU,NonGNU}
> ELPA will need is a link to a Git repository, where you
> track change to your file? Nothing special.

OK, is there a recommended service? Is there one I can access
with CLI tools? Or you can do that with all of them, right?
As in Git as in git(1)?

Maybe you can even setup the account from the shell or
a non-JS browser, e.g. Emacs-w3m?

Is there a place preferred by ELPA people?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28  0:13                   ` Emanuel Berg
@ 2022-08-28  8:07                     ` Philip Kaludercic
  2022-08-28  8:30                       ` Andreas Schwab
  2022-08-28  8:43                       ` Emanuel Berg
  0 siblings, 2 replies; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-28  8:07 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg <incal@dataswamp.org> writes:

>>>>>>>>>> Could you elaborate what you meant to say with this
>>>>>>>>>> message. Should it be added to ELPA?
>>>>>>>>>
>>>>>>>>> Sure!
>>>>>>>>
>>>>>>>> Do you have a git repository?
>>>>>>>
>>>>>>> No.
>>>>>>
>>>>>> Could you create one?
>>>>>
>>>>> Is that required/the conventional method? If so,
>>>>> absolutely. No insurance and no guarantee - but that's
>>>>> more than wait and see.
>>>>
>>>> Yes it is. If nothing else it will make it easier to
>>>> automatically keep the package up to date. Any Git repo
>>>> should do the job, so you should be able to create a bare
>>>> repository on your website and host it via HTTP if you
>>>> prefer that.
>>>
>>> No, if you are adding the stuff please provide exact
>>> instructions what should happen from my part, or if this
>>> process is described somewhere already, likely?
>>
>> I am afraid I don't know what you mean. All {GNU,NonGNU}
>> ELPA will need is a link to a Git repository, where you
>> track change to your file? Nothing special.
>
> OK, is there a recommended service? Is there one I can access
> with CLI tools? Or you can do that with all of them, right?
> As in Git as in git(1)?

git push/pull and that kind of stuff should be doable with any service,
if you want to create repositories you'll need to use a web interface or
some special client.

> Maybe you can even setup the account from the shell or
> a non-JS browser, e.g. Emacs-w3m?

As far as I understand you have a webserver that serves files from a
directory on some server?  If so, you can create a bare repository in
your server directory

     $ git init wrap-search.git

on your local machine you can then create a git repository, add your
file, initialise a remote repository and push your current state:

     $ git init
     $ git add wrap-search.el
     $ git commit -m "Initial commit"
     $ git remote add origin your-user@your-server:path/to/wrap-search.git
     $ git push remote

you can then check if everything works by cloning this repository

    $ git clone https://your-website.net/some/other/path/wrap-search.git

> Is there a place preferred by ELPA people?

The ELPA people do not have any singular preferred service, to my
knowledge.  This might be of use:
https://www.gnu.org/software/repo-criteria-evaluation.en.html.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28  8:07                     ` Philip Kaludercic
@ 2022-08-28  8:30                       ` Andreas Schwab
  2022-08-28  8:43                       ` Emanuel Berg
  1 sibling, 0 replies; 56+ messages in thread
From: Andreas Schwab @ 2022-08-28  8:30 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: emacs-devel

On Aug 28 2022, Philip Kaludercic wrote:

> As far as I understand you have a webserver that serves files from a
> directory on some server?  If so, you can create a bare repository in
> your server directory
>
>      $ git init wrap-search.git

That creates a non-bare repository.  You need to use --bare to create a
bare repository.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28  8:07                     ` Philip Kaludercic
  2022-08-28  8:30                       ` Andreas Schwab
@ 2022-08-28  8:43                       ` Emanuel Berg
  2022-08-28  9:00                         ` Philip Kaludercic
  1 sibling, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-28  8:43 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

> As far as I understand you have a webserver that serves
> files from a directory on some server? If so, you can create
> a bare repository in your server directory
>
>   $ git init wrap-search.git
>
> on your local machine you can then create a git repository,
> add your file, initialise a remote repository and push your
> current state:
>
>   $ git init
>   $ git add wrap-search.el
>   $ git commit -m "Initial commit"
>   $ git remote add origin your-user@your-server:path/to/wrap-search.git
>   $ git push remote

Worked until 'git push remote', then it says

  fatal: 'remote' does not appear to be a git repository
  fatal: Could not read from remote repository.

  Please make sure you have the correct access rights and the
  repository exists.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28  8:43                       ` Emanuel Berg
@ 2022-08-28  9:00                         ` Philip Kaludercic
  2022-08-28 21:02                           ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-28  9:00 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg <incal@dataswamp.org> writes:

>
> Philip Kaludercic wrote:
>
>> As far as I understand you have a webserver that serves
>> files from a directory on some server? If so, you can create
>> a bare repository in your server directory
>>
>>   $ git init wrap-search.git
>>
>> on your local machine you can then create a git repository,
>> add your file, initialise a remote repository and push your
>> current state:
>>
>>   $ git init
>>   $ git add wrap-search.el
>>   $ git commit -m "Initial commit"
>>   $ git remote add origin your-user@your-server:path/to/wrap-search.git
>>   $ git push remote
>
> Worked until 'git push remote', then it says
>
>   fatal: 'remote' does not appear to be a git repository
>   fatal: Could not read from remote repository.
>
>   Please make sure you have the correct access rights and the
>   repository exists.

I forgot to add --bare to the first command, as Andreas pointed out.
You can delete the directory and re-run the command

    $ git init --bare wrap-search.git



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28  9:00                         ` Philip Kaludercic
@ 2022-08-28 21:02                           ` Emanuel Berg
  2022-08-28 21:24                             ` Gregory Heytings
  2022-08-29  6:28                             ` Yuri Khan
  0 siblings, 2 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-28 21:02 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

> I forgot to add --bare to the first command, as Andreas
> pointed out. You can delete the directory and re-run the
> command
>
>     $ git init --bare wrap-search.git

OK, thanks (both) but still no luck:

#! /bin/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/git
#
# at the server:
#   $ cd public_html
#   $ git init --bare wrap-search.git

git-init () {
    local server=dataswamp.org
    local repo=/var/www/htdocs/dataswamp.org/~incal/wrap-search.git

    cd
    rm -f -r .git
    git init
    git add ~/public_html/emacs-init/wrap-search.el
    git commit -m "Initial commit"
    git remote add origin ${USER}@${server}:${repo}
    git push remote # DNC
    cd -
}

# Initialized empty Git repository in /home/incal/.git/
# [master (root-commit) 012c325] Initial commit
#  1 file changed, 106 insertions(+)
#  create mode 100644 public_html/emacs-init/wrap-search.el
# fatal: 'remote' does not appear to be a git repository
# fatal: Could not read from remote repository.
#
# Please make sure you have the correct access rights
# and the repository exists.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28 21:02                           ` Emanuel Berg
@ 2022-08-28 21:24                             ` Gregory Heytings
  2022-08-28 21:31                               ` Emanuel Berg
  2022-08-29  6:28                             ` Yuri Khan
  1 sibling, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-08-28 21:24 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>
> # at the server:
> #   $ cd public_html
> #   $ git init --bare wrap-search.git
>
> git-init () {
>    local server=dataswamp.org
>    local repo=/var/www/htdocs/dataswamp.org/~incal/wrap-search.git
>

I think there's something wrong with "repo" here.  On the server, enter 
the directory "wrap-search.git", type pwd, and copy-paste the output after 
"local repo=".



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28 21:24                             ` Gregory Heytings
@ 2022-08-28 21:31                               ` Emanuel Berg
  2022-08-28 21:33                                 ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-28 21:31 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

>> # at the server:
>> #   $ cd public_html
>> #   $ git init --bare wrap-search.git
>>
>> git-init () {
>>    local server=dataswamp.org
>>    local repo=/var/www/htdocs/dataswamp.org/~incal/wrap-search.git
>
> I think there's something wrong with "repo" here. On the
> server, enter the directory "wrap-search.git", type pwd

$ pwd
/home/incal/public_html/wrap-search.git

$ /bin/pwd
/var/www/htdocs/dataswamp.org/~incal/wrap-search.git

Let's try both then ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28 21:31                               ` Emanuel Berg
@ 2022-08-28 21:33                                 ` Emanuel Berg
  0 siblings, 0 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-28 21:33 UTC (permalink / raw)
  To: emacs-devel

>>> # at the server:
>>> #   $ cd public_html
>>> #   $ git init --bare wrap-search.git
>>>
>>> git-init () {
>>>    local server=dataswamp.org
>>>    local repo=/var/www/htdocs/dataswamp.org/~incal/wrap-search.git
>>
>> I think there's something wrong with "repo" here. On the
>> server, enter the directory "wrap-search.git", type pwd
>
> $ pwd
> /home/incal/public_html/wrap-search.git
>
> $ /bin/pwd
> /var/www/htdocs/dataswamp.org/~incal/wrap-search.git
>
> Let's try both then ...

Same. Maybe because that's what they are ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-28 21:02                           ` Emanuel Berg
  2022-08-28 21:24                             ` Gregory Heytings
@ 2022-08-29  6:28                             ` Yuri Khan
  2022-08-31  2:06                               ` Emanuel Berg
  1 sibling, 1 reply; 56+ messages in thread
From: Yuri Khan @ 2022-08-29  6:28 UTC (permalink / raw)
  To: emacs-devel

On Mon, 29 Aug 2022 at 04:03, Emanuel Berg <incal@dataswamp.org> wrote:

>     git remote add origin ${USER}@${server}:${repo}
>     git push remote # DNC

> # fatal: 'remote' does not appear to be a git repository

Your remote is named ‘origin’ but you’re trying to push to ‘remote’.
There is no remote named ‘remote’ so the push fails.

Try ‘git push origin’ instead.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-29  6:28                             ` Yuri Khan
@ 2022-08-31  2:06                               ` Emanuel Berg
  2022-08-31  9:04                                 ` Philip Kaludercic
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-31  2:06 UTC (permalink / raw)
  To: emacs-devel

Yuri Khan wrote:

>> git remote add origin ${USER}@${server}:${repo}
>> git push remote # DNC
>>
>> fatal: 'remote' does not appear to be a git repository
>
> Your remote is named ‘origin’ but you’re trying to push to
> ‘remote’. There is no remote named ‘remote’ so the
> push fails.
>
> Try ‘git push origin’ instead.

That almost worked, but this [last] I think worked, the push
option, actually the complete command, was suggested by git.

Let's try the clone thing ...

  $ git clone https://dataswamp.org/~incal/wrap-search.git
  Cloning into 'wrap-search'...
  fatal: repository 'https://dataswamp.org/~incal/wrap-search.git/' not found

:(

#! /bin/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/git
#
# at the server:
#   $ cd public_html
#   $ git init --bare wrap-search.git

git-init () {
    local name=wrap-search
    local server=dataswamp.org
    local repo=/home/incal/public_html/${name}.git

    cd
    rm -f -r .git
    git init
    git add ~/public_html/emacs-init/${name}.el
    git commit -m "Initial commit"
    git remote add origin ${USER}@${server}:${repo}
    git push --set-upstream origin master
    cd -
}

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31  2:06                               ` Emanuel Berg
@ 2022-08-31  9:04                                 ` Philip Kaludercic
  2022-08-31  9:29                                   ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-31  9:04 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg <incal@dataswamp.org> writes:

> Yuri Khan wrote:
>
>>> git remote add origin ${USER}@${server}:${repo}
>>> git push remote # DNC
>>>
>>> fatal: 'remote' does not appear to be a git repository
>>
>> Your remote is named ‘origin’ but you’re trying to push to
>> ‘remote’. There is no remote named ‘remote’ so the
>> push fails.
>>
>> Try ‘git push origin’ instead.
>
> That almost worked, but this [last] I think worked, the push
> option, actually the complete command, was suggested by git.
>
> Let's try the clone thing ...
>
>   $ git clone https://dataswamp.org/~incal/wrap-search.git
>   Cloning into 'wrap-search'...
>   fatal: repository 'https://dataswamp.org/~incal/wrap-search.git/' not found
>
> :(

I forgot about this, but apparently you need to activate a git hook to
make HTTP cloning work.  From [0], you have to run these commands in
your repository:

        $ git --bare update-server-info
        $ mv hooks/post-update.sample hooks/post-update

[0] https://mirrors.edge.kernel.org/pub/software/scm/git/docs/user-manual.html#setting-up-a-public-repository



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31  9:04                                 ` Philip Kaludercic
@ 2022-08-31  9:29                                   ` Emanuel Berg
  2022-08-31 10:42                                     ` Gregory Heytings
  2022-08-31 14:54                                     ` Philip Kaludercic
  0 siblings, 2 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-31  9:29 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

>> Let's try the clone thing ...
>>
>>   $ git clone https://dataswamp.org/~incal/wrap-search.git
>>   Cloning into 'wrap-search'...
>>   fatal: repository 'https://dataswamp.org/~incal/wrap-search.git/' not found
>>
>> :(
>
> I forgot about this, but apparently you need to activate
> a git hook to make HTTP cloning work [...] you have to run
> these commands in your repository:
>
>   $ git --bare update-server-info
>   $ mv hooks/post-update.sample hooks/post-update

Indeed, it works now! Unbelievable it has to be that
complicated ...

But, when I clone I get the whole path

  wrap-search/public_html/emacs-init/wrap-search.el

Maybe that can be simplified?

#! /bin/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/git
#
# at the server:
#   $ cd public_html
#   $ git init --bare wrap-search.git
#   $ cd wrap-search.git
#   $ git --bare update-server-info
#   $ mv hooks/post-update.sample hooks/post-update

git-init () {
    local name=wrap-search
    local server=dataswamp.org
    local repo=/home/incal/public_html/${name}.git

    cd
    rm -f -r .git
    git init
    git add ~/public_html/emacs-init/${name}.el
    git commit -m "Initial commit"
    git remote add origin ${USER}@${server}:${repo}
    git push --set-upstream origin master
    cd
}

git-clone () {
    git clone https://dataswamp.org/~incal/wrap-search.git
}

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31  9:29                                   ` Emanuel Berg
@ 2022-08-31 10:42                                     ` Gregory Heytings
  2022-08-31 11:04                                       ` Emanuel Berg
  2022-08-31 14:54                                     ` Philip Kaludercic
  1 sibling, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-08-31 10:42 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>
> But, when I clone I get the whole path
>
> wrap-search/public_html/emacs-init/wrap-search.el
>

That's because of the way you created your git repository, at the root of 
your home directory:

>
> cd
> rm -f -r .git
> git init
>

What you could do instead is something like:

git init ~/git/wrap-search
cd ~/git/wrap-search
cp ~/public_html/emacs-init/wrap-search.el .
git add wrap-search.el
...



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 10:42                                     ` Gregory Heytings
@ 2022-08-31 11:04                                       ` Emanuel Berg
  2022-08-31 12:24                                         ` Gregory Heytings
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-31 11:04 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

>> But, when I clone I get the whole path
>>
>>   wrap-search/public_html/emacs-init/wrap-search.el
>
> That's because of the way you created your git repository,
> at the root of your home directory:
>
>> cd
>> rm -f -r .git
>> git init
>
> What you could do instead is something like:
>
> git init ~/git/wrap-search
> cd ~/git/wrap-search
> cp ~/public_html/emacs-init/wrap-search.el .
> git add wrap-search.el

Unbelievable it should be this involved for this
one-file task!

But OK, at the server

get-setup () {
    local repo=wrap-search.git

    cd ~/public_html
    rm -f -r ${repo}/*
    rmdir ${repo}

    git init --bare ${repo}

    cd ${repo}
    git --bare update-server-info
    mv hooks/post-update.sample hooks/post-update

    cd
}

Then at the desktop

git-init () {
    local name=wrap-search
    local server=dataswamp.org
    local repo=public_html/${name}.git
    local dir=~/git/${name}
    local elisp_file=${name}.el

    cd
    rm -f -r git
    git init ${dir}
    cd ${dir}
    cp ~/public_html/emacs-init/${elisp_file} .
    git add ${elisp_file}
    git commit -m "Initial commit"
    git remote add origin ${USER}@${server}:${repo}
    git push --set-upstream origin master
    cd
}

Then clone wherever ...

git-clone () {
    cd src
    git clone https://dataswamp.org/~incal/wrap-search.git
}

So what's next, if and when I make an edit to the file?
Just push? Or what's the command?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 11:04                                       ` Emanuel Berg
@ 2022-08-31 12:24                                         ` Gregory Heytings
  2022-08-31 15:08                                           ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-08-31 12:24 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>
> Unbelievable it should be this involved for this one-file task!
>

Indeed, for your usecase it's rather involved.  Git is meant to be used 
for lots of files shared and modified by lots of people.

>
> So what's next, if and when I make an edit to the file? Just push? Or 
> what's the command?
>

If you edit the file, you can just do

git commit -am "some commit message"

followed by

git push

and your modifications will be saved in the repository on your server.

Note that with your current recipe there are two copies of the file on 
your desktop computer, one in ~/git/wrap-search/wrap-search.el and another 
one in ~/public_html/emacs-init/wrap-search.el.  You could consider making 
the latter a symbolic link to the former.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31  9:29                                   ` Emanuel Berg
  2022-08-31 10:42                                     ` Gregory Heytings
@ 2022-08-31 14:54                                     ` Philip Kaludercic
  2022-08-31 15:09                                       ` Emanuel Berg
  1 sibling, 1 reply; 56+ messages in thread
From: Philip Kaludercic @ 2022-08-31 14:54 UTC (permalink / raw)
  To: emacs-devel

Emanuel Berg <incal@dataswamp.org> writes:

> Philip Kaludercic wrote:
>
>>> Let's try the clone thing ...
>>>
>>>   $ git clone https://dataswamp.org/~incal/wrap-search.git
>>>   Cloning into 'wrap-search'...
>>>   fatal: repository 'https://dataswamp.org/~incal/wrap-search.git/' not found
>>>
>>> :(
>>
>> I forgot about this, but apparently you need to activate
>> a git hook to make HTTP cloning work [...] you have to run
>> these commands in your repository:
>>
>>   $ git --bare update-server-info
>>   $ mv hooks/post-update.sample hooks/post-update
>
> Indeed, it works now! Unbelievable it has to be that
> complicated ...

OK, so should we proceed with adding the package to ELPA?  Have you
already signed the FSF copyright assignment?



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 12:24                                         ` Gregory Heytings
@ 2022-08-31 15:08                                           ` Emanuel Berg
  2022-08-31 15:18                                             ` Gregory Heytings
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-31 15:08 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

> Indeed, for your usecase it's rather involved. Git is meant
> to be used for lots of files shared and modified by lots
> of people.

Oh, no. Lisp is meant to be used by ... I don't know what Lisp
is meant to be used by, actually. But (+ 1 2) is still simple,
thanks heaven.

> git commit -am "some commit message"
> git push

OK, cool.

> Note that with your current recipe there are two copies of
> the file on your desktop computer, one in
> ~/git/wrap-search/wrap-search.el and another one in
> ~/public_html/emacs-init/wrap-search.el. You could consider
> making the latter a symbolic link to the former.

Uhm, didn't YOU write that part? :)

But OK, I'll do it ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 14:54                                     ` Philip Kaludercic
@ 2022-08-31 15:09                                       ` Emanuel Berg
  0 siblings, 0 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-31 15:09 UTC (permalink / raw)
  To: emacs-devel

Philip Kaludercic wrote:

> OK, so should we proceed with adding the package to ELPA?
> Have you already signed the FSF copyright assignment?

No?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 15:08                                           ` Emanuel Berg
@ 2022-08-31 15:18                                             ` Gregory Heytings
  2022-08-31 21:31                                               ` Emanuel Berg
  2022-08-31 21:55                                               ` Emanuel Berg
  0 siblings, 2 replies; 56+ messages in thread
From: Gregory Heytings @ 2022-08-31 15:18 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]


>> Note that with your current recipe there are two copies of the file on 
>> your desktop computer, one in ~/git/wrap-search/wrap-search.el and 
>> another one in ~/public_html/emacs-init/wrap-search.el. You could 
>> consider making the latter a symbolic link to the former.
>
> Uhm, didn't YOU write that part? :)
>

I did 😃

>
> But OK, I'll do it ...
>

You shouldn't follow an advice blindly.  I don't know how you organize 
your files.  How do you load wrap-search in your Emacs sessions?  Is 
~/public_html/emacs-init in your load-path, or do you already have two 
copies of wrap-search.el, one that is private and another one that is 
public?  If the latter, what do you do to synchronize them?

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 15:18                                             ` Gregory Heytings
@ 2022-08-31 21:31                                               ` Emanuel Berg
  2022-08-31 21:45                                                 ` [External] : " Drew Adams
  2022-09-01  4:27                                                 ` tomas
  2022-08-31 21:55                                               ` Emanuel Berg
  1 sibling, 2 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-08-31 21:31 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

>> But OK, I'll do it ...
>
> You shouldn't follow an advice blindly.

It seems here one cannot agree but also one cannot
disagree ...

> I don't know how you organize your files. How do you load
> wrap-search in your Emacs sessions?
> Is ~/public_html/emacs-init in your load-path, or do you
> already have two copies of wrap-search.el, one that is
> private and another one that is public? If the latter, what
> do you do to synchronize them?

The init files are byte-compiled from a Makefile, loaded in
~/.emacs and rsync'd to the server.

  https://dataswamp.org/~incal/emacs-init/
  https://dataswamp.org/~incal/emacs-init/Makefile
  https://dataswamp.org/~incal/conf/.emacs
  https://dataswamp.org/~incal/conf/.zsh/remote

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* RE: [External] : Re: wrap-search 3.3.5
  2022-08-31 21:31                                               ` Emanuel Berg
@ 2022-08-31 21:45                                                 ` Drew Adams
  2022-09-01  4:27                                                 ` tomas
  1 sibling, 0 replies; 56+ messages in thread
From: Drew Adams @ 2022-08-31 21:45 UTC (permalink / raw)
  To: Emanuel Berg, emacs-devel@gnu.org

> >> But OK, I'll do it ...
> >
> > You shouldn't follow an advice blindly.
> 
> It seems here one cannot agree but also one cannot
> disagree ...

Just wait till you try to agree to disagree... ;-)



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 15:18                                             ` Gregory Heytings
  2022-08-31 21:31                                               ` Emanuel Berg
@ 2022-08-31 21:55                                               ` Emanuel Berg
  2022-08-31 22:08                                                 ` Gregory Heytings
  1 sibling, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-08-31 21:55 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

If I do 'ln -s' instead of 'cp' and then 'git clone' I get
a symlink to the original position of the file on the local
disk:

  wrap-search.el -> /home/incal/public_html/emacs-init/wrap-search.el

Wow, that's integrated ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 21:55                                               ` Emanuel Berg
@ 2022-08-31 22:08                                                 ` Gregory Heytings
  2022-09-01  0:46                                                   ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-08-31 22:08 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>
> If I do 'ln -s' instead of 'cp' and then 'git clone' I get a symlink to 
> the original position of the file on the local disk:
>
> wrap-search.el -> /home/incal/public_html/emacs-init/wrap-search.el
>
> Wow, that's integrated ...
>

Which is why I told you not to follow an advice blindly ;-P

Do I understand correctly that you have (on your desktop computer) a 
~/.emacs.d directory with a bunch of .el files, that you copy (some or all 
of) these files into ~/public_html/emacs-init (still on your desktop 
computer), and that you rsync that ~/public_html/emacs-init directory into 
/var/www/htdocs/dataswamp.org/~incal/emacs-init (which is on your server)?



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 22:08                                                 ` Gregory Heytings
@ 2022-09-01  0:46                                                   ` Emanuel Berg
  2022-09-01 11:21                                                     ` Gregory Heytings
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-09-01  0:46 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

> Do I understand correctly that you have (on your desktop
> computer) a ~/.emacs.d directory with a bunch of .el files,
> that you copy (some or all of) these files into
> ~/public_html/emacs-init (still on your desktop computer),
> and that you rsync that ~/public_html/emacs-init directory
> into /var/www/htdocs/dataswamp.org/~incal/emacs-init (which
> is on your server)?

In ~/.emacs.d/ is a symlink to emacs-init/ in public_html/
which is rsync'd to the server ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-08-31 21:31                                               ` Emanuel Berg
  2022-08-31 21:45                                                 ` [External] : " Drew Adams
@ 2022-09-01  4:27                                                 ` tomas
  1 sibling, 0 replies; 56+ messages in thread
From: tomas @ 2022-09-01  4:27 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

On Wed, Aug 31, 2022 at 11:31:19PM +0200, Emanuel Berg wrote:
> Gregory Heytings wrote:
> 
> >> But OK, I'll do it ...
> >
> > You shouldn't follow an advice blindly.
> 
> It seems here one cannot agree but also one cannot
> disagree ...

I disagree: I would follow that advice blindly .-)

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01  0:46                                                   ` Emanuel Berg
@ 2022-09-01 11:21                                                     ` Gregory Heytings
  2022-09-01 17:02                                                       ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-09-01 11:21 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>> Do I understand correctly that you have (on your desktop computer) a 
>> ~/.emacs.d directory with a bunch of .el files, that you copy (some or 
>> all of) these files into ~/public_html/emacs-init (still on your 
>> desktop computer), and that you rsync that ~/public_html/emacs-init 
>> directory into /var/www/htdocs/dataswamp.org/~incal/emacs-init (which 
>> is on your server)?
>
> In ~/.emacs.d/ is a symlink to emacs-init/ in public_html/ which is 
> rsync'd to the server ...
>

Okay, so the master copy of your files are in ~/public_html/emacs-init.

Then I would probably do the following (on your desktop):

- create a new directory ~/public_html/emacs-init-git

- add a symlink in ~/.emacs.d to ~/public_html/emacs-init-git

- move ~/git/wrap-search to ~/public_html/emacs-init-git

- add the subdirectories of ~/public_html/emacs-init-git to your load-path 
(for now that's only ~/public_html/emacs-init-git/wrap-search)

- in the script which rsyncs ~/public_html/emacs-init to your server, add 
a loop which, for each directory inside ~/public_html/emacs-init-git/ (for 
now only ~/public_html/emacs-init-git/wrap-search) does

cd <directory name>
git commit -am $(date +%Y%m%d) && git push

This will automatically push your changes to your public repository.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 11:21                                                     ` Gregory Heytings
@ 2022-09-01 17:02                                                       ` Emanuel Berg
  2022-09-01 18:20                                                         ` Gregory Heytings
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-09-01 17:02 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

> Okay, so the master copy of your files are in
> ~/public_html/emacs-init

Yes, most of the Elisp files that I wrote are there, there are
also subdirectories there, e.g. gnus/, so in a way that's
there as well, and there is the the Makefile and .elc files.

> Then I would probably do the following (on your desktop):
>
> - create a new directory ~/public_html/emacs-init-git
>
> - add a symlink in ~/.emacs.d to ~/public_html/emacs-init-git
>
> - move ~/git/wrap-search to ~/public_html/emacs-init-git

But that way that directory will also be copied to the server
since all of public_html is?

> - add the subdirectories of ~/public_html/emacs-init-git to
>   your load-path (for now that's only
>  ~/public_html/emacs-init-git/wrap-search)

Wait, we should not move around the original files and start
changing load paths of other applications, symlinks are fine
but other than that it should be a "git only" solution.

It is just another tool that should be adapted to the problem,
we are not adapting the problem again and again for every new
tool that anyone every thought of applying on it ...

> - in the script which rsyncs ~/public_html/emacs-init to your
>   server [...]
>
> cd <directory name>
> git commit -am $(date +%Y%m%d) && git push
>
> This will automatically push your changes to your
> public repository.

Right, cool.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 17:02                                                       ` Emanuel Berg
@ 2022-09-01 18:20                                                         ` Gregory Heytings
  2022-09-01 19:17                                                           ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-09-01 18:20 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>
> But that way that directory will also be copied to the server since all 
> of public_html is?
>

Yes, that's not a problem, with the recipe you use to create the git 
repository, these files do not contain sensitive information.

>> - add the subdirectories of ~/public_html/emacs-init-git to your 
>> load-path (for now that's only 
>> ~/public_html/emacs-init-git/wrap-search)
>
> Wait, we should not move around the original files and start changing 
> load paths of other applications, symlinks are fine but other than that 
> it should be a "git only" solution.
>
> It is just another tool that should be adapted to the problem, we are 
> not adapting the problem again and again for every new tool that anyone 
> every thought of applying on it ...
>

You are of course free to do what you want.

I was thinking of a somewhat generic solution, in which your el files 
would stay in the same place (~/public_html/emacs-init), and your el files 
under version control (Git) in a separate place 
(~/public_html/init-emacs-git).

That being said, what I said above is perhaps not clear enough.  I meant 
"add the subdirectories of ~/.emacs.d/<the link that points to 
~/public_html/emacs-init-git>" to your load-path.  If you're more 
comfortable with replacing ~/public_html/emacs-init/wrap-search.el with a 
symlink to ~/git/wrap-search/wrap-search.el, do that.  The main point is 
to have a single wrap-search.el file on your desktop.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 18:20                                                         ` Gregory Heytings
@ 2022-09-01 19:17                                                           ` Emanuel Berg
  2022-09-01 20:01                                                             ` Gregory Heytings
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-09-01 19:17 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

>> But that way that directory will also be copied to the
>> server since all of public_html is?
>
> Yes, that's not a problem, with the recipe you use to create
> the git repository, these files do not contain
> sensitive information.

No, but I have the master copy on the desktop and it's already
copied to the server, so there is or shouldn't be any need to
copy anything else between those.

>>> - add the subdirectories of ~/public_html/emacs-init-git to
>>> your load-path (for now that's only
>>> ~/public_html/emacs-init-git/wrap-search)
>>
>> Wait, we should not move around the original files and
>> start changing load paths of other applications, symlinks
>> are fine but other than that it should be a "git
>> only" solution.
>>
>> It is just another tool that should be adapted to the
>> problem, we are not adapting the problem again and again
>> for every new tool that anyone every thought of applying on
>> it ...
>
> I was thinking of a somewhat generic solution, in which your
> el files would stay in the same place

Good ...

> (~/public_html/emacs-init), and your el files under version
> control (Git) in a separate place
> (~/public_html/init-emacs-git).

That would be OK but that should be for git-only use if so, so
either symlinks (which didn't work last time) or an automated
copy.

> If it helps That being said, what I said above is perhaps
> not clear enough. I meant "add the subdirectories of
> ~/.emacs.d/<the link that points to
> ~/public_html/emacs-init-git>" to your load-path.

But this problem has nothing to do with Emacs so no changes to
Emacs or any other unrelated tool should be necessary.

> If you're more comfortable with replacing
> ~/public_html/emacs-init/wrap-search.el with a symlink to
> ~/git/wrap-search/wrap-search.el, do that.

No, for the same reason. The other way around would be OK tho.

> The main point is to have a single wrap-search.el file on
> your desktop.

Not following, I already have that?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 19:17                                                           ` Emanuel Berg
@ 2022-09-01 20:01                                                             ` Gregory Heytings
  2022-09-01 20:52                                                               ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-09-01 20:01 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>> If you're more comfortable with replacing 
>> ~/public_html/emacs-init/wrap-search.el with a symlink to 
>> ~/git/wrap-search/wrap-search.el, do that.
>
> No, for the same reason. The other way around would be OK tho.
>

Okay, then given your requirements, AFAICS the only remaining possibility 
is to add, in the script which rsyncs your files to the server, something 
like:

cp ~/public_html/emacs-init/wrap-search.el ~/git/wrap-search/wrap-search.el
cd ~/git/wrap-search/
git commit -am $(date +%Y%m%d) && git push

This will copy your master file into your local repository, and push it 
from there to the remote repository (if necessary).  Change the "~/git/" 
in the above commands if appropriate.  You may also want to adapt the 
commit message if you sometimes rsync your files multiple times a day 
(although Git doesn't care if multiple commits have the same message).



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 20:01                                                             ` Gregory Heytings
@ 2022-09-01 20:52                                                               ` Emanuel Berg
  2022-09-01 21:59                                                                 ` Gregory Heytings
  0 siblings, 1 reply; 56+ messages in thread
From: Emanuel Berg @ 2022-09-01 20:52 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

> Okay, then given your requirements, AFAICS the only
> remaining possibility is to add, in the script which rsyncs
> your files to the server, something like:
>
> cp ~/public_html/emacs-init/wrap-search.el ~/git/wrap-search/wrap-search.el
> cd ~/git/wrap-search/
> git commit -am $(date +%Y%m%d) && git push
>
> This will copy your master file into your local repository,
> and push it from there to the remote repository (if
> necessary). Change the "~/git/" in the above commands if
> appropriate. You may also want to adapt the commit message
> if you sometimes rsync your files multiple times a day
> (although Git doesn't care if multiple commits have the same
> message).

OK, problem solved, ELPA and everyone else I guess can get it
like this:

  $ git clone https://dataswamp.org/~incal/wrap-search.git

BTW I found the -q option for both git-commit(1) and
git-push(1) but it doesn't seem to work for 'git commit'?

https://dataswamp.org/~incal/conf/.zsh/git

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 20:52                                                               ` Emanuel Berg
@ 2022-09-01 21:59                                                                 ` Gregory Heytings
  2022-09-01 22:20                                                                   ` Emanuel Berg
  2022-09-02  8:55                                                                   ` Yuri Khan
  0 siblings, 2 replies; 56+ messages in thread
From: Gregory Heytings @ 2022-09-01 21:59 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel


>
> BTW I found the -q option for both git-commit(1) and git-push(1) but it 
> doesn't seem to work for 'git commit'?
>

I guess you see:

On branch master
nothing to commit, working tree clean

when the file hasn't changed?  You can check whether it has changed with

git diff --quiet --exit-code

or

git diff-index --quiet HEAD

Both commands return 1 if there are changes, and 0 otherwise.  So you can 
make your "git commit && git push" conditional to that return value.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 21:59                                                                 ` Gregory Heytings
@ 2022-09-01 22:20                                                                   ` Emanuel Berg
  2022-09-02  8:55                                                                   ` Yuri Khan
  1 sibling, 0 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-09-01 22:20 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

> git diff --quiet --exit-code
>
> or
>
> git diff-index --quiet HEAD
>
> Both commands return 1 if there are changes, and 0
> otherwise. So you can make your "git commit && git push"
> conditional to that return value.

OK, works!

#! /bin/zsh

git diff -q --exit-code
if [[ $? == 1 ]]; then
  git commit -a -m "$(date)"
  git push -q
fi

46 lines locally!
<https://dataswamp.org/~incal/conf/.zsh/git>

31 lines at the server.

wrap-search.el is 106 lines so the ratio is 0.72 :)
<https://dataswamp.org/~incal/emacs-init/wrap-search.el>

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-01 21:59                                                                 ` Gregory Heytings
  2022-09-01 22:20                                                                   ` Emanuel Berg
@ 2022-09-02  8:55                                                                   ` Yuri Khan
  2022-09-02  9:03                                                                     ` Gregory Heytings
  1 sibling, 1 reply; 56+ messages in thread
From: Yuri Khan @ 2022-09-02  8:55 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: Emanuel Berg, emacs-devel

On Fri, 2 Sept 2022 at 05:00, Gregory Heytings <gregory@heytings.org> wrote:

> I guess you see:
>
> On branch master
> nothing to commit, working tree clean
>
> when the file hasn't changed?  You can check whether it has changed with
>
> git diff --quiet --exit-code
>
> or
>
> git diff-index --quiet HEAD

Alternatively, one might stop trying to automate commits and actually
write useful commit messages when and if a functionally complete set
of changes is finished.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-02  8:55                                                                   ` Yuri Khan
@ 2022-09-02  9:03                                                                     ` Gregory Heytings
  2022-09-02 21:10                                                                       ` Emanuel Berg
  0 siblings, 1 reply; 56+ messages in thread
From: Gregory Heytings @ 2022-09-02  9:03 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Emanuel Berg, emacs-devel


>> I guess you see:
>>
>> On branch master
>> nothing to commit, working tree clean
>>
>> when the file hasn't changed?  You can check whether it has changed 
>> with
>>
>> git diff --quiet --exit-code
>>
>> or
>>
>> git diff-index --quiet HEAD
>
> Alternatively, one might stop trying to automate commits and actually 
> write useful commit messages when and if a functionally complete set of 
> changes is finished.
>

Emanuel wanted something completely automated that would not change his 
existing workflow.  Useful commit messages are better of course, but 
automated commit messages aren't a catastrophe.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: wrap-search 3.3.5
  2022-09-02  9:03                                                                     ` Gregory Heytings
@ 2022-09-02 21:10                                                                       ` Emanuel Berg
  0 siblings, 0 replies; 56+ messages in thread
From: Emanuel Berg @ 2022-09-02 21:10 UTC (permalink / raw)
  To: emacs-devel

Gregory Heytings wrote:

>> Alternatively, one might stop trying to automate commits
>> and actually write useful commit messages when and if
>> a functionally complete set of changes is finished.
>
> Emanuel wanted something completely automated that would not
> change his existing workflow. Useful commit messages are
> better of course, but automated commit messages aren't
> a catastrophe.

Well, I don't really care how well-documented the process of
"development" - or programming as I like to call it - is.

Maybe at some point the complexity of software gets so big
such documentation is actually useful for further work on it,
i.e. the software, but not with 106 lines of Elisp with
3 defuns, for sure.

Not saying there's anything wrong with those 106 lines ... on
the contrary.

Anyway I'm happy to sign whatever agreement you are speaking
of and close the book on this?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2022-09-02 21:10 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 18:28 wrap-search 3.3.5 Emanuel Berg
2022-08-25 18:34 ` Philip Kaludercic
2022-08-25 18:50   ` Emanuel Berg
2022-08-25 19:05     ` Philip Kaludercic
2022-08-25 19:15       ` Emanuel Berg
2022-08-25 20:48         ` Philip Kaludercic
2022-08-26 19:46           ` Emanuel Berg
2022-08-26 23:46             ` Philip Kaludercic
2022-08-27  0:06               ` Emanuel Berg
2022-08-27  8:24                 ` Philip Kaludercic
2022-08-28  0:13                   ` Emanuel Berg
2022-08-28  8:07                     ` Philip Kaludercic
2022-08-28  8:30                       ` Andreas Schwab
2022-08-28  8:43                       ` Emanuel Berg
2022-08-28  9:00                         ` Philip Kaludercic
2022-08-28 21:02                           ` Emanuel Berg
2022-08-28 21:24                             ` Gregory Heytings
2022-08-28 21:31                               ` Emanuel Berg
2022-08-28 21:33                                 ` Emanuel Berg
2022-08-29  6:28                             ` Yuri Khan
2022-08-31  2:06                               ` Emanuel Berg
2022-08-31  9:04                                 ` Philip Kaludercic
2022-08-31  9:29                                   ` Emanuel Berg
2022-08-31 10:42                                     ` Gregory Heytings
2022-08-31 11:04                                       ` Emanuel Berg
2022-08-31 12:24                                         ` Gregory Heytings
2022-08-31 15:08                                           ` Emanuel Berg
2022-08-31 15:18                                             ` Gregory Heytings
2022-08-31 21:31                                               ` Emanuel Berg
2022-08-31 21:45                                                 ` [External] : " Drew Adams
2022-09-01  4:27                                                 ` tomas
2022-08-31 21:55                                               ` Emanuel Berg
2022-08-31 22:08                                                 ` Gregory Heytings
2022-09-01  0:46                                                   ` Emanuel Berg
2022-09-01 11:21                                                     ` Gregory Heytings
2022-09-01 17:02                                                       ` Emanuel Berg
2022-09-01 18:20                                                         ` Gregory Heytings
2022-09-01 19:17                                                           ` Emanuel Berg
2022-09-01 20:01                                                             ` Gregory Heytings
2022-09-01 20:52                                                               ` Emanuel Berg
2022-09-01 21:59                                                                 ` Gregory Heytings
2022-09-01 22:20                                                                   ` Emanuel Berg
2022-09-02  8:55                                                                   ` Yuri Khan
2022-09-02  9:03                                                                     ` Gregory Heytings
2022-09-02 21:10                                                                       ` Emanuel Berg
2022-08-31 14:54                                     ` Philip Kaludercic
2022-08-31 15:09                                       ` Emanuel Berg
2022-08-25 21:46       ` [External] : " Drew Adams
2022-08-25 20:26     ` Stefan Monnier
2022-08-25 22:08       ` Emanuel Berg
2022-08-25 22:23         ` Emanuel Berg
2022-08-26  1:10           ` Stefan Monnier
2022-08-26  2:17             ` Emanuel Berg
2022-08-25 22:47         ` Emanuel Berg
2022-08-25 22:19       ` Emanuel Berg
2022-08-26 10:17         ` Emanuel Berg

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