all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Output in Emacs
@ 2003-11-02 19:15 Dirk Joos
  2003-11-02 19:26 ` Edi Weitz
  2003-11-02 19:32 ` Edward Dodge
  0 siblings, 2 replies; 9+ messages in thread
From: Dirk Joos @ 2003-11-02 19:15 UTC (permalink / raw)


Hi,

I'm working with GNU-Emacs and I want to know how I can print the 
content of a variable in the current buffer of emacs. What is the command?

Here an example:

(defun zahl()
(interactive)
(let ( (k 1) )
;at this place I want to print the content
;of the variable k in the actual buffer at the current
;cursorposition. In emacs the result should be 1 on the screen
)
)

This is just an example. I just want to know how I can print the content 
of a variable on the screen.

Thank you very much

Dirk

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

* Re: Output in Emacs
  2003-11-02 19:15 Output in Emacs Dirk Joos
@ 2003-11-02 19:26 ` Edi Weitz
  2003-11-03 22:01   ` Johannes Quint
  2003-11-06 21:24   ` LEE Sau Dan
  2003-11-02 19:32 ` Edward Dodge
  1 sibling, 2 replies; 9+ messages in thread
From: Edi Weitz @ 2003-11-02 19:26 UTC (permalink / raw)


On Sun, 02 Nov 2003 20:15:45 +0100, Dirk Joos <dirkjoos@t-online.de> wrote:

> I'm working with GNU-Emacs and I want to know how I can print the
> content of a variable in the current buffer of emacs. What is the
> command?
>
> Here an example:
>
> (defun zahl()
> (interactive)
> (let ( (k 1) )
> ;at this place I want to print the content
> ;of the variable k in the actual buffer at the current
> ;cursorposition. In emacs the result should be 1 on the screen
> )
> )

I think you're looking for 'insert':

  (defun foo ()
    (interactive)
    (let ((k 1))
      (insert (format "%d" k))))

You should adhere to the usual conventions for intending Lisp
code. This'll help other people to read it.

Edi.

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

* Re: Output in Emacs
  2003-11-02 19:15 Output in Emacs Dirk Joos
  2003-11-02 19:26 ` Edi Weitz
@ 2003-11-02 19:32 ` Edward Dodge
  1 sibling, 0 replies; 9+ messages in thread
From: Edward Dodge @ 2003-11-02 19:32 UTC (permalink / raw)


Dirk Joos <dirkjoos@t-online.de> writes:

> Hi,
>
> I'm working with GNU-Emacs and I want to know how I can print the
> content of a variable in the current buffer of emacs. What is the
> command?
>
> Here an example:
>
> (defun zahl()
> (interactive)
> (let ( (k 1) )
> ;at this place I want to print the content
> ;of the variable k in the actual buffer at the current
> ;cursorposition. In emacs the result should be 1 on the screen
> )
> )
>
> This is just an example. I just want to know how I can print the
> content of a variable on the screen.
>
> Thank you very much

C-u M-: fill-column  <enter>


-- 
Edward Dodge

/GNU Emacs 21.3.50.1 (powerpc-apple-darwin5.5) of 2002-10-11 on G3/

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

* Re: Output in Emacs
  2003-11-02 19:26 ` Edi Weitz
@ 2003-11-03 22:01   ` Johannes Quint
  2003-11-06 21:24   ` LEE Sau Dan
  1 sibling, 0 replies; 9+ messages in thread
From: Johannes Quint @ 2003-11-03 22:01 UTC (permalink / raw)



On Sonntag, November 2, 2003, at 08:26  Uhr, Edi Weitz wrote:

> I think you're looking for 'insert':
>
>   (defun foo ()
>     (interactive)
>     (let ((k 1))
>       (insert (format "%d" k))))
>
> You should adhere to the usual conventions for intending Lisp
> code. This'll help other people to read it.
>
> Edi.
>


and how to READ the contents of a buffer-line and then apply a function 
to it?
thanks for help
j.quint

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

* Re: Output in Emacs
       [not found] <mailman.3057.1067896989.21628.help-gnu-emacs@gnu.org>
@ 2003-11-03 22:25 ` Barry Margolin
  2003-11-03 23:36   ` Johan Bockgård
  2003-11-03 23:38   ` Kevin Rodgers
  0 siblings, 2 replies; 9+ messages in thread
