From: Rodolfo Medina <rodolfo.medina@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to make `M-<' not set mark?
Date: Sun, 05 Oct 2008 17:12:31 +0100 [thread overview]
Message-ID: <87hc7rvx5c.fsf@gmail.com> (raw)
In-Reply-To: gca8cl$db3$1@news.albasani.net
Rodolfo Medina <rodolfo.medina@gmail.com> writes:
>> Normally, the `M-<' and `M->' commands automatically set a new mark.
>> How can I prevent that?
Rupert Swarbrick <rswarbrick@gmail.com> writes:
> Well, C-h f M-< gives:
>
> [...]
>
> So I'd recommend either hitting C-u beforehand, or (looking at section
> 21.12 of the elisp manual) do something like
>
> (global-set-key (kbd "M-<")
> (lambda () (beginning-of-buffer '(4))))
>
> or indeed
>
> (global-set-key (kbd "M-<")
> (lambda () (goto-char (point-min))))
I copied the definition of `beginning-of-buffer' from the file simple.el and
commented out the part related to mark:
(defun my-beginning-of-buffer (&optional arg)
(interactive "P")
; (or (consp arg)
; (and transient-mark-mode mark-active)
; (push-mark))
(let ((size (- (point-max) (point-min))))
(goto-char (if (and arg (not (consp arg)))
(+ (point-min)
(if (> size 10000)
;; Avoid overflow for large buffer sizes!
(* (prefix-numeric-value arg)
(/ size 10))
(/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
(point-min))))
(if arg (forward-line 1)))
, then bound `M-<' to the new definition:
(global-set-key (kbd "M-<") 'my-beginning-of-buffer)
. It seems to work all right.
Rodolfo
next prev parent reply other threads:[~2008-10-05 16:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-05 12:05 How to make `M-<' not set mark? Rodolfo Medina
2008-10-05 11:28 ` Rupert Swarbrick
2008-10-05 16:12 ` Rodolfo Medina [this message]
2008-10-05 17:09 ` Rupert Swarbrick
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://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hc7rvx5c.fsf@gmail.com \
--to=rodolfo.medina@gmail.com \
--cc=help-gnu-emacs@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.
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).