From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: E Sabof Newsgroups: gmane.emacs.bugs Subject: bug#14548: 24.3.1; [PATCH] image-dired-dired-toggle-marked-thumbs conflicts with other modes using overlays Date: Mon, 3 Jun 2013 14:28:28 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=002354790f1cabf1f404de3ff002 X-Trace: ger.gmane.org 1370266160 10711 80.91.229.3 (3 Jun 2013 13:29:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Jun 2013 13:29:20 +0000 (UTC) To: 14548@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 03 15:29:20 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UjUp5-0001EY-RR for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 15:29:20 +0200 Original-Received: from localhost ([::1]:49639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjUp5-00057A-DY for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Jun 2013 09:29:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjUp0-000573-9x for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2013 09:29:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjUox-0000Ym-7j for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2013 09:29:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjUox-0000Yi-4A for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2013 09:29:11 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UjUqk-0006NB-31 for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2013 09:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: E Sabof Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Jun 2013 13:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14548 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137026625724472 (code B ref -1); Mon, 03 Jun 2013 13:31:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Jun 2013 13:30:57 +0000 Original-Received: from localhost ([127.0.0.1]:48851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjUqb-0006MW-D4 for submit@debbugs.gnu.org; Mon, 03 Jun 2013 09:30:55 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39245) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjUqS-0006M0-M2 for submit@debbugs.gnu.org; Mon, 03 Jun 2013 09:30:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjUoW-0000Re-26 for submit@debbugs.gnu.org; Mon, 03 Jun 2013 09:28:47 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjUoV-0000Ra-WC for submit@debbugs.gnu.org; Mon, 03 Jun 2013 09:28:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjUoO-000558-2C for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2013 09:28:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjUoH-0000PA-Ib for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2013 09:28:35 -0400 Original-Received: from mail-qe0-f47.google.com ([209.85.128.47]:58546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjUoH-0000P6-E0 for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2013 09:28:29 -0400 Original-Received: by mail-qe0-f47.google.com with SMTP id 1so362948qec.6 for ; Mon, 03 Jun 2013 06:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=C/ijOHizEst1eBFVXbqDk18u3xsJhNsEMLhr4BP+cy0=; b=hh8+YnWjo9pil4+xTQN+tyAIe62IusaZFNtvm/C39LjYsjPtChXjNExQo4at19kEth VajjP4wu0wnMawWr2IhCvJL4+P4MZIuSmH6uSY76Mwr0J1IqqBzL2VMKQZzvhm7wt680 fW0X0/eF1vO3EYTabHlydA6aMaDJOlb+gNAPi1jktOHF4sVZTtZYfYGxpNiRhX1zDAyY cBOVkgvYbZ8DKFz+BrCv2DPe5th7c7ixIZhBdfWgsfZ/dMYgZYbdZhxLuphwr3Ld+/nM t1HeDl8YXUW7byEKz4FSkcXaKXmjwpEmOMPVbLD1TeovIM3Y8kw2ELW96rA+Mxdz8g9G EGPw== X-Received: by 10.229.136.213 with SMTP id s21mr7903880qct.9.1370266108944; Mon, 03 Jun 2013 06:28:28 -0700 (PDT) Original-Received: by 10.49.18.162 with HTTP; Mon, 3 Jun 2013 06:28:28 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74774 Archived-At: --002354790f1cabf1f404de3ff002 Content-Type: text/plain; charset=ISO-8859-1 One such mode is stripe-buffer, which can be fonud here: https://github.com/sabof/stripe-buffer the definition below fixes the problem. Evgeni (ad-unadvise 'image-dired-dired-toggle-marked-thumbs) ; stripe-buffer monkey-patches the function. (defun image-dired-dired-toggle-marked-thumbs (&optional arg) "Toggle thumbnails in front of file names in the dired buffer. If no marked file could be found, insert or hide thumbnails on the current line. ARG, if non-nil, specifies the files to use instead of the marked files. If ARG is an integer, use the next ARG (or previous -ARG, if ARG<0) files." (interactive "P") (dired-map-over-marks (let* ((image-pos (dired-move-to-filename)) (image-file (dired-get-filename nil t)) thumb-file overlay) (when (and image-file (string-match-p (image-file-name-regexp) image-file)) (setq thumb-file (image-dired-get-thumbnail-image image-file)) ;; If image is not already added, then add it. (let* (( cur-ovs (overlays-in (point) (1+ (point)))) ( thumb-ov (car (cl-remove-if-not (lambda (ov) (overlay-get ov 'thumb-file)) cur-ovs)))) (if thumb-ov (delete-overlay thumb-ov) (progn (put-image thumb-file image-pos) (setq overlay (cl-loop for o in (overlays-in (point) (1+ (point))) when (overlay-get o 'put-image) collect o into ov finally return (car ov))) (overlay-put overlay 'image-file image-file) (overlay-put overlay 'thumb-file thumb-file)))))) arg ; Show or hide image on ARG next files. 'show-progress) ; Update dired display after each image is updated. (add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil t)) --002354790f1cabf1f404de3ff002 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
One such mode is stripe-buffer, which can be fonud here:

