all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Printing as documentation
@ 2021-06-20  4:41 philip-agee
  2021-06-20  5:54 ` philip-agee
  0 siblings, 1 reply; 9+ messages in thread
From: philip-agee @ 2021-06-20  4:41 UTC (permalink / raw)
  To: help-gnu-emacs


When I wish to see the self documentation I use



C-h f myfunc



I get a temporary help buffer displaying the docstring for myfunc.



Is it possible to to do the same kind of thing when calling a description function "mydesc".

so that the print function are show in a temporary  help buffer?



(defun mydesc ()

"docstring for mydesc"



(print "The brown fox" help)

(print "jumps over the fence" help) )





M-x mydesc



wiil then behave similar to doing



C-h f somefunc 




















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

* Printing as documentation
  2021-06-20  4:41 Printing as documentation philip-agee
@ 2021-06-20  5:54 ` philip-agee
  2021-06-20  6:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-06-20  7:33   ` Christopher Dimech
  0 siblings, 2 replies; 9+ messages in thread
From: philip-agee @ 2021-06-20  5:54 UTC (permalink / raw)
  To: help-gnu-emacs

Have tried the following code, but is giving me > invalid function: "*help*"



(defun myfunc ()
  "todo docstring"
  (interactive)

  (setq bufr (help-buffer))
  (print "test" bufr) )






From: philip-agee@africamel.net
To: help-gnu-emacs@gnu.org
Subject: Printing as documentation
Date: 20/06/2021 06:41:31 Europe/Paris


When I wish to see the self documentation I use

C-h f myfunc

I get a temporary help buffer displaying the docstring for myfunc.

Is it possible to to do the same kind of thing when calling a description function "mydesc".
so that the print function are show in a temporary  help buffer?

(defun mydesc ()
"docstring for mydesc"

(print "The brown fox" help)
(print "jumps over the fence" help) )

M-x mydesc

wiil then behave similar to doing

C-h f somefunc 




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

* Re: Printing as documentation
  2021-06-20  5:54 ` philip-agee
@ 2021-06-20  6:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-06-20  7:33   ` Christopher Dimech
  1 sibling, 0 replies; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-06-20  6:19 UTC (permalink / raw)
  To: help-gnu-emacs

philip-agee wrote:

> Have tried the following code [...]
>
> (defun myfunc ()
>  "todo docstring"
>  (interactive)
>  (setq bufr (help-buffer))
>  (print "test" bufr) )

What, that didn't work? :)

Programming isn't like talking to a person only instead of
a person you talk to a machine! That approach will never work.

It is more like building LEGO. The functions are building
blocks. Check them out what they do one by one and test them
one by one. When you understand enough of them, use some of
themm (them and only them) in combinations... then in time
these combinations become more complex, sometimes.

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




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

* Printing as documentation
  2021-06-20  5:54 ` philip-agee
  2021-06-20  6:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-06-20  7:33   ` Christopher Dimech
  2021-06-20  7:43     ` philip-agee
  1 sibling, 1 reply; 9+ messages in thread
From: Christopher Dimech @ 2021-06-20  7:33 UTC (permalink / raw)
  To: philip-agee; +Cc: help-gnu-emacs

Try using

(defun typex ()
  "todo docstring"
  (interactive)

  (with-help-window (help-buffer)
        (with-current-buffer (help-buffer)
   (print "test"))) )

> Sent: Sunday, June 20, 2021 at 5:54 PM
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
>
> Have tried the following code, but is giving me > invalid function: "*help*"
> 
> 
> 
> (defun myfunc ()
>   "todo docstring"
>   (interactive)
> 
>   (setq bufr (help-buffer))
>   (print "test" bufr) )
> 
> 
> 
> 
> 
> 
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
> Date: 20/06/2021 06:41:31 Europe/Paris
> 
> 
> When I wish to see the self documentation I use
> 
> C-h f myfunc
> 
> I get a temporary help buffer displaying the docstring for myfunc.
> 
> Is it possible to to do the same kind of thing when calling a description function "mydesc".
> so that the print function are show in a temporary  help buffer?
> 
> (defun mydesc ()
> "docstring for mydesc"
> 
> (print "The brown fox" help)
> (print "jumps over the fence" help) )
> 
> M-x mydesc
> 
> wiil then behave similar to doing
> 
> C-h f somefunc 
> 
> 
>



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

