all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Make fullscreen with margins
@ 2020-11-21 20:13 Christopher Dimech
  2020-11-22 14:19 ` Michael Heerdegen
  0 siblings, 1 reply; 15+ messages in thread
From: Christopher Dimech @ 2020-11-21 20:13 UTC (permalink / raw)
  To: Help Gnu Emacs

I have the following code for getting to full screen Have made buffer-margins
that sets a margin on either side of buffer.  Bet I would like that the
margins are only set when there is only one buffer in the frame.

(defun fullscr-cycle ()
   "Toggles Fullscreen Mode"
   (interactive)
   (if (eq (frame-parameter nil 'fullscreen) 'fullboth)
      (progn (buffer-margins 0)
             (disable-fullscr))
      (progn (buffer-margins)  ! Defaults margins to width of 3
             (enable-fullscr)) ))



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

* Re: Make fullscreen with margins
  2020-11-21 20:13 Make fullscreen with margins Christopher Dimech
@ 2020-11-22 14:19 ` Michael Heerdegen
  2020-11-22 14:25   ` Christopher Dimech
  0 siblings, 1 reply; 15+ messages in thread
From: Michael Heerdegen @ 2020-11-22 14:19 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> I have the following code for getting to full screen Have made buffer-margins
> that sets a margin on either side of buffer.  Bet I would like that the
> margins are only set when there is only one buffer in the frame.

AFAIU you want a test like (cdr (window-list)).





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

* Re: Make fullscreen with margins
  2020-11-22 14:19 ` Michael Heerdegen
@ 2020-11-22 14:25   ` Christopher Dimech
  2020-11-22 14:34     ` Michael Heerdegen
  0 siblings, 1 reply; 15+ messages in thread
From: Christopher Dimech @ 2020-11-22 14:25 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

I actually used

