* modularity, code for yourself and possibly others
@ 2019-03-29 0:42 Emanuel Berg
2019-03-29 10:43 ` Tadeus Prastowo
0 siblings, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2019-03-29 0:42 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: emacs-devel
N.B. This is not me posting code! I mean,
obviously it is :) But it is not for the
purpose of posting code! It is for the
purpose of illustrating an issue and
formulating a question (two questions).
The example comes from the real situation,
of course, but nonetheless. And as for
this "silly explanation" (I didn't find
a good English word for it, in Swedish we
say "gardering" which `google-translate'
[1], i.e. Google Translate, translates
into "hedging", which I take is the
literal translation of the word) - anyway
as for this silly explanation, it is for
display purposes ONLY :))
The least interesting part of the problem
first:
How do I remove all blank lines from a buffer?
I.e. `delete-blank-lines' en masse?
I wrote this:
(defun delete-all-blank-lines ()
(interactive)
(flush-lines "^[[:space:]]*$" (point-min) (point-max)) )
(defalias 'neat #'delete-all-blank-lines)
It seems to work, but perhaps anyone can spot
an error or do it even neater?
OK, now for the more interesting problem!
todo-did.el [3] has undergone some early
expected bugs and ditto -fixes. One of them
involved the use of the above function,
"delete-all-blank-lines".
But because that is a function of generic value
and use, I have it in another file [2]. So now
todo-did.el has to `require' that file. Oh, no!
In todo-did.el, I put it like this:
(require 'edit) ; http://user.it.uu.se/~embe8573/emacs-init/edit.el
[...]
(delete-all-blank-lines) ; http://user.it.uu.se/~embe8573/emacs-init/edit.el
However that really won't help as in edit.el,
I have
(require 'tabs)
(require 'sudo-user-path)
(require 'window-new)
And in those files... yes, by now you get
the picture.
So, if anyone but me ever would like to try
todo-did.el, it'd be a heck of a job getting
all those files. Well, not really, as they are
all in one place and mentioned by name, that
would be a very easy job! But absolutely not
a job one can expect from someone else who just
wants to try out a piece of new software!
So how does one solve that?
OK, here for a last "gardering". Some might
say, "'delete-all-blank-lines' is just
a one-liner. Why don't you just put it verbatim
in todo-did.el?"
Well, 1) it is a matter of principle that two
wrongs don't make a right, and
2) I have so much Elisp already so if
I didn't have it modularized it would
be a total disaster for many reasons.
One would be, whenever a bug is
discovered I'd have to search the
entire code [3] and alter
every instance!
So how should it be done?
[1] Get from MELPA or
https://github.com/atykhonov/google-translate
[2] http://user.it.uu.se/~embe8573/emacs-init/edit.el
[3] Actually I have a zsh snippet for that,
line 51 @ http://user.it.uu.se/~embe8573/conf/.zsh/zsh-to-emacs -
but I use that enough already thank you :)
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-03-29 0:42 modularity, code for yourself and possibly others Emanuel Berg
@ 2019-03-29 10:43 ` Tadeus Prastowo
2019-04-01 22:22 ` Emanuel Berg
0 siblings, 1 reply; 12+ messages in thread
From: Tadeus Prastowo @ 2019-03-29 10:43 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs, emacs-devel
On Fri, Mar 29, 2019 at 1:47 AM Emanuel Berg <moasenwood@zoho.eu> wrote:
> How do I remove all blank lines from a buffer?
> I.e. `delete-blank-lines' en masse?
Why not firing `whitespace-cleanup' instead?
[...]
> But because that is a function of generic value
> and use, I have it in another file [2]. So now
> todo-did.el has to `require' that file. Oh, no!
>
> In todo-did.el, I put it like this:
>
>
> (require 'edit) ; http://user.it.uu.se/~embe8573/emacs-init/edit.el
> [...]
> (delete-all-blank-lines) ; http://user.it.uu.se/~embe8573/emacs-init/edit.el
>
>
> However that really won't help as in edit.el,
> I have
>
>
> (require 'tabs)
> (require 'sudo-user-path)
> (require 'window-new)
Why don't you put that function in another file other than edit.el?
You are basically dealing with a common problem in software
engineering that can be solved by refactoring.
> --
> underground experts united
> http://user.it.uu.se/~embe8573
--
Best regards,
Tadeus
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-03-29 10:43 ` Tadeus Prastowo
@ 2019-04-01 22:22 ` Emanuel Berg
2019-04-02 9:42 ` Tadeus Prastowo
0 siblings, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2019-04-01 22:22 UTC (permalink / raw)
To: emacs-devel; +Cc: help-gnu-emacs
Tadeus Prastowo wrote:
> Why not firing `whitespace-cleanup' instead?
OK, I didn't know about it. Thank you. But it
doesn't change the general situation.
> Why don't you put that function in another
> file other than edit.el? You are basically
> dealing with a common problem in software
> engineering that can be solved
> by refactoring.
All my stuff are already sorted into files
according to what they do. E.g.,
for Emacs-w3m [1], I have
bookmarks.el
dl.el
history.el
search.el
w3m-keys.el
w3m-my.el
w3m-tabs.el
w3m-unisearch.el
so it is all neatly sorted. But hardly none of
it is/can be used independently.
Moving one function from edit.el to some other
file would require the user to `require' that
file instead, and that file would `require' yet
another file(s), and so on. How would that be
any different?
In the extreme case, for someone else to use
a single of my .el files, s/he would have to
use my entire Elisp system!
[OFF TOPIC] Hint: RFC 3676, section 4.3 (Usenet
Signature Convention)
https://www.ietf.org/rfc/rfc3676.txt
[1] http://user.it.uu.se/~embe8573/emacs-init/w3m/
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-04-01 22:22 ` Emanuel Berg
@ 2019-04-02 9:42 ` Tadeus Prastowo
2019-04-04 3:20 ` Emanuel Berg
0 siblings, 1 reply; 12+ messages in thread
From: Tadeus Prastowo @ 2019-04-02 9:42 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs, emacs-devel
On Tue, Apr 2, 2019 at 12:48 AM Emanuel Berg <moasenwood@zoho.eu> wrote:
> Moving one function from edit.el to some other
> file would require the user to `require' that
> file instead, and that file would `require' yet
> another file(s), and so on. How would that be
> any different?
>
> In the extreme case, for someone else to use
> a single of my .el files, s/he would have to
> use my entire Elisp system!
Rather than going off tangent now by talking about the extreme case,
what about if we confine our discussion _for now_ to your specific
case of dealing with your pet function `delete-blank-lines'?
If you agree, then let's say we put that pet function to its own file
`whitespace-cleaners.el'. As of now, that file will require no other
file. So, its user will need to require only that file if that user
needs no other function of yours. Problem solved here.
Now, let's enlarge the case a bit. Suppose now the user also wants to
use one other function of yours in file `edit.el'. If you had
engineered that function _and_ that file properly, then the user would
have no need to have your entire Elisp system. Problem solved.
Jumping now to the general situation, a tradeoff exists between
reinventing the wheel and having a long chain of dependencies. For
having zero dependency, reinvent all the wheels. To minimize wheel
reinventions, add further dependencies. As the engineer of your own
Elisp system, you should think about the right design; surely
different potential users of your Elisp system have their own
requirements regarding this tradeoff.
--
Best regards,
Tadeus
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-04-02 9:42 ` Tadeus Prastowo
@ 2019-04-04 3:20 ` Emanuel Berg
2019-04-04 8:10 ` Tadeus Prastowo
0 siblings, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2019-04-04 3:20 UTC (permalink / raw)
To: emacs-devel; +Cc: help-gnu-emacs
Tadeus Prastowo wrote:
> Rather than going off tangent now by talking
> about the extreme case, what about if we
> confine our discussion _for now_ to your
> specific case of dealing with your pet
> function `delete-blank-lines'?
It is not a pet function. I was unaware of the
existence of the function you mentioned. I have
replaced the supposed pet with the proper
function. Your demeaning style isn't
appreciated BTW.
> If you agree then let's say we put that pet
> function to its own file
> `whitespace-cleaners.el'. As of now, that
> file will require no other file. So, its user
> will need to require only that file if that
> user needs no other function of yours.
> Problem solved here.
The problem is perhaps solved for another
person wanting to test my software in an easy
and straightforward way. For me on the other
hand, the solution of narrowing down every such
instance would amount to not 116 Elisp files,
but to several hundreds! I have shortcuts to
most of them files [1]. But to navigate
a system with several hundred files, many of
them consisting of a single or but a few
functions, would be a total diaster for me,
while it would still be uncertain how many
other people would really use my stuff.
I.e., a lot of work for me, a crippled system
for me, to achieve an uncertain gain.
The primary goal is still to have a good system
for me, since I wrote it for my purposes.
> Now, let's enlarge the case a bit.
> Suppose now the user also wants to use one
> other function of yours in file `edit.el'.
> If you had engineered that function _and_
> that file properly, then the user would have
> no need to have your entire Elisp system.
> Problem solved.
Consistent demeaning style + plain
insults = *plonk*
PS. Your signature is still incorrect. DS.
[1] http://user.it.uu.se/~embe8573/emacs-init/navigate-fs-keys.el
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-04-04 3:20 ` Emanuel Berg
@ 2019-04-04 8:10 ` Tadeus Prastowo
2019-04-04 22:38 ` Richard Stallman
0 siblings, 1 reply; 12+ messages in thread
From: Tadeus Prastowo @ 2019-04-04 8:10 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs, emacs-devel
On Thu, Apr 4, 2019 at 5:30 AM Emanuel Berg <moasenwood@zoho.eu> wrote:
>
> Tadeus Prastowo wrote:
>
> > Rather than going off tangent now by talking
> > about the extreme case, what about if we
> > confine our discussion _for now_ to your
> > specific case of dealing with your pet
> > function `delete-blank-lines'?
>
> It is not a pet function. I was unaware of the
> existence of the function you mentioned. I have
> replaced the supposed pet with the proper
> function. Your demeaning style isn't
> appreciated BTW.
First, I am sorry if you recognize the term `pet function' as
something pejorative. AFAIK, the term is not pejorative. Aside from
that, my intention of using the term is to quickly refer to that
function of yours whose name I didn't recall, but about which I am
sure the referent of the term will not be mistaken.
> > If you agree then let's say we put that pet
> > function to its own file
> > `whitespace-cleaners.el'. As of now, that
> > file will require no other file. So, its user
> > will need to require only that file if that
> > user needs no other function of yours.
> > Problem solved here.
>
> The problem is perhaps solved for another
> person wanting to test my software in an easy
> and straightforward way. For me on the other
> hand, the solution of narrowing down every such
> instance would amount to not 116 Elisp files,
> but to several hundreds! I have shortcuts to
> most of them files [1]. But to navigate
> a system with several hundred files, many of
> them consisting of a single or but a few
> functions, would be a total diaster for me,
> while it would still be uncertain how many
> other people would really use my stuff.
> I.e., a lot of work for me, a crippled system
> for me, to achieve an uncertain gain.
> The primary goal is still to have a good system
> for me, since I wrote it for my purposes.
It's your call. I just want to address your original question on the
problem that spawned this thread.
> > Now, let's enlarge the case a bit.
> > Suppose now the user also wants to use one
> > other function of yours in file `edit.el'.
> > If you had engineered that function _and_
> > that file properly, then the user would have
> > no need to have your entire Elisp system.
> > Problem solved.
>
> Consistent demeaning style + plain
> insults = *plonk*
Once again, I am sorry if you perceive something demeaning + plain
insults = *plonk* in that paragraph. But, honestly, I don't see
anything like that in that paragraph.
> PS. Your signature is still incorrect. DS.
Ah, okay, so that's what you mean by giving me the RFC link. Why
didn't you tell me straight away about what was missing? Okay, I have
fixed my signature, thanks.
> [1] http://user.it.uu.se/~embe8573/emacs-init/navigate-fs-keys.el
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
--
Best regards,
Tadeus
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-04-04 8:10 ` Tadeus Prastowo
@ 2019-04-04 22:38 ` Richard Stallman
2019-04-05 3:16 ` Emanuel Berg
2019-04-05 9:57 ` Tadeus Prastowo
0 siblings, 2 replies; 12+ messages in thread
From: Richard Stallman @ 2019-04-04 22:38 UTC (permalink / raw)
To: Tadeus Prastowo; +Cc: help-gnu-emacs, moasenwood, emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
The locution "your pet XYZ" is somewhat dismissive and disparaging.
It means, "The XYZ that you fuss over so much for no objective
reason."
I'm sure you didn't mean it that way, and it isn't a big deal.
But since the question has come up, I'd like to make people
aware of this.
--
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-04-04 22:38 ` Richard Stallman
@ 2019-04-05 3:16 ` Emanuel Berg
2019-04-05 22:31 ` Richard Stallman
2019-04-05 9:57 ` Tadeus Prastowo
1 sibling, 1 reply; 12+ messages in thread
From: Emanuel Berg @ 2019-04-05 3:16 UTC (permalink / raw)
To: emacs-devel; +Cc: help-gnu-emacs
Richard Stallman wrote:
> The locution "your pet XYZ" is somewhat
> dismissive and disparaging. It means, "The
> XYZ that you fuss over so much for no
> objective reason."
>
> I'm sure you didn't mean it that way, and it
> isn't a big deal. But since the question has
> come up, I'd like to make people aware
> of this.
You are absolutely right I didn't mean it that
way (if you refer to me?): it was meant as an
example, an example taken from reality, yes,
i.e. not made up, but still just an example.
The question/challenge was/is how to avoid not
just sitting on your own huge personal Elisp
system, and be all content about that, but how
to make parts of it accessible to other people
without having them `require' tons of general
stuff you yourself have collected in different
files, some of them huge, for
practical reasons.
OK, now that this is made clear I'll remove the
*plonk*, I just got frustrated, no big deal as
you say.
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-04-05 3:16 ` Emanuel Berg
@ 2019-04-05 22:31 ` Richard Stallman
0 siblings, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2019-04-05 22:31 UTC (permalink / raw)
To: Emanuel Berg; +Cc: emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> The question/challenge was/is how to avoid not
> just sitting on your own huge personal Elisp
> system, and be all content about that, but how
> to make parts of it accessible to other people
> without having them `require' tons of general
> stuff you yourself have collected in different
> files, some of them huge, for
> practical reasons.
In my experience, the only way to produce good results is to go over
the code foir one functionality at a time, and rewrite it to be
well-integrated with Emacs while modularly separated from the other
functionalities of the contribution.
I wish we had done this with the collection of diverse features
which is Org mode.
--
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: modularity, code for yourself and possibly others
2019-04-04 22:38 ` Richard Stallman
2019-04-05 3:16 ` Emanuel Berg
@ 2019-04-05 9:57 ` Tadeus Prastowo
2019-04-05 22:33 ` Richard Stallman
1 sibling, 1 reply; 12+ messages in thread
From: Tadeus Prastowo @ 2019-04-05 9:57 UTC (permalink / raw)
To: rms; +Cc: help-gnu-emacs, Emanuel Berg, emacs-devel
On Fri, Apr 5, 2019 at 12:38 AM Richard Stallman <rms@gnu.org> wrote:
>
> The locution "your pet XYZ" is somewhat dismissive and disparaging.
> It means, "The XYZ that you fuss over so much for no objective
> reason."
>
> I'm sure you didn't mean it that way, and it isn't a big deal.
> But since the question has come up, I'd like to make people
> aware of this.
Ah, okay, noted. The meaning really has changed then because I
learned that term a year ago when babysitting using the following
song:
Chubby Cheeks, dimple chin,
Rosy lips, teeth within,
Curly hair, very fair,
Eyes are blue, lovely too,
Teacher’s pet, is that you?
> --
> Dr Richard Stallman
> President, Free Software Foundation (https://gnu.org, https://fsf.org)
> Internet Hall-of-Famer (https://internethalloffame.org)
--
Best regards,
Tadeus
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-04-05 22:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-29 0:42 modularity, code for yourself and possibly others Emanuel Berg
2019-03-29 10:43 ` Tadeus Prastowo
2019-04-01 22:22 ` Emanuel Berg
2019-04-02 9:42 ` Tadeus Prastowo
2019-04-04 3:20 ` Emanuel Berg
2019-04-04 8:10 ` Tadeus Prastowo
2019-04-04 22:38 ` Richard Stallman
2019-04-05 3:16 ` Emanuel Berg
2019-04-05 22:31 ` Richard Stallman
2019-04-05 9:57 ` Tadeus Prastowo
2019-04-05 22:33 ` Richard Stallman
2019-04-05 22:48 ` Drew Adams
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).