Samuel Wales | 1 Feb 2009 02:30
Picon

Re: What completion mechanisms are you using?

Trying ido's flex matching is one of those experiences where
everything suddenly becomes an order of magnitude easier.

Hey, does the .invalid thing really deter spammers?

--

-- 
For personal and corporate gain, myalgic encephalomyelitis denialists
are knowingly causing massive suffering and 25-years-early death by
grossly corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

Joe Fineman | 1 Feb 2009 02:18
Picon

Re: copy-line

Helmut Eller <eller.helmut <at> gmail.com> writes:

> is there a command (and standard key) to copy the current line?  The
> command should duplicate the text of the current line and move point
> to the copied line.  I think that vi has something like that, and
> occasionally it would be quite useful.
>
> I can write that myself but maybe Emacs has something already and I
> don't know it?  It's also a bit hard to find a free key :-)

I have been using the following kluge extensively for a long time.  I
mainly use it in tables, but it is also useful for duplicating a line
that contains no tabs:

(defun ditto ()
  "In a table, duplicate the entry above."
  (interactive)
  (let ((track-eol) (goal-column (current-column)))
    (skip-chars-backward "^\t\n")
    (setq newplace (point-marker))
    (previous-line 1)
    (setq oldplace (point-marker))
    (skip-chars-forward "^\t\n")
    (setq entry (buffer-substring oldplace (point)))
    (goto-char newplace)
    (skip-chars-forward "^\t\n")
    (delete-region newplace (point))
    (set-mark (point))
    (insert entry)
    )
(Continue reading)

Samuel Wales | 1 Feb 2009 03:06
Picon

Re: copy-line

(defun alpha-open-line-entire (&optional arg)
  "Open a line above.  If there is a prefix argument of just C-u,
then repeat the line.  If there are two, repeat and comment.  If
there is a natural numeric argument, repeat that many lines."
  (interactive "*P")
  (if arg
      (progn
        (repeat-line (if (consp arg) 1 (prefix-numeric-value arg)))
        ;;put a commented line in front of the line
        (when (= (car arg) 16)
          (comment-region (point-at-bol) (point-at-eol))
          ;;this misplaces point, but cannot be fixed without
          ;;knowing whether ;;; or ;; or #.
          (next-line)
          '(back-to-indentation)))
    (progn
      (beginning-of-line)
      ;;2004-01-30 open-line just went awol, acting like yank
      ;;(open-line 1)
      (newline 1)
      (forward-line -1)
      (unless (bobp)
	;;(let ((indent-line-function 'alpha-indent-to-next-indentation))
	(indent-according-to-mode)))))

On Sat, Jan 31, 2009 at 11:26, Helmut Eller <eller.helmut <at> gmail.com> wrote:
> Hello,
>
> is there a command (and standard key) to copy the current line?  The
> command should duplicate the text of the current line and move point to
(Continue reading)

Andy Stewart | 1 Feb 2009 03:09
Picon

Re: copy-line

Hi,

Below are my code:

------------------------------> Code start <------------------------------
(defun duplicate-line-above (&optional reverse)
  "Duplicate current line above."
  (interactive)
  (let ((origianl-column (current-column))
        line-content)
    (setq line-content (buffer-substring (line-beginning-position) (line-end-position)))
    (beginning-of-line)
    (and reverse (forward-line +1))
    (newline +1)
    (forward-line -1)
    (insert line-content)
    (goto-column origianl-column)))

(defun duplicate-line-below ()
  "Duplicate current line below"
  (interactive)
  (duplicate-line-above t))

(defun duplicate-line-above-comment (&optional reverse)
  "Duplicate current line above, and comment current line."
  (interactive)
  (if reverse
      (duplicate-line-below)
    (duplicate-line-above))
  (save-excursion
(Continue reading)

Samuel Wales | 1 Feb 2009 03:51
Picon

cycling commands do not go backward

A philosophical note.

Many commands in emacs cycle or rotate or go forward in a list.
Examples include the mark ring, the global mark ring, undo,
hippie-expand, dabbrev-expand, and other completion mechanisms.

Yet most of those commands do not cycle backward.  That is, if you
overshoot, you have to do a lot more cycling to get around to the
previous completion (or whatever).  In the case of undo, it is more
complicated than a ring, but the problem is the same.  You can undo,
but if you overshoot, you are often better off giving up.  (If you
think that the existing mechanisms are sufficient, take a look at the
previous discussions of this on this list and on wikis to find out
whey that is not correct.)

I suspect that this is because it is slightly easier to code it one way.
But for the user it would be great to be able to go both ways.

Consider the right arrow.  It has a complementary left arrow.
Perhaps, as a user interface design goal, the same idea can be applied
to cycling and rotating commands, and to undo.

--

-- 
For personal gain, myalgic encephalomyelitis denialists are knowingly
causing massive suffering and 25-years-early death by grossly
corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

Samuel Wales | 1 Feb 2009 03:52
Picon

Re: elisp errors

On Thu, Jan 22, 2009 at 20:48, Barry Margolin <barmar <at> alum.mit.edu> wrote:
> (dotimes (i 100)
>  (c-indent-command)
>  (move-beginning-of-line 0)
>  (next-line 1)
>  (message "fin partielle"))

Question: is this the usual approach?  Seems a little strange to bind
i when it's not used, especially since emacs lisp uses dynamic extent
by default.

A minor note: this might require 'cl, (an excellent package).

(For those who don't know, Barry is a very experienced Common Lisper.)

--

-- 
For personal and corporate gain, myalgic encephalomyelitis denialists
are knowingly causing massive suffering and 25-years-early death by
grossly corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

Barry Margolin | 1 Feb 2009 03:58
Picon
Favicon
Gravatar

Re: elisp errors

In article <mailman.6394.1233456736.26697.help-gnu-emacs <at> gnu.org>,
 Samuel Wales <samologist <at> gmail.com> wrote:

> On Thu, Jan 22, 2009 at 20:48, Barry Margolin <barmar <at> alum.mit.edu> wrote:
> > (dotimes (i 100)
> >  (c-indent-command)
> >  (move-beginning-of-line 0)
> >  (next-line 1)
> >  (message "fin partielle"))
> 
> Question: is this the usual approach?  Seems a little strange to bind
> i when it's not used, especially since emacs lisp uses dynamic extent
> by default.
> 
> A minor note: this might require 'cl, (an excellent package).
> 
> (For those who don't know, Barry is a very experienced Common Lisper.)

AFAIK, there's no variant of DOTIMES that doesn't require you to provide 
a variable to hold the counter.  And even if there were, it would simply 
have to have a hidden variable of its own, although it could use a 
gensym to avoid potential variable shadowing problems.

But there's virtually no chance that there's a global variable named i 
that you'll shadow with this.  Just don't do something like:

(dotimes (goal-column 100)
  ...)

and you should be OK.
(Continue reading)

Ashish SHUKLA | 1 Feb 2009 09:03
X-Face
Face
Picon
Gravatar

Emacs CVS and inferior-haskell process

Hi,

Whenever I start inferior-haskell process I noticed that whatever I
input to the haskell process, it echoes that back with ^J (2 characters,
^ and J, not single character ^J). To fix this behaviour I've to use the
following EmacsLisp code:

#v+
(with-current-buffer inferior-haskell-buffer
	(add-hook 'comint-preoutput-filter-functions
						(lambda (str) 
							(replace-regexp-in-string ".*^J\\(.*\\)" "\\1" str))))
#v-

This fixes this but I don't think this is any good solution. I think
this has something to do with process or terminal coding, but I'm not
sure what it is.

Following is an interaction with ghci. During the invocation of ghci, I
typed ":t map^M^D" characters on my keyboard:

#v+
% ghci >test.txt
% hexdump -C test.txt
00000000  47 48 43 69 2c 20 76 65  72 73 69 6f 6e 20 36 2e  |GHCi, version 6.|
00000010  31 30 2e 31 3a 20 68 74  74 70 3a 2f 2f 77 77 77  |10.1: http://www|
00000020  2e 68 61 73 6b 65 6c 6c  2e 6f 72 67 2f 67 68 63  |.haskell.org/ghc|
00000030  2f 20 20 3a 3f 20 66 6f  72 20 68 65 6c 70 0a 4c  |/  :? for help.L|
00000040  6f 61 64 69 6e 67 20 70  61 63 6b 61 67 65 20 67  |oading package g|
00000050  68 63 2d 70 72 69 6d 20  2e 2e 2e 20 6c 69 6e 6b  |hc-prim ... link|
(Continue reading)

Helmut Eller | 1 Feb 2009 09:41
Picon

Re: copy-line


Thanks to everyone who replied.
Apparently Emacs has no standard command to do that.
I'll use the code below and bind it to C-x ,

Helmut.

(defun copy-line ()
  "Copy the current line."
  (interactive)
  (let ((col (current-column))
        (beg (progn (beginning-of-line) (point)))
        (end (progn (end-of-line) (point))))
    (forward-line)
    (save-excursion (insert (buffer-substring beg end) "\n"))
    (move-to-column col)))

Peter Dyballa | 1 Feb 2009 11:17
Picon

Re: copy-line


Am 01.02.2009 um 09:41 schrieb Helmut Eller:

> I'll use the code below and bind it to C-x ,

C-a C-k C-_ puts the line in the kill-ring, C-y spits it out,  
anywhere ...

--
Mit friedvollen Grüßen

   Pete

Be careful of reading health books, you might die of a misprint.
				– Mark Twain


Gmane