* Printing as documentation
  2021-06-20  7:33   ` Christopher Dimech
@ 2021-06-20  7:43     ` philip-agee
  2021-06-20  7:52       ` philip-agee
  0 siblings, 1 reply; 9+ messages in thread
From: philip-agee @ 2021-06-20  7:43 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: help-gnu-emacs

It does work.  I have found 



with-output-to-temp-buffer too.  



In addition to print there is 



insert



Any comments on how to choose between the different commands?  



From: Christopher Dimech <dimech@gmx.com>
To: philip-agee@africamel.net
Subject: Printing as documentation
Date: 20/06/2021 09:33:42 Europe/Paris
Cc: help-gnu-emacs@gnu.org

Try using

(defun typex ()
"todo docstring"
(interactive)

(with-help-window (help-buffer)
(with-current-buffer (help-buffer)
(print "test"))) )

> Sent: Sunday, June 20, 2021 at 5:54 PM
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
>
> Have tried the following code, but is giving me > invalid function: "*help*"
> 
> 
> 
> (defun myfunc ()
>   "todo docstring"
>   (interactive)
> 
>   (setq bufr (help-buffer))
>   (print "test" bufr) )
> 
> 
> 
> 
> 
> 
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
> Date: 20/06/2021 06:41:31 Europe/Paris
> 
> 
> When I wish to see the self documentation I use
> 
> C-h f myfunc
> 
> I get a temporary help buffer displaying the docstring for myfunc.
> 
> Is it possible to to do the same kind of thing when calling a description function "mydesc".
> so that the print function are show in a temporary  help buffer?
> 
> (defun mydesc ()
> "docstring for mydesc"
> 
> (print "The brown fox" help)
> (print "jumps over the fence" help) )
> 
> M-x mydesc
> 
> wiil then behave similar to doing
> 
> C-h f somefunc 
> 
> 
>




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

* Printing as documentation
  2021-06-20  7:43     ` philip-agee
@ 2021-06-20  7:52       ` philip-agee
  2021-06-20 11:53         ` philip-agee
  0 siblings, 1 reply; 9+ messages in thread
From: philip-agee @ 2021-06-20  7:52 UTC (permalink / raw)
  To: philip-agee, Christopher Dimech; +Cc: help-gnu-emacs

I am not sure if the *help* is working correctly because when I press on the Red Cross

to quit or press (q), although the window gets closed, the buffer remains.



From: philip-agee@africamel.net
To: Christopher Dimech <dimech@gmx.com>
Subject: Printing as documentation
Date: 20/06/2021 09:43:32 Europe/Paris
Cc: help-gnu-emacs@gnu.org

It does work.  I have found 

with-output-to-temp-buffer too.  

In addition to print there is 

insert

Any comments on how to choose between the different commands?  


From: Christopher Dimech <dimech@gmx.com>
To: philip-agee@africamel.net
Subject: Printing as documentation
Date: 20/06/2021 09:33:42 Europe/Paris
Cc: help-gnu-emacs@gnu.org

Try using

(defun typex ()
"todo docstring"
(interactive)

(with-help-window (help-buffer)
(with-current-buffer (help-buffer)
(print "test"))) )

> Sent: Sunday, June 20, 2021 at 5:54 PM
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
>
> Have tried the following code, but is giving me > invalid function: "*help*"
> 
> 
> 
> (defun myfunc ()
>   "todo docstring"
>   (interactive)
> 
>   (setq bufr (help-buffer))
>   (print "test" bufr) )
> 
> 
> 
> 
> 
> 
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
> Date: 20/06/2021 06:41:31 Europe/Paris
> 
> 
> When I wish to see the self documentation I use
> 
> C-h f myfunc
> 
> I get a temporary help buffer displaying the docstring for myfunc.
> 
> Is it possible to to do the same kind of thing when calling a description function "mydesc".
> so that the print function are show in a temporary  help buffer?
> 
> (defun mydesc ()
> "docstring for mydesc"
> 
> (print "The brown fox" help)
> (print "jumps over the fence" help) )
> 
> M-x mydesc
> 
> wiil then behave similar to doing
> 
> C-h f somefunc 
> 
> 
>





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

* Printing as documentation
  2021-06-20  7:52       ` philip-agee
@ 2021-06-20 11:53         ` philip-agee
  2021-06-20 12:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 9+ messages in thread
From: philip-agee @ 2021-06-20 11:53 UTC (permalink / raw)
  To: philip-agee, Christopher Dimech; +Cc: help-gnu-emacs

I am really wondering about the utility of the two functions below, which seem

to be doing the same thing, at least from my perspective. 



-------



(defun brief ()
  "todo docstring"
  (interactive)

  (with-help-window (help-buffer)
        (with-current-buffer (help-buffer)
   (print "brief")))   )



-------



(defun detail ()
  "todo docstring"
  (interactive)

  (with-output-to-temp-buffer (help-buffer)
        (with-current-buffer (help-buffer)
   (print "detail")))   )

