Problems with Net::POP


(Austin Ziegler) #1

I am having problems with ruby 1.6.6 and Net::POP.

require ‘net/pop’

pop = Net::POP3.new(‘pop-server’)
pop.start(‘user’, ‘secret’)

pop.each do |msg|
print msg.top(1)
msg.delete!
end

The above code does NOT delete the messages as it should
(msg.delete!).

This is the case on both Linux and Win32. I can update the Linux
version easily; I’m not as comfortable updating the Win32 version
because of the wide variety of versions available. When there’s a
single-installer of a later version of Ruby available, I’ll happily
upgrade that one.

-austin
– Austin Ziegler, austin@halostatue.ca on 2002.07.01 at 23.50.26


(WATANABE Hirofumi) #2

Hi,

Austin Ziegler austin@halostatue.ca writes:

:I am having problems with ruby 1.6.6 and Net::POP.
:
:require ‘net/pop’
:
:pop = Net::POP3.new(‘pop-server’)
:pop.start(‘user’, ‘secret’)
:
:pop.each do |msg|
: print msg.top(1)
: msg.delete!
:end
:
:The above code does NOT delete the messages as it should
:(msg.delete!).

You should call POP3#finish, or call POP3.start with block.

require ‘net/pop’

Net::POP3.start(‘pop-server’, 110, ‘user’, ‘secret’) do |pop|
pop.each do |msg|
print msg.top(1)
msg.delete!
end
end

For details, see http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb?key=pop+quit+delete&cginame=namazu.rb&submit=Search&dbname=ruby-talk&max=50&whence=0

···


eban


(Daniel) #3

Hi,

I’ve browsed around somewhat but have been unable to find a repository
where all the package available for imports etc are. Does ruby feature
something like Perl’s CPAN? How is package submission controlled? i.e. can
just anyone submit packages?

db


(Guillermo Fernandez) #4

Hi!

I’m trying to start in Ruby and I face two problems:

1- xemacs: I’ve tried to install ruby-mode.el, and I have searched
Internet to find a solution, but I’m unable to make it work… and it’s
a little bit of a pain not having it! :slight_smile:

2- Documentation: I have find the Ruby 1.4 Reference Manual, but I’m
unable to find the 1.6 equivalent…

Could someone give me a hand or send me some links that would help me
solving my problems?

Thanks!

Guille


(ts) #5

I've browsed around somewhat but have been unable to find a repository
where all the package available for imports etc are. Does ruby feature

http://www.ruby-lang.org/en/raa.html

something like Perl's CPAN? How is package submission controlled? i.e. can
just anyone submit packages?

See the link "add new entry"

Guy Decoux


(Massimiliano Mirra) #6

Have a look at http://www.allruby.com/rpkg. You can also browse the
repository and download packages from the web from
http://www.allruby.com/descriptions/index.html, though you’ll have
much more control from the command line.

The tool is under development and the repository is still small
compared to the RAA. However, packaging modules is very easy and I
expect their number to grow – if because of nothing else, because I’m
making packages for about every ruby thing I install on my machine
just to keep the situation under control. :wink:

Massimiliano

···

On Thu, Jul 04, 2002 at 02:06:53AM +0900, Daniel wrote:

I’ve browsed around somewhat but have been unable to find a repository
where all the package available for imports etc are. Does ruby feature
something like Perl’s CPAN? How is package submission controlled? i.e. can
just anyone submit packages?


(Dave Thomas) #7

Guillermo Fernandez guillermo.fernandez@epfl.ch writes:

1- xemacs: I’ve tried to install ruby-mode.el, and I have searched
Internet to find a solution, but I’m unable to make it work… and it’s
a little bit of a pain not having it! :slight_smile:

If your problem is that font-lock isn’t working, then you need to add

(load “font-lock”)

at the start of your .emacs.

2- Documentation: I have find the Ruby 1.4 Reference Manual, but I’m
unable to find the 1.6 equivalent…