From: Barry Margolin @ 2003-11-03 22:25 UTC (permalink / raw)


In article <mailman.3057.1067896989.21628.help-gnu-emacs@gnu.org>,
Johannes Quint  <johannes.quint@web.de> wrote:
>and how to READ the contents of a buffer-line and then apply a function 
>to it?

(defun apply-function-to-current-line (func)
  (let ((string
	  (save-excursion
	    (beginning-of-line)
	    (let ((start (point)))
	      (end-of-line)
	      (buffer-substring start (point))))))
    (funcall func string)))

-- 
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

* Re: Output in Emacs
  2003-11-03 22:25 ` Barry Margolin
@ 2003-11-03 23:36   ` Johan Bockgård
  2003-11-03 23:38   ` Kevin Rodgers
  1 sibling, 0 replies; 9+ messages in thread
From: Johan Bockgård @ 2003-11-03 23:36 UTC (permalink / raw)


Barry Margolin <barry.margolin@level3.com> writes:

> 	  (save-excursion
> 	    (beginning-of-line)
> 	    (let ((start (point)))
> 	      (end-of-line)
> 	      (buffer-substring start (point))))

(buffer-substring (line-beginning-position) (line-end-position))

-- 
Johan Bockgård

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

* Re: Output in Emacs
  2003-11-03 22:25 ` Barry Margolin
  2003-11-03 23:36   ` Johan Bockgård
@ 2003-11-03 23:38   ` Kevin Rodgers
  1 sibling, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2003-11-03 23:38 UTC (permalink / raw)


Barry Margolin wrote:

> (defun apply-function-to-current-line (func)
>   (let ((string
> 	  (save-excursion
> 	    (beginning-of-line)
> 	    (let ((start (point)))
> 	      (end-of-line)
> 	      (buffer-substring start (point))))))
>     (funcall func string)))

It's even easier now:


(funcall func (buffer-substring (line-beginning-position) (line-end-position)))

-- 
Kevin Rodgers

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

* Re: Output in Emacs
  2003-11-02 19:26 ` Edi Weitz
  2003-11-03 22:01   ` Johannes Quint
@ 2003-11-06 21:24   ` LEE Sau Dan
  2003-11-08  0:00     ` Michael M Mason
  1 sibling, 1 reply; 9+ messages in thread
From: LEE Sau Dan @ 2003-11-06 21:24 UTC (permalink / raw)


>>>>> "Edi" == Edi Weitz <edi@agharta.de> writes:

    Edi> On Sun, 02 Nov 2003 20:15:45 퍝, Dirk Joos
    Edi> <dirkjoos@t-online.de> wrote:
...

    Edi> You should adhere to the usual conventions for intending Lisp
........................................................^^^^^^^^^
    Edi> code. This'll help other people to read it.

"indenting", not "intending".  :)


-- 
Lee Sau Dan                     李守敦(Big5)                    ~{@nJX6X~}(HZ) 

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee

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

* Re: Output in Emacs
  2003-11-06 21:24   ` LEE Sau Dan
@ 2003-11-08  0:00     ` Michael M Mason
  0 siblings, 0 replies; 9+ messages in thread
From: Michael M Mason @ 2003-11-08  0:00 UTC (permalink / raw)


On 06 Nov 2003 22:24:03 +0100, LEE Sau Dan
<danlee@informatik.uni-freiburg.de> wrote:

>>>>>> "Edi" == Edi Weitz <edi@agharta.de> writes:
>
>    Edi> You should adhere to the usual conventions for intending Lisp
>........................................................^^^^^^^^^
>    Edi> code. This'll help other people to read it.
>
>"indenting", not "intending".  :)

...unless you're using the *Scratch* buffer...

-- 
Michael

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

end of thread, other threads:[~2003-11-08  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-02 19:15 Output in Emacs Dirk Joos
2003-11-02 19:26 ` Edi Weitz
2003-11-03 22:01   ` Johannes Quint
2003-11-06 21:24   ` LEE Sau Dan
2003-11-08  0:00     ` Michael M Mason
2003-11-02 19:32 ` Edward Dodge
     [not found] <mailman.3057.1067896989.21628.help-gnu-emacs@gnu.org>
2003-11-03 22:25 ` Barry Margolin
2003-11-03 23:36   ` Johan Bockgård
2003-11-03 23:38   ` Kevin Rodgers

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.