unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Boruch Baum <boruch_baum@gmx.com>
To: 19663@debbugs.gnu.org
Subject: bug#19663: 24.4: eww.el delete entry from history list
Date: Fri, 23 Jan 2015 10:57:24 -0500	[thread overview]
Message-ID: <54C26F64.4030007@gmx.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]

I found it desirable to be able to delete entries from the history list.

Following is the code that seems to work for me:

(defun eww-history-delete-entry ()
"Delete an entry from the eww history list"
  (interactive)
  (cond
    ((equal (buffer-name) "*eww history*")
      (setq
        current-point (point)
        current-line  (- (line-number-at-pos (point-max))
                         (line-number-at-pos)))
      (with-current-buffer "*eww*"
        (setq eww-history (append
                (butlast eww-history current-line)
                (last    eww-history (1- current-line))))
              eww-history-position
                (min eww-history-position (1- current-line))
        (eww-list-histories)
        (goto-char current-point)))
    ((equal (buffer-name) "*eww*")
      (setq
        current-entry (- (length eww-history)
                         eww-history-position)
        eww-history   (append
          (butlast eww-history current-entry)
          (last    eww-history (1- current-entry))))
      (when (eq current-entry 1)
        (setq eww-history-position (1- eww-history-position))\
)
      (eww-restore-history
        (elt eww-history eww-history-position))
      (when (get-buffer "*eww history*")
        (eww-list-histories)))
    (t
      (user-error "Current buffer is neither the eww buffer, \
nor the eww history buffer"))))


-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

             reply	other threads:[~2015-01-23 15:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 15:57 Boruch Baum [this message]
2015-01-25  2:48 ` bug#19663: 24.4: eww.el delete entry from history list Lars Ingebrigtsen
2015-01-25  7:15   ` Boruch Baum
2015-01-26  1:57     ` Lars Ingebrigtsen
2015-01-26  6:24       ` Boruch Baum
2015-01-26  6:38         ` Lars Ingebrigtsen

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=54C26F64.4030007@gmx.com \
    --to=boruch_baum@gmx.com \
    --cc=19663@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/emacs.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).