You could look at www.rubycentral.com/book - there’s a reference
chapter and an online module/class reference. The latter is also
available at the command prompt using the ‘ri’ utility (see the RAA).

Cheers

Dave


(Daniel) #8

Thanks, I had seen this link. It seemed to me upon glance that it’s not a
collection of packages only, but lots of misc programs. Is that true? Is
there any organization to this?

db

···

On Thu, 4 Jul 2002, ts wrote:

I’ve browsed around somewhat but have been unable to find a repository
where all the package available for imports etc are. Does ruby feature

http://www.ruby-lang.org/en/raa.html

something like Perl’s CPAN? How is package submission controlled? i.e. can
just anyone submit packages?

See the link “add new entry”

Guy Decoux


“First things first – but not necessarily in that order”
– The Doctor, “Doctor Who”


(SER) #9

ts wrote:

I’ve browsed around somewhat but have been unable to find a repository
where all the package available for imports etc are. Does ruby feature

http://www.ruby-lang.org/en/raa.html

There’s also a burgeoning project called ‘rpkg’, which is a distribution
architecture similar to Debian’s. It is (IMHO) vastly superior to CPAN,
which gives me ulcers.

The rpkg repository isn’t as rich as RAA, although it is much easier to use.

···

… Computers let you make More mistakes faster than any other invention
<|> in human history, with the possible exception of handguns and
/|\ tequila.
/| – Mitch Radcliffe


(Rich Kilmer) #10

Actually, the link is:

http://www.allruby.com/rpkg/descriptions/index.html

Regards,

Rich

From: Massimiliano Mirra [mailto:list@NOSPAMchromatic-harp.com]
Sent: Wednesday, July 03, 2002 6:36 PM
To: ruby-talk ML
Subject: Re: packages

I’ve browsed around somewhat but have been unable to find a
repository

where all the package available for imports etc are. Does ruby
feature

something like Perl’s CPAN? How is package submission controlled?
i.e.

···

-----Original Message-----
On Thu, Jul 04, 2002 at 02:06:53AM +0900, Daniel wrote:
can

just anyone submit packages?

Have a look at http://www.allruby.com/rpkg. You can also browse the
repository and download packages from the web from
http://www.allruby.com/descriptions/index.html, though you’ll have
much more control from the command line.

The tool is under development and the repository is still small
compared to the RAA. However, packaging modules is very easy and I
expect their number to grow – if because of nothing else, because I’m
making packages for about every ruby thing I install on my machine
just to keep the situation under control. :wink:

Massimiliano


(Guillermo Fernandez) #11

1- xemacs: I’ve tried to install ruby-mode.el, and I have searched
Internet to find a solution, but I’m unable to make it work… and it’s
a little bit of a pain not having it! :slight_smile:
If your problem is that font-lock isn’t working, then you need to add
(load “font-lock”)
at the start of your .emacs.
Thank you fo rthe answer.

I tried and it does not seem to work.

