all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.