(if (one-window-p)

Here is the code.  Would you be so kind to comment if this can be improved?


(defun fullscreen-toggle ()
   "Toggles to fullscreen"
   (interactive)
   (if (eq (frame-parameter nil 'fullscreen) 'fullboth)
      (if (one-window-p)
         (progn (margined-buffer 0)
                (disable-fullscreen))
         (disable-fullscreen))
      (if (one-window-p)
         (progn (margined-buffer)
                (enable-fullscreen))
         (enable-fullscreen)) ))



> Sent: Sunday, November 22, 2020 at 3:19 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Make fullscreen with margins
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > I have the following code for getting to full screen Have made buffer-margins
> > that sets a margin on either side of buffer.  Bet I would like that the
> > margins are only set when there is only one buffer in the frame.
>
> AFAIU you want a test like (cdr (window-list)).
>
>
>
>



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

* Re: Make fullscreen with margins
  2020-11-22 14:25   ` Christopher Dimech
@ 2020-11-22 14:34     ` Michael Heerdegen
  2020-11-22 14:45       ` Christopher Dimech
  0 siblings, 1 reply; 15+ messages in thread
From: Michael Heerdegen @ 2020-11-22 14:34 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> I actually used
>
> (if (one-window-p)

Should be ok, yes.

> Here is the code.  Would you be so kind to comment if this can be
> improved?

If you are happy with what it does, and `margined-buffer' is a function
you defined, I think you can use that.

If you intend to distribute your code, your function names should get an
according prefix.  If not, it's still better to use a prefix like "my-"
or so, for the sake that it will later be obvious that that is your own
function.  That will prevent later confusion, for yourself, or if you
post your code etc.

Regards,

Michael.



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

* Re: Make fullscreen with margins
  2020-11-22 14:34     ` Michael Heerdegen
@ 2020-11-22 14:45       ` Christopher Dimech
  2020-11-22 14:58         ` Michael Heerdegen
  0 siblings, 1 reply; 15+ messages in thread
From: Christopher Dimech @ 2020-11-22 14:45 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

> Sent: Sunday, November 22, 2020 at 3:34 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Make fullscreen with margins
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > I actually used
> >
> > (if (one-window-p)
>
> Should be ok, yes.
>
> > Here is the code.  Would you be so kind to comment if this can be
> > improved?
>
> If you are happy with what it does, and `margined-buffer' is a function
> you defined, I think you can use that.

Yes, it is a function I defined.

> If you intend to distribute your code, your function names should get an
> according prefix.  If not, it's still better to use a prefix like "my-"
> or so, for the sake that it will later be obvious that that is your own
> function.  That will prevent later confusion, for yourself, or if you
> post your code etc.

Yes, the code will be good enough for public release. Can you suggest a
package I can check out on the things you mentioned so there won't be
confusion?

> Regards,
>
> Michael.
>
>



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

* Re: Make fullscreen with margins
  2020-11-22 14:45       ` Christopher Dimech
@ 2020-11-22 14:58         ` Michael Heerdegen
  2020-11-22 15:20           ` Christopher Dimech
  2020-11-22 15:28           ` Christopher Dimech
  0 siblings, 2 replies; 15+ messages in thread
From: Michael Heerdegen @ 2020-11-22 14:58 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> Yes, the code will be good enough for public release. Can you suggest a
> package I can check out on the things you mentioned so there won't be
> confusion?

What do you mean?  A package that helps in doing that?

Michael.




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

* Re: Make fullscreen with margins
  2020-11-22 14:58         ` Michael Heerdegen
@ 2020-11-22 15:20           ` Christopher Dimech
  2020-11-22 15:27             ` Michael Heerdegen
  2020-11-22 15:28           ` Christopher Dimech
  1 sibling, 1 reply; 15+ messages in thread
From: Christopher Dimech @ 2020-11-22 15:20 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


> Sent: Sunday, November 22, 2020 at 3:58 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Make fullscreen with margins
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > Yes, the code will be good enough for public release. Can you suggest a
> > package I can check out on the things you mentioned so there won't be
> > confusion?
>
> What do you mean?  A package that helps in doing that?

A proper package with prefix names, that provides good examples
of package structure and coding standards.

> Michael.
>
>
>



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

* Re: Make fullscreen with margins
  2020-11-22 15:20           ` Christopher Dimech
@ 2020-11-22 15:27             ` Michael Heerdegen
  2020-11-22 15:57               ` Jean Louis
  0 siblings, 1 reply; 15+ messages in thread
From: Michael Heerdegen @ 2020-11-22 15:27 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> A proper package with prefix names, that provides good examples
> of package structure and coding standards.

A package normally uses one prefix.  For coding conventions and tips you
definitely want to have a look in the manual: (info "(elisp) Tips").

The packages in the Gnu Elpa repository should all meet the most
important requirements, you could download the repository and have a
look into the packages/ folder.


Regards,

Michael.



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

* Re: Make fullscreen with margins
  2020-11-22 14:58         ` Michael Heerdegen
  2020-11-22 15:20           ` Christopher Dimech
@ 2020-11-22 15:28           ` Christopher Dimech
  2020-11-22 16:02             ` Jean Louis
  2020-11-22 20:54             ` Michael Heerdegen
  1 sibling, 2 replies; 15+ messages in thread
From: Christopher Dimech @ 2020-11-22 15:28 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

I figured that users can use "C-h f" which would give the required
information of the file and package for that call.

Do people not like that?

> Sent: Sunday, November 22, 2020 at 3:58 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Make fullscreen with margins
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > Yes, the code will be good enough for public release. Can you suggest a
> > package I can check out on the things you mentioned so there won't be
> > confusion?
>
> What do you mean?  A package that helps in doing that?
>
> Michael.
>
>
>



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

* Re: Make fullscreen with margins
  2020-11-22 15:27             ` Michael Heerdegen
@ 2020-11-22 15:57               ` Jean Louis
  2020-11-22 20:51                 ` Michael Heerdegen
  0 siblings, 1 reply; 15+ messages in thread
From: Jean Louis @ 2020-11-22 15:57 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Christopher Dimech, help-gnu-emacs

* Michael Heerdegen <michael_heerdegen@web.de> [2020-11-22 18:27]:
> Christopher Dimech <dimech@gmx.com> writes:
> 
> > A proper package with prefix names, that provides good examples
> > of package structure and coding standards.
> 
> A package normally uses one prefix.  For coding conventions and tips you
> definitely want to have a look in the manual: (info "(elisp) Tips").

And is it fine if I have several packages using same prefix?

Jean



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

* Re: Make fullscreen with margins
  2020-11-22 15:28           ` Christopher Dimech
@ 2020-11-22 16:02             ` Jean Louis
  2020-11-22 20:54             ` Michael Heerdegen
  1 sibling, 0 replies; 15+ messages in thread
From: Jean Louis @ 2020-11-22 16:02 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Michael Heerdegen, help-gnu-emacs

* Christopher Dimech <dimech@gmx.com> [2020-11-22 18:30]:
> I figured that users can use "C-h f" which would give the required
> information of the file and package for that call.
> 
> Do people not like that?

That is why Emacs is self-documenting. I use it every day.

Related to prefix for functions:

   • You should choose a short word to distinguish your program from
     other Lisp programs.  The names of all global symbols in your
     program, that is the names of variables, constants, and functions,
     should begin with that chosen prefix.  Separate the prefix from the
     rest of the name with a hyphen, ‘-’.  This practice helps avoid
     name conflicts, since all global variables in Emacs Lisp share the
     same name space, and all functions share another name space(1).
     Use two hyphens to separate prefix and name if the symbol is not
     meant to be used by other packages.

You could simply prefix each function with cd-

I have first defined my own functions like string-empty-p but then
when I make program into package it starts using built-in function of
same name that does not give me same result and all program
breaks. There are 26856 functions in my Emacs and many are similar so
the prefix helps in having distinct function names.

My prefixes are

cf-
rcd-
hyperscope-
wrs-

For example: wrs-publish-pages

-- 
Thanks,
Jean Louis
⎔ λ 🄯 𝍄 𝌡 𝌚



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

* Re: Make fullscreen with margins
  2020-11-22 15:57               ` Jean Louis
@ 2020-11-22 20:51                 ` Michael Heerdegen
  2020-11-24 14:37                   ` Christopher Dimech
  0 siblings, 1 reply; 15+ messages in thread
From: Michael Heerdegen @ 2020-11-22 20:51 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> > A package normally uses one prefix.  For coding conventions and tips you
> > definitely want to have a look in the manual: (info "(elisp) Tips").
>
> And is it fine if I have several packages using same prefix?

If they belong together, I think so, it is lived practice.  Occupying
someone else's prefix is not good of course, maybe unless your package
is an extension.

For several packages sharing one prefix, one can use "sub prefixes" (I
call them so here, there is no official name for that I think), like
"foo-" for the whole ecosystem of related packages, and then
e.g. "foo-evil-" "foo-firefox" or "foo-x" for the packages implementing
certain special features.

Michael.




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

* Re: Make fullscreen with margins
  2020-11-22 15:28           ` Christopher Dimech
  2020-11-22 16:02             ` Jean Louis
@ 2020-11-22 20:54             ` Michael Heerdegen
  1 sibling, 0 replies; 15+ messages in thread
From: Michael Heerdegen @ 2020-11-22 20:54 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> I figured that users can use "C-h f" which would give the required
> information of the file and package for that call.
>
> Do people not like that?

If that's what you had searched for, I had misinterpreted your question.
No, C-h f is perfectly fine.  C-h v and C-h o are similarly important,
and also apropos (C-h a), etc...

Michael.




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

* Re: Make fullscreen with margins
  2020-11-22 20:51                 ` Michael Heerdegen
@ 2020-11-24 14:37                   ` Christopher Dimech
  2020-11-24 15:23                     ` Michael Heerdegen
  0 siblings, 1 reply; 15+ messages in thread
From: Christopher Dimech @ 2020-11-24 14:37 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


> Sent: Sunday, November 22, 2020 at 9:51 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Make fullscreen with margins
>
> Jean Louis <bugs@gnu.support> writes:
>
> > > A package normally uses one prefix.  For coding conventions and tips you
> > > definitely want to have a look in the manual: (info "(elisp) Tips").
> >
> > And is it fine if I have several packages using same prefix?
>
> If they belong together, I think so, it is lived practice.  Occupying
> someone else's prefix is not good of course, maybe unless your package
> is an extension.

Would the prefix be done for all of defun, defvar, defgroup, defcustom?

> For several packages sharing one prefix, one can use "sub prefixes" (I
> call them so here, there is no official name for that I think), like
> "foo-" for the whole ecosystem of related packages, and then
> e.g. "foo-evil-" "foo-firefox" or "foo-x" for the packages implementing
> certain special features.
>
> Michael.
>
>
>



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

* Re: Make fullscreen with margins
  2020-11-24 14:37                   ` Christopher Dimech
@ 2020-11-24 15:23                     ` Michael Heerdegen
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Heerdegen @ 2020-11-24 15:23 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> Would the prefix be done for all of defun, defvar, defgroup, defcustom?

Yes, normally for all definitions, apart from very special cases like
when you are extending some existing thing, e.g. like providing a pcase
macro, Calc functions, adding implementations of existing generic
methods, or so.

Michael.




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

end of thread, other threads:[~2020-11-24 15:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-21 20:13 Make fullscreen with margins Christopher Dimech
2020-11-22 14:19 ` Michael Heerdegen
2020-11-22 14:25   ` Christopher Dimech
2020-11-22 14:34     ` Michael Heerdegen
2020-11-22 14:45       ` Christopher Dimech
2020-11-22 14:58         ` Michael Heerdegen
2020-11-22 15:20           ` Christopher Dimech
2020-11-22 15:27             ` Michael Heerdegen
2020-11-22 15:57               ` Jean Louis
2020-11-22 20:51                 ` Michael Heerdegen
2020-11-24 14:37                   ` Christopher Dimech
2020-11-24 15:23                     ` Michael Heerdegen
2020-11-22 15:28           ` Christopher Dimech
2020-11-22 16:02             ` Jean Louis
2020-11-22 20:54             ` Michael Heerdegen

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.