Actually, my problem is that I’m not able to use neither the indentation
neither the color of the source code (Yes, I have set the
"Options->Syntax Highlighting->In this buffer" option).
I tried to put the ruby-mode.el in the path of xemacs, and I have added
(require 'ruby-mode) both in my .emacs and .xemacs-custom but it seems
not to work. Have I missed a point in the ruby-mode.el installation? I
searched the web for a general way of installing the *.el files, but I
did not find any result…

Thanks!

Guille


(Dave Thomas) #12

Guillermo Fernandez guillermo.fernandez@epfl.ch writes:

1- xemacs: I’ve tried to install ruby-mode.el, and I have searched
Internet to find a solution, but I’m unable to make it work… and it’s
a little bit of a pain not having it! :slight_smile:
If your problem is that font-lock isn’t working, then you need to add
(load “font-lock”)
at the start of your .emacs.
Thank you fo rthe answer.

I tried and it does not seem to work.

Actually, my problem is that I’m not able to use neither the indentation
neither the color of the source code (Yes, I have set the
"Options->Syntax Highlighting->In this buffer" option).
I tried to put the ruby-mode.el in the path of xemacs, and I have added
(require 'ruby-mode) both in my .emacs and .xemacs-custom but it seems
not to work. Have I missed a point in the ruby-mode.el installation? I
searched the web for a general way of installing the *.el files, but I
did not find any result…

Try putting the following in your .emacs too:

(autoload 'ruby-mode "ruby-mode"
  "Mode for editing ruby source files" t)
(setq auto-mode-alist
   (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))

The first two lines tell emacs the name of the file that implements
ruby-mode, and the second two tells it to invoke ruby-mode on .rb
files.

Cheers

Dave


(Jean-Hugues ROBERT) #13

Hello,

I have had a hard time using ruby-mode.el, but that was my first
exposure to XEmacs, so…

1- xemacs: I’ve tried to install ruby-mode.el, and I have searched
Internet to find a solution, but I’m unable to make it work… and it’s
a little bit of a pain not having it! :slight_smile:
If your problem is that font-lock isn’t working, then you need to add
(load “font-lock”)
at the start of your .emacs.
Thank you fo rthe answer.

I tried and it does not seem to work.

Actually, my problem is that I’m not able to use neither the indentation
neither the color of the source code (Yes, I have set the
"Options->Syntax Highlighting->In this buffer" option).
I tried to put the ruby-mode.el in the path of xemacs, and I have added
(require 'ruby-mode) both in my .emacs and .xemacs-custom but it seems
not to work. Have I missed a point in the ruby-mode.el installation? I
searched the web for a general way of installing the *.el files, but I
did not find any result…

Thanks!

Guille

I put some *.el file in my .xemacs directory, and then I set the
load path:

(setq load-path (cons (expand-file-name “~/.xemacs/”) load-path))

; This one may or may not be necessary (it is not for me)
;(load “font-lock”)

Then I autoload the ruby mode:
(autoload 'ruby-mode “ruby-mode”
“Mode for editing ruby source files”)
(setq auto-mode-alist
(append '(("\.rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '((“ruby” . ruby-mode))
interpreter-mode-alist))

Then I added this… but I am not sure about what it does, maybe
it set the font mode automatically when in ruby mode:
(add-hook 'ruby-mode-hook 'font-lock-fontify-buffer)

And also this… so that I can manually force a syntax highlighting:
;Brian Marick, marick@testing.com
(global-set-key “^z” 'font-lock-fontify-buffer)

Overall, I end up trying to disable the automatic fontifying and
activate it manually only, when I need it. I did that because it
is slow on large file (1000 lines or so).

Unfortunately I still have some intrusive “rescanning…” occurring
from time to time. For large files, this is inconvenient because the
UI is freezed during that rescanning.

Hope this helps. If you manage to setup a better solution, please
tell about it.

Yours,

Jean-Hugues

P.S. Here is my full .xemacs/custom.el, some stuff work, some
don’t.

(custom-set-variables
’(mwheel-scroll-amount (quote (10 . 1)))
’(toolbar-info-use-separate-frame nil)
’(require-final-newline (quote ask))
’(font-lock-auto-fontify nil)
’(modeline-click-swaps-buffers t)
’(lazy-shot-verbose nil)
’(mwheel-follow-mouse t)
’(paren-mode (quote paren) nil (paren))
’(font-lock-maximum-decoration t)
’(lazy-lock-stealth-time 5)
’(buffers-tab-sort-function (quote jhr-sort-buffer-alpha))
’(comint-scroll-to-bottom-on-output (quote all))
’(comment-start “#”)
’(buffers-menu-submenus-for-groups-p nil)
’(buffers-menu-max-size nil)
’(font-lock-use-colors t)
’(default-toolbar-position (quote left))
’(lazy-lock-mode nil nil (lazy-lock))
’(fast-lock-mode nil nil (fast-lock))
’(font-lock-use-fonts nil)
’(grep-command “fgrep -n “)
’(lazy-shot-stealth-verbose nil)
’(bar-cursor 2)
’(comment-start-skip “#.*”)
’(buffers-tab-max-size nil)
’(lazy-shot-stealth-time 5)
’(fold-allow-overlays t)
’(paren-delay 1.0)
’(menu-accelerator-enabled nil t)
’(truncate-lines t)
’(comint-scroll-to-bottom-on-input (quote all))
’(default-gutter-position (quote top))
’(fume-rescanning-message “Re-Scanning buffer…”)
’(dabbrev-check-all-buffers nil)
’(stack-trace-on-error nil)
’(hs-hide-comments-when-hiding-all nil)
’(mouse-yank-at-point t)
’(gnuserv-frame t)
’(complex-buffers-menu-p nil)
’(user-mail-address "jean_hugues_robert@yahoo.com”)
’(speedbar-track-mouse-flag t)
’(query-user-mail-address nil)
’(indent-tabs-mode nil)
’(comint-buffer-maximum-size 4000)
’(hs-isearch-open t)
’(modeline-scrolling-method (quote scrollbar)))
(custom-set-faces
’(font-lock-string-face ((((class color) (background light)) (:foreground
"DarkYellow”))))
’(font-lock-reference-face ((((class color) (background light))
(:foreground “DarkBlue”))))
’(font-lock-variable-name-face ((((class color) (background light))
(:foreground “brown”))))
’(font-lock-keyword-face ((((class color) (background light) (type
mswindows)) (:foreground “gray25” :bold t))))
’(font-lock-function-name-face ((((class color) (background light) (type
mswindows)) (:foreground “red” :bold t :underline t)))))

;;; JHR Stuff
(setq load-path (cons (expand-file-name “~/.xemacs/”) load-path))

(defun jhr-sort-buffer-alpha ( a_list )
“Sort a list of buffers”
(sort a_list
(function (lambda (buffer-1 buffer-2)
(string-lessp (buffer-name buffer-1) (buffer-name buffer-2))
))
)
)

; This one may not be necessary at all
;(load “font-lock”)

(autoload 'ruby-mode “ruby-mode”
“Mode for editing ruby source files”)
(setq auto-mode-alist
(append '(("\.rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '((“ruby” . ruby-mode))
interpreter-mode-alist))

(add-hook 'ruby-mode-hook 'font-lock-fontify-buffer)

(autoload 'run-ruby “inf-ruby”
“Run an inferior Ruby process”)
(autoload 'inf-ruby-keys “inf-ruby”
“Set local key defs for inf-ruby in ruby-mode”)
(add-hook ‘ruby-mode-hook
’(lambda ()
(inf-ruby-keys)
(define-key ruby-mode-map “\C-c\C-l” 'ruby-load-current-buffer)
))

;; From Nobu Nakata:
;;(setq font-lock-mode-enable-list
;; (append '(ruby-mode) font-lock-mode-enable-list))

;; Need to look at
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/37476

;; From http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/16897
(defun ruby-visit-source ()
“If the current line contains text like ‘…/src/program.rb:34’, visit
that file in the other window and position point on that line.”
(interactive)
(let* ((start-boundary (save-excursion (beginning-of-line) (point)))
(regexp (concat “\([ \t\n\r”’([<{]\|^\)" ; non file chars or
; effective
; beginning of file
"\(.+\.rb\):\([0-9]+\)")) ; file.rb:NNN
(matchp (save-excursion
(end-of-line)
;; if two matches on line, the second is most likely
;; to be useful, so search backward.
(re-search-backward regexp start-boundary t))))
(cond (matchp
(let ((file (buffer-substring (match-beginning 2)
(match-end 2)))
(line (buffer-substring (match-beginning 3)
(match-end 3))))
; Windows: Find-file doesn’t seem to work with Cygwin
; /// format or the odd /cygdrive// format
(if (or (string-match “//\(.\)\(.\)" file)
(string-match "/cygdrive/\(.\)\(.
\)” file))
(setq file
(concat (substring file
(match-beginning 1)
(match-end 1))
":"
(substring file
(match-beginning 2)
(match-end 2)))))

          (find-file-other-window file)
          (goto-line (string-to-int line))))
       (t
        (error "No ruby location on line.")))))

;; I bind the above to ^h^h, an odd choice, because that’s easy to
;; type after reaching the line with ^p or ^n.
(global-set-key “\C-e” 'ruby-visit-source)

; ToDo: About Folding: Investigatge hs-special-modes-alist
;(pushnew '(ruby-mode “module” “end”)
; hs-special-modes-alist :test 'equal)
;(pushnew '(ruby-mode “class” “end”)
; hs-special-modes-alist :test 'equal)
;(pushnew '(ruby-mode “def” “end” function-name)
; hs-special-modes-alist :test 'equal)
;(pushnew '(ruby-mode “if” “end”)
; hs-special-modes-alist :test 'equal)
;(pushnew '(ruby-mode “begin” “end”)
; hs-special-modes-alist :test 'equal)
;(pushnew '(ruby-mode “do” “end”)
; hs-special-modes-alist :test 'equal)

; This works with ID: hideshow.el,v 5.31 2001/08/27 22:18:17 ttn Rel
(require 'hideshow)
(let ((ruby-mode-hs-info '(
ruby-mode
"class\|module\|def\|if\|unless\|case\|while\|until\|for\|begin\|do"
“end”
"#"
ruby-move-to-block
nil
)
))
(if (not (member ruby-mode-hs-info hs-special-modes-alist))
(setq hs-special-modes-alist
(cons ruby-mode-hs-info hs-special-modes-alist)))
)
;(add-hook 'ruby-mode-hook
; '(lambda () (hs-minor-mode 1)))
;(add-hook 'ruby-mode-hook 'hs-minor-mode)
; (defun ttn-hs-hide-level-1 ()
; (hs-hide-level 1)
; (forward-sexp 1))
; (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1)
;(setq hs-hide-all-non-comment-function nil)

; Ruby friendly outline
(setq outline-regexp “mo\|cl\|…d\|…d”)

(defun ruby-load-current-buffer ()
“Load current buffer’s Ruby file into the inferior Ruby process.
Saving it first if needed.”
(interactive)
(let (
(buffer (current-buffer))
(proc (ruby-proc))
)
(or (eq major-mode ‘ruby-mode)
(error “Not ruby mode”))
(save-buffer buffer)
(switch-to-ruby t)
(comint-send-string
proc
(concat “(load '” (buffer-file-name buffer) "’)\n")
)
)
)
(add-hook 'inf-ruby-load-hook
(function (lambda ()
(define-key ruby-mode-map “\C-c\C-l” 'ruby-load-current-buffer)
))
)

; Get a more Windows like Look&Feel
(load-library “cua-mode.elc”)
(CUA-mode t)
;(transient-mark-mode t)
(delete-selection-mode t)

;Brian Marick, marick@testing.com
(global-set-key “^z” 'font-lock-fontify-buffer)

;; Speedbar
(require 'speedbar)
(add-menu-button '(“Tools”)
[“Speedbar” speedbar-frame-mode
:style toggle
:selected (and (boundp 'speedbar-frame)
(frame-live-p speedbar-frame)
(frame-visible-p speedbar-frame))]
"–")

; Save open files and restore them when restarted
(load “desktop.el”)
(desktop-load-default)
(desktop-read)
; init it with: (desktop-save “.”)

···

At 10:05 03/07/2002 +0900, you wrote:


Web: http://hdl.handle.net/1030.37/1.1
Phone: +33 (0) 4 92 27 74 17