unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
To: 19749@debbugs.gnu.org
Subject: bug#19749:
Date: Mon, 9 Feb 2015 13:10:24 -0300	[thread overview]
Message-ID: <CAELgYhc5+xf3zM5mTKix48Qz02-5wYbbXp3bU_2wG0mYAcU2hA@mail.gmail.com> (raw)
In-Reply-To: <20150202222819.GA26430@debian>

Sorry for reopening this, Fabián. You're right in pointing that this
bug was introduced by my fix to 19665. But AFAICS 19665 is indeed a
bug: you want to go to the end of the defun line when the search is
backward, in order to match arg defun including the current one.

There is a more difficult problem here. Say * is the point:

1) You want C-M-a to move the point from def* to *def.

2) You want C-M-a to mode the point from *def to the previous definition.

(1) is addressed by 19665.
(2) is addressed by this report.

Still, there is:

3) You want C-M-h both in def* and in *def to select the current
defun. 19665 was intended to correct both cases (*def and def*), but
my patch here breaks again the case *def (because for *def the
selection reverts now to the pathological behavior described in 19665,
just because of the additional condition in the guard, which should be
kept anyway because of (2)).

Note: I'm checking my assertions 1, 2 and 3 against the standard
behavior of elisp mode, which I take as a reference. That's indeed the
behavior there.

More briefly: for C-M-a you want to distinguish between def* and *def,
but for C-M-h you don't. The previous fix here and 19665 correctly
address (1) and (2), and mostly address (3) except for the corner case
*class, which I address in what follows.

Looking at the definition of mark-defun one could clearly see what the
problem is. Starting from *class, say, mark-defun will mark the
previous defun and then check (if (> (point) opoint) to see that the
selected defun was not the desired one. So it goes through the else
part sending the point to the end of the class block and then moving
backward one defun to select just the last method. I think we could
fix this tweaking a bit the behavior of mark-defun, but -unusually-
mark-defun allows for no local extension points. A simple advice could
do the trick but I don't feel like adding an advice just for python
sake to a globally and often used function. The last option I'm able
figure out is to replace mark-defun in the python keymap. This is not
perfect, as mark-defun could be used programatically also, but I
believe it's good enough:

(define-key map [remap mark-defun] 'python-mark-defun)

(defun python-mark-defun ()
  (interactive)
  (when (python-info-looking-at-beginning-of-defun)
    (end-of-line 1))
  (mark-defun))

Besides that, I want to emphazise that you still need:

-            (when (and (< arg 0)
+            (when (and (> arg 0)

and

+                       (> (current-column) (current-indentation))

Cheers
--
Carlos

  parent reply	other threads:[~2015-02-09 16:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 22:28 bug#19749: orpheus does not build on mips64 Andreas Enge
2015-02-03  6:04 ` Mark H Weaver
2015-02-04 16:20   ` Andreas Enge
2015-02-05 16:08     ` Mark H Weaver
2015-02-09 16:10 ` Carlos Pita [this message]
2015-02-09 16:36   ` bug#19749: Carlos Pita
2015-02-09 16:50 ` bug#19749: Carlos Pita
2019-02-19 22:53 ` bug#19749: Progress Andreas Enge
2019-02-20  5:52   ` Leo Famulari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAELgYhc5+xf3zM5mTKix48Qz02-5wYbbXp3bU_2wG0mYAcU2hA@mail.gmail.com \
    --to=carlosjosepita@gmail.com \
    --cc=19749@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).