-------



From: philip-agee@africamel.net
To: philip-agee@africamel.net;
   Christopher Dimech <dimech@gmx.com>
Subject: Printing as documentation
Date: 20/06/2021 09:52:59 Europe/Paris
Cc: help-gnu-emacs@gnu.org

I am not sure if the *help* is working correctly because when I press on the Red Cross

to quit or press (q), although the window gets closed, the buffer remains.



From: philip-agee@africamel.net
To: Christopher Dimech <dimech@gmx.com>
Subject: Printing as documentation
Date: 20/06/2021 09:43:32 Europe/Paris
Cc: help-gnu-emacs@gnu.org

It does work.  I have found 

with-output-to-temp-buffer too.  

In addition to print there is 

insert

Any comments on how to choose between the different commands?  


From: Christopher Dimech <dimech@gmx.com>
To: philip-agee@africamel.net
Subject: Printing as documentation
Date: 20/06/2021 09:33:42 Europe/Paris
Cc: help-gnu-emacs@gnu.org

Try using

(defun typex ()
"todo docstring"
(interactive)

(with-help-window (help-buffer)
(with-current-buffer (help-buffer)
(print "test"))) )

> Sent: Sunday, June 20, 2021 at 5:54 PM
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
>
> Have tried the following code, but is giving me > invalid function: "*help*"
> 
> 
> 
> (defun myfunc ()
>   "todo docstring"
>   (interactive)
> 
>   (setq bufr (help-buffer))
>   (print "test" bufr) )
> 
> 
> 
> 
> 
> 
> From: philip-agee@africamel.net
> To: help-gnu-emacs@gnu.org
> Subject: Printing as documentation
> Date: 20/06/2021 06:41:31 Europe/Paris
> 
> 
> When I wish to see the self documentation I use
> 
> C-h f myfunc
> 
> I get a temporary help buffer displaying the docstring for myfunc.
> 
> Is it possible to to do the same kind of thing when calling a description function "mydesc".
> so that the print function are show in a temporary  help buffer?
> 
> (defun mydesc ()
> "docstring for mydesc"
> 
> (print "The brown fox" help)
> (print "jumps over the fence" help) )
> 
> M-x mydesc
> 
> wiil then behave similar to doing
> 
> C-h f somefunc 
> 
> 
>






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

* Re: Printing as documentation
  2021-06-20 11:53         ` philip-agee
@ 2021-06-20 12:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-06-20 22:11             ` philip-agee
  0 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-06-20 12:34 UTC (permalink / raw)
  To: help-gnu-emacs

philip-agee wrote:

> I am really wondering about the utility of the two functions
> below, which seem
>
> to be doing the same thing, at least from my perspective.

Examine what the _individual functions_ are doing.

You should be able to answer like this for every line of code
you ever write: "at line n, I use function X with args
Y because I want to accomplish Z".

This is how you know what your code does - knowing the
individual building blocks - not bunching together functions
like you do, from other planets, almost, then comparing the
"result" to another piece of code, written in the same style!

That method doesn't work and it will never work.

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




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

* Printing as documentation
  2021-06-20 12:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-06-20 22:11             ` philip-agee
  0 siblings, 0 replies; 9+ messages in thread
From: philip-agee @ 2021-06-20 22:11 UTC (permalink / raw)
  To: moasenwood, help-gnu-emacs

I would like to display text in the help window without it being selected



The following achieves that.



  (with-help-window (help-buffer)
    (with-current-buffer (help-buffer)
      (print "test"))) )



Would I need   (with-current-buffer (help-buffer) actually?




From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Printing as documentation
Date: 20/06/2021 14:34:14 Europe/Paris

philip-agee wrote:

> I am really wondering about the utility of the two functions
> below, which seem
>
> to be doing the same thing, at least from my perspective.

Examine what the _individual functions_ are doing.

You should be able to answer like this for every line of code
you ever write: "at line n, I use function X with args
Y because I want to accomplish Z".

This is how you know what your code does - knowing the
individual building blocks - not bunching together functions
like you do, from other planets, almost, then comparing the
"result" to another piece of code, written in the same style!

That method doesn't work and it will never work.

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





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

end of thread, other threads:[~2021-06-20 22:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-20  4:41 Printing as documentation philip-agee
2021-06-20  5:54 ` philip-agee
2021-06-20  6:19   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-20  7:33   ` Christopher Dimech
2021-06-20  7:43     ` philip-agee
2021-06-20  7:52       ` philip-agee
2021-06-20 11:53         ` philip-agee
2021-06-20 12:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-20 22:11             ` philip-agee

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.