* Best (or common) pratices on package development workflow
@ 2023-06-01 23:11 Lic. Federico G. Stilman
2023-06-01 23:51 ` Ruijie Yu via Emacs development discussions.
2023-06-01 23:56 ` Michael Heerdegen
0 siblings, 2 replies; 5+ messages in thread
From: Lic. Federico G. Stilman @ 2023-06-01 23:11 UTC (permalink / raw)
To: emacs-devel
Hi all,
First things first. I started development with Emacs Lisp a few weeks
ago after using for more than 20 years Emacs for my daily work. So I
am a newbie on the Emacs Lisp development side.
I am currently writing a simple Emacs package consisting of one .el file.
I have a couple of defcustom declarations that initialize some
variables with a default value. And this is the source of my question.
Every time I make a change to the init value of the defcustom
declaration, I have to unload the feature provided by the package,
with something like:
(unload-feature 'my-package)
and after that, reload the library with something like
(load-library "my-package")
If not, the customization framework doesn't account for the change on
the default value of the custom variables.
My question is: which is the workflow you use when developing a
package for Emacs, for easily "reloading" the package for any kind of
changes by taken into account?
Re-evaluating the entire, or loading the file, works for reloading
functions. But - as far as I know - does not work for reloading
defcustom initialization values.
My package is for now something very simple consisting of one .el
file. I wonder how do you manage this when a package consists of many
.el files.
Thank you all,
Federico
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best (or common) pratices on package development workflow
2023-06-01 23:11 Best (or common) pratices on package development workflow Lic. Federico G. Stilman
@ 2023-06-01 23:51 ` Ruijie Yu via Emacs development discussions.
2023-06-02 1:08 ` Lic. Federico G. Stilman
2023-06-01 23:56 ` Michael Heerdegen
1 sibling, 1 reply; 5+ messages in thread
From: Ruijie Yu via Emacs development discussions. @ 2023-06-01 23:51 UTC (permalink / raw)
To: Lic. Federico G. Stilman; +Cc: emacs-devel
On Jun 2, 2023, at 07:12, Lic. Federico G. Stilman <fstilman@gmail.com> wrote:
>
> Hi all,
>
> First things first. I started development with Emacs Lisp a few weeks
> ago after using for more than 20 years Emacs for my daily work. So I
> am a newbie on the Emacs Lisp development side.
>
> I am currently writing a simple Emacs package consisting of one .el file.
>
> I have a couple of defcustom declarations that initialize some
> variables with a default value. And this is the source of my question.
>
> Every time I make a change to the init value of the defcustom
> declaration, I have to unload the feature provided by the package,
> with something like:
>
> (unload-feature 'my-package)
for defcustom, defun, defvar, etc, you can use C-M-x when you are inside the corresponding s-exp to evaluate it (and reset the initial value if it is a variable). See the docstring of C-M-x for details.
When for some reason I don’t feel like doing that, I would use either makunbound or fmakunbound to clear its symbol value or symbol function, then load the file again via M-x eval-buffer or the like.
> and after that, reload the library with something like
>
> (load-library "my-package")
>
> If not, the customization framework doesn't account for the change on
> the default value of the custom variables.
>
> My question is: which is the workflow you use when developing a
> package for Emacs, for easily "reloading" the package for any kind of
> changes by taken into account?
>
> Re-evaluating the entire, or loading the file, works for reloading
> functions. But - as far as I know - does not work for reloading
> defcustom initialization values.
>
> My package is for now something very simple consisting of one .el
> file. I wonder how do you manage this when a package consists of many
> .el files.
>
> Thank you all,
>
> Federico
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best (or common) pratices on package development workflow
2023-06-01 23:11 Best (or common) pratices on package development workflow Lic. Federico G. Stilman
2023-06-01 23:51 ` Ruijie Yu via Emacs development discussions.
@ 2023-06-01 23:56 ` Michael Heerdegen
2023-06-02 1:09 ` Lic. Federico G. Stilman
1 sibling, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2023-06-01 23:56 UTC (permalink / raw)
To: emacs-devel
"Lic. Federico G. Stilman" <fstilman@gmail.com> writes:
> Every time I make a change to the init value of the defcustom
> declaration, I have to unload the feature provided by the package,
> with something like:
>
> (unload-feature 'my-package)
>
> and after that, reload the library with something like
>
> (load-library "my-package")
>
> If not, the customization framework doesn't account for the change on
> the default value of the custom variables.
In simple cases, you can follow this advice:
| When you evaluate a top-level ‘defvar’ form with ‘C-M-x’
| (‘eval-defun’) or with ‘C-x C-e’ (‘eval-last-sexp’) in Emacs Lisp
| mode, a special feature of these two commands arranges to set the
| variable unconditionally, without testing whether its value is
| void.
(info "(elisp) Defining Variables")
If you changed a lot of `defvar's, unloading might be the cleaner way
(note that if you do not unload, declared variables are still special
and bound, and you might miss places in your code that still depend on
such an actually already removed variable).
If you work intensively on a certain library, it might be better to do
the coding in one instance and test the code in another instance that
you restart regularly.
Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best (or common) pratices on package development workflow
2023-06-01 23:51 ` Ruijie Yu via Emacs development discussions.
@ 2023-06-02 1:08 ` Lic. Federico G. Stilman
0 siblings, 0 replies; 5+ messages in thread
From: Lic. Federico G. Stilman @ 2023-06-02 1:08 UTC (permalink / raw)
To: Ruijie Yu; +Cc: emacs-devel
Thanks, Ruijie. I can't believe I did not notice this before. I
actually use C-x C-e all the time for evaluating forms (and just
proved it also works).
Best regards,
--
Federico
On Thu, Jun 1, 2023 at 8:51 PM Ruijie Yu <ruijie@netyu.xyz> wrote:
>
> On Jun 2, 2023, at 07:12, Lic. Federico G. Stilman <fstilman@gmail.com> wrote:
> >
> > Hi all,
> >
> > First things first. I started development with Emacs Lisp a few weeks
> > ago after using for more than 20 years Emacs for my daily work. So I
> > am a newbie on the Emacs Lisp development side.
> >
> > I am currently writing a simple Emacs package consisting of one .el file.
> >
> > I have a couple of defcustom declarations that initialize some
> > variables with a default value. And this is the source of my question.
> >
> > Every time I make a change to the init value of the defcustom
> > declaration, I have to unload the feature provided by the package,
> > with something like:
> >
> > (unload-feature 'my-package)
>
> for defcustom, defun, defvar, etc, you can use C-M-x when you are inside the corresponding s-exp to evaluate it (and reset the initial value if it is a variable). See the docstring of C-M-x for details.
>
> When for some reason I don’t feel like doing that, I would use either makunbound or fmakunbound to clear its symbol value or symbol function, then load the file again via M-x eval-buffer or the like.
>
> > and after that, reload the library with something like
> >
> > (load-library "my-package")
> >
> > If not, the customization framework doesn't account for the change on
> > the default value of the custom variables.
> >
> > My question is: which is the workflow you use when developing a
> > package for Emacs, for easily "reloading" the package for any kind of
> > changes by taken into account?
> >
> > Re-evaluating the entire, or loading the file, works for reloading
> > functions. But - as far as I know - does not work for reloading
> > defcustom initialization values.
> >
> > My package is for now something very simple consisting of one .el
> > file. I wonder how do you manage this when a package consists of many
> > .el files.
> >
> > Thank you all,
> >
> > Federico
> >
>
--
Lic. Federico G. Stilman
Stilman Research
Tel/Fax: (011) 4801 - 4605 / 4177
Cel.: (00 598) 94 066 771
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Best (or common) pratices on package development workflow
2023-06-01 23:56 ` Michael Heerdegen
@ 2023-06-02 1:09 ` Lic. Federico G. Stilman
0 siblings, 0 replies; 5+ messages in thread
From: Lic. Federico G. Stilman @ 2023-06-02 1:09 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: emacs-devel
On Thu, Jun 1, 2023 at 8:57 PM Michael Heerdegen
<michael_heerdegen@web.de> wrote:
> In simple cases, you can follow this advice:
>
> | When you evaluate a top-level ‘defvar’ form with ‘C-M-x’
> | (‘eval-defun’) or with ‘C-x C-e’ (‘eval-last-sexp’) in Emacs Lisp
> | mode, a special feature of these two commands arranges to set the
> | variable unconditionally, without testing whether its value is
> | void.
Thanks, Michael. I can't believe I did not notice this before. I
actually use C-x C-e all the time for evaluating forms (and just
proved it also works).
Best regards,
--
Federico
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-02 1:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01 23:11 Best (or common) pratices on package development workflow Lic. Federico G. Stilman
2023-06-01 23:51 ` Ruijie Yu via Emacs development discussions.
2023-06-02 1:08 ` Lic. Federico G. Stilman
2023-06-01 23:56 ` Michael Heerdegen
2023-06-02 1:09 ` Lic. Federico G. Stilman
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.