[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DWIM region
From: |
Stefan Monnier |
Subject: |
Re: DWIM region |
Date: |
Mon, 08 Jan 2018 09:08:42 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> (defun w3m-bookmark-dwim (url &optional title)
> (interactive
> (if (use-region-p)
> (list w3m-current-url (buffer-substring (region-beginning)
> (region-end)))
> (let ((url-at-point (thing-at-point 'url)))
> (if url-at-point (list url-at-point) ; perhaps these two can...
> (let ((link-url (w3m-url-valid (w3m-anchor)))) ; be flipped!
> (if link-url (list link-url) ; (w3m-anchor-title) here DNC
> (list w3m-current-url w3m-current-title) ))))))
> (w3m-bookmark-add url title) )
You could get pretty much the same result by changing the `interactive`
spec of w3m-bookmark-add. E.g. by changing w3m's source code, or with
an advice, or with
(put 'w3m-bookmark-add
'interactive-form
`(funcall ',(lambda ()
(if (use-region-p)
(list w3m-current-url (buffer-substring (region-beginning)
(region-end)))
(let ((url-at-point (thing-at-point 'url)))
(if url-at-point (list url-at-point) ; perhaps these two can...
(let ((link-url (w3m-url-valid (w3m-anchor)))) ; be flipped!
(if link-url (list link-url) ; (w3m-anchor-title) here DNC
(list w3m-current-url w3m-current-title) ))))))))
-- Stefan
- Re: DWIM region, (continued)
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Re: DWIM region, Stefan Monnier, 2018/01/08
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/08
- Re: DWIM region, Stefan Monnier, 2018/01/08
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/08
- Re: DWIM region, Stefan Monnier, 2018/01/09
- Re: DWIM region, Stefan Monnier, 2018/01/08
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/08
- Re: DWIM region,
Stefan Monnier <=
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/04
- Re: DWIM region (was: Re: count regexp hits), Marcin Borkowski, 2018/01/07
- Message not available
- Re: DWIM region (was: Re: count regexp hits), Emanuel Berg, 2018/01/07
- Re: DWIM region (was: Re: count regexp hits), Marcin Borkowski, 2018/01/07
- Message not available
- Re: DWIM region (was: Re: count regexp hits), Emanuel Berg, 2018/01/07
- Re: DWIM region (was: Re: count regexp hits), Marcin Borkowski, 2018/01/09
- Re: DWIM region, Stefan Monnier, 2018/01/09
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/09
- Message not available
- Re: DWIM region (was: Re: count regexp hits), Emanuel Berg, 2018/01/09