the defin= ition below fixes the problem.

Evgeni

(ad-unadvise 'image= -dired-dired-toggle-marked-thumbs) ; stripe-buffer monkey-patches the funct= ion.

=A0(defun image-dired-dired-toggle-m= arked-thumbs (&optional arg)
=A0 =A0 "Toggle thumbnails in front of file names in the dired bu= ffer.
If no marked file could be found, insert or hide thumbnails= on the
current line. =A0ARG, if non-nil, specifies the files to = use instead
of the marked files. =A0If ARG is an integer, use the next ARG (or
previous -ARG, if ARG<0) files."
=A0 =A0 (interact= ive "P")
=A0 =A0 (dired-map-over-marks
=A0 = =A0 =A0(let* ((image-pos =A0(dired-move-to-filename))
=A0 =A0 =A0 =A0 =A0 =A0 (image-file (dired-get-filename nil t))
<= div>=A0 =A0 =A0 =A0 =A0 =A0 thumb-file
=A0 =A0 =A0 =A0 =A0 =A0 ov= erlay)
=A0 =A0 =A0 =A0(when (and image-file
=A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 (string-match-p (image-file-name-regexp) image-fil= e))
=A0 =A0 =A0 =A0 =A0(setq thumb-file (image-dired-get-thumbnail-image i= mage-file))
=A0 =A0 =A0 =A0 =A0;; If image is not already added, = then add it.
=A0 =A0 =A0 =A0 =A0(let* (( cur-ovs (overlays-in (po= int) (1+ (point))))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ( thumb-ov (car (cl-remove-if-not
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(lambda= (ov) (overlay-get ov 'thumb-file))
=A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cur-ovs))))
=A0 =A0 = =A0 =A0 =A0 =A0(if thumb-ov
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(delete-overlay thumb-ov)
=A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0(progn
=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0(put-image thumb-file image-pos)
=A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0(setq overlay
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0(cl-loop for o in (overlays-in (point) (1+ (point)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 when (= overlay-get o 'put-image) collect o into ov
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 finally return (car ov)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(overlay-put overlay 'image= -file image-file)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(overlay-put overlay 'thumb-fil= e thumb-file))))))
=A0 =A0 =A0arg =A0 =A0 =A0 =A0 =A0 =A0 ; Show = or hide image on ARG next files.
=A0 =A0 =A0'show-progress) ;= Update dired display after each image is updated.
=A0 =A0 (add-hook 'dired-after-readin-hook
=A0 =A0 =A0 = =A0 =A0 =A0 =A0 'image-dired-dired-after-readin-hook nil t))
--002354790f1cabf1f404de3ff002--