* bug#17768: 24.3; problem with two ruler-mode windows @ 2014-06-12 23:57 Andrea Rossetti 2014-06-13 7:29 ` martin rudalics 2014-06-16 8:45 ` bug#17768: Andrea Rossetti 0 siblings, 2 replies; 13+ messages in thread From: Andrea Rossetti @ 2014-06-12 23:57 UTC (permalink / raw To: 17768 Hello, I think I found a bug in ruler-mode; a recipe to reproduce it follows here below; may I please ask if it's reproducible for you as well. Start emacs -Q and type: M-x ruler-mode RET C-x 3 you will see two side-by-side windows that show the same scratch buffer. That's normal and expected. Now use mouse to adjust the *left* margin of the *rightside* window (Shift + mouse-1 on the ruler): it does not work, i.e. clicking has no visible effect. Other facts I found: - problem doesn't happen in the leftside window, only in the rightside one - problem doesn't happen if the frame is splitted vertically (C-x 2) instead of horizontally - problem seems to happen in the rightside window for *all* the ruler mouse functions (adjust right margin, drag goal column etc.). Proposed diagnosys: there could be some error in the ruler's horizontal offset management (frame-based column vs. window-relative column). The left margin mouse adjustment seems to work properly if I change the elisp code of file ruler-mode.el, function ruler-mode-mouse-set-left-margin: from (setq col (- (car (posn-col-row start)) (car (window-edges)) (scroll-bar-columns 'left)) ... into (setq col (- (car (posn-col-row start)) (scroll-bar-columns 'left)) ... That's not a solution, just an attempt to isolate the problematic code point. Thanks for your attention, kindest regards. Andrea In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600) of 2013-03-17 on MARVIN Windowing system distributor `Microsoft Corp.', version 6.1.7600 Configured using: `configure --with-gcc (4.7) --cflags -ID:/devel/emacs/libs/libXpm-3.5.8/include -ID:/devel/emacs/libs/libXpm-3.5.8/src -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include -ID:/devel/emacs/libs/giflib-4.1.4-1/include -ID:/devel/emacs/libs/jpeg-6b-4/include -ID:/devel/emacs/libs/tiff-3.8.2-1/include -ID:/devel/emacs/libs/gnutls-3.0.9/include -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2' Important settings: value of $LANG: ITA locale-coding-system: cp1252 default enable-multibyte-characters: t Major mode: Text Minor modes in effect: show-paren-mode: t server-mode: t recentf-mode: t cua-mode: t tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x e m a c <tab> b u <tab> <backspace> <backspace> r e <tab> <backspace> <S-kp-home> r e p o <tab> r t - e m a <tab> <return> Recent messages: Loading cua-base...done Loading gnus...done Loading recentf...done Loading server (compiled; note, source file is newer)...done Loading paren...done Loading c:/Users/andrea/AppData/Roaming/.recentf...done For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... Load-path shadows: c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-w3m hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-w3m c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-version hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-version c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-timer hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-timer c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-table hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-table c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-src hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-src c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-rmail hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-rmail c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-protocol hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-protocol c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-plot hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-plot c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-pcomplete hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-pcomplete c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-mouse hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-mouse c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-mobile hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-mobile c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-mhe hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-mhe c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-macs hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-macs c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-loaddefs hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-loaddefs c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-list hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-list c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-irc hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-irc c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-install hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-install c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-inlinetask hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-inlinetask c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-info hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-info c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-indent hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-indent c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-id hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-id c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-habit hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-habit c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-gnus hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-gnus c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-footnote hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-footnote c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-feed hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-feed c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-faces hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-faces c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-eshell hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-eshell c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-entities hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-entities c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-element hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-element ~/.emacs.d/contrib/org-drill hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-drill c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-docview hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-docview c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-datetree hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-datetree c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-ctags hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-ctags c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-crypt hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-crypt c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-compat hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-compat c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-colview hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-colview c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-clock hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-clock c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-capture hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-capture c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-bibtex hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-bibtex c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-bbdb hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-bbdb c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-attach hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-attach c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-archive hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-archive c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/org-agenda hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/org-agenda c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-tangle hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-tangle c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-table hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-table c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-sqlite hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-sqlite c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-sql hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-sql c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-shen hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-shen c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-sh hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-sh c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-screen hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-screen c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-scheme hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-scheme c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-scala hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-scala c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-sass hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-sass c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-ruby hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-ruby c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-ref hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-ref c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-R hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-R c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-python hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-python c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-plantuml hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-plantuml c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-picolisp hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-picolisp c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-perl hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-perl c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-org hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-org c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-octave hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-octave c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-ocaml hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-ocaml c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-mscgen hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-mscgen c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-maxima hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-maxima c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-matlab hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-matlab c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-lob hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-lob c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-lisp hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-lisp c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-lilypond hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-lilypond c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-ledger hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-ledger c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-latex hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-latex c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-keys hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-keys c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-js hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-js c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-java hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-java c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-io hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-io c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-haskell hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-haskell c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-gnuplot hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-gnuplot c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-fortran hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-fortran c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-exp hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-exp c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-eval hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-eval c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-emacs-lisp hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-emacs-lisp c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-dot hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-dot c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-ditaa hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-ditaa c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-css hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-css c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-comint hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-comint c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-clojure hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-clojure c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-calc hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-calc c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-C hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-C c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-awk hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-awk c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140602/ob-asymptote hides c:/Users/andrea/Documents/Programmi/emacs/lisp/org/ob-asymptote Features: (shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums help-mode bbdb-autoloads csv-mode-autoloads gnuplot-autoloads google-translate-autoloads graphviz-dot-mode-autoloads jabber-autoloads org-autoloads info paredit-autoloads pretty-lambdada-autoloads web-server-autoloads finder-inf package edmacro kmacro paren server recentf tree-widget easymenu gnus gnus-ems nnheader gnus-util mail-utils mm-util mail-prsvr wid-edit cua-base cus-start cus-load time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process w32 multi-tty emacs) ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-12 23:57 bug#17768: 24.3; problem with two ruler-mode windows Andrea Rossetti @ 2014-06-13 7:29 ` martin rudalics 2014-06-14 16:45 ` Eli Zaretskii 2014-06-14 17:22 ` Andrea Rossetti 2014-06-16 8:45 ` bug#17768: Andrea Rossetti 1 sibling, 2 replies; 13+ messages in thread From: martin rudalics @ 2014-06-13 7:29 UTC (permalink / raw To: Andrea Rossetti, 17768 > The left margin mouse adjustment seems to work properly if > I change the elisp code of file ruler-mode.el, function > ruler-mode-mouse-set-left-margin: > > from > > (setq col (- (car (posn-col-row start)) (car (window-edges)) > (scroll-bar-columns 'left)) The value returned by `posn-col-row' is relative to the edges of the window where the event occurred. It is called from `posn-x-y' whose info entry states that "These coordinates are relative to the window given by `posn-window'". However any such information is left out from doc-string and info on `posn-col-row'. This might have confused the author of ruler-mode and certainly confuses me now. Could someone look into the doc-string and info entry of `posn-col-row' and maybe improve them to avoid such confusion. For example: This function returns a cons cell `(COL . ROW)', containing the estimated column and row corresponding to buffer position ... what does "buffer position" mean here ... POSITION. The return value is given in units of the frame's default character width and height, as computed from the X and Y values corresponding to POSITION. (So, if the actual characters have non-default sizes, the actual row and column may differ from these computed values.) Note that ROW is counted from the top of the text area. If the window ... which window is meant here ... possesses a header line (*note Header Lines::), it is _not_ counted as the first line. ... this sounds obvious but what ´does "not counting" stand for? But maybe there's nothing confusing here and it's only me to misinterpret things. > into > > (setq col (- (car (posn-col-row start)) > (scroll-bar-columns 'left)) > ... This sounds like the correct solution to me. Could you try testing it with three and more side-by-side windows and all sorts of clicks ruler mode can handle and possibly post a corresponding patch? Many thanks for the report, martin ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-13 7:29 ` martin rudalics @ 2014-06-14 16:45 ` Eli Zaretskii 2014-06-15 15:09 ` martin rudalics 2014-06-14 17:22 ` Andrea Rossetti 1 sibling, 1 reply; 13+ messages in thread From: Eli Zaretskii @ 2014-06-14 16:45 UTC (permalink / raw To: martin rudalics; +Cc: andrea.rossetti, 17768 > Date: Fri, 13 Jun 2014 09:29:23 +0200 > From: martin rudalics <rudalics@gmx.at> > > > The left margin mouse adjustment seems to work properly if > > I change the elisp code of file ruler-mode.el, function > > ruler-mode-mouse-set-left-margin: > > > > from > > > > (setq col (- (car (posn-col-row start)) (car (window-edges)) > > (scroll-bar-columns 'left)) > > The value returned by `posn-col-row' is relative to the edges of the > window where the event occurred. It is called from `posn-x-y' whose > info entry states that "These coordinates are relative to the window > given by `posn-window'". However any such information is left out from > doc-string and info on `posn-col-row'. This might have confused the > author of ruler-mode and certainly confuses me now. How else can column and row be measured, except from the window edge? > Could someone look into the doc-string and info entry of `posn-col-row' > and maybe improve them to avoid such confusion. I don't understand the confusion, but I went out and made it more clear anyway (r117242 on the emacs-24 branch). > For example: > > This function returns a cons cell `(COL . ROW)', containing the > estimated column and row corresponding to buffer position > > ... what does "buffer position" mean here ... The meaning of the word "position" is overloaded here: the POSITION argument of the function includes a reference to a buffer position. A better way to say that is "... corresponding to the buffer position given by POSITION." > Note that ROW is counted from the top of the text area. If the > window > > ... which window is meant here ... The window given by POSITION, of course. Perhaps you misremember that the POSITION argument is a complex data structure, not just a number. It includes a reference to the window where the event took place. > possesses a header line (*note Header Lines::), it is _not_ > counted as the first line. > > ... this sounds obvious but what ´does "not counting" stand for? It stands for "not counting". IOW, the header line is not included in the row count, and the first text line is still row number zero, not number 1. > > into > > > > (setq col (- (car (posn-col-row start)) > > (scroll-bar-columns 'left)) > > ... > > This sounds like the correct solution to me. In general, one should stay away of columns when dealing with coordinates, since columns are measured in logical order, i.e. in a R2L line they are measured from the right edge of the window. But since in this case columns are just x coordinates measured in other units (and therefore calling them "columns" is a misnomer), I think it's OK in this case. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-14 16:45 ` Eli Zaretskii @ 2014-06-15 15:09 ` martin rudalics 2014-06-15 16:17 ` Eli Zaretskii 0 siblings, 1 reply; 13+ messages in thread From: martin rudalics @ 2014-06-15 15:09 UTC (permalink / raw To: Eli Zaretskii; +Cc: andrea.rossetti, 17768 > How else can column and row be measured, except from the window edge? From the left upper edge of the frame, just as the x-y-coordinates. At least that's apparently what the author of ruler mode thought. And if you compare it with the description of `posn-actual-col-row', such interpretation sounds quite reasonable to me. What is the difference between `posn-col-row' and `posn-actual-col-row' for a position within the text area of a window? If there's none, then why does the latter explicitly talk about windows and the former not? If there's one, what is it? >> Could someone look into the doc-string and info entry of `posn-col-row' >> and maybe improve them to avoid such confusion. > > I don't understand the confusion, but I went out and made it more > clear anyway (r117242 on the emacs-24 branch). Thank you. But IIUC the reference to "window edge" is still missing from the manual entry. Someone who reads "given in units of the frame's default character width and default line height" might still conclude that we count from the frame edge. The only implict reference to "window" comes from the term "text area" and I'm not sure how familiar people are with that and whether they connect it to windows at all. >> For example: >> >> This function returns a cons cell `(COL . ROW)', containing the >> estimated column and row corresponding to buffer position >> >> ... what does "buffer position" mean here ... > > The meaning of the word "position" is overloaded here: the POSITION > argument of the function includes a reference to a buffer position. A > better way to say that is "... corresponding to the buffer position > given by POSITION." > >> Note that ROW is counted from the top of the text area. If the >> window >> >> ... which window is meant here ... > > The window given by POSITION, of course. Perhaps you misremember that > the POSITION argument is a complex data structure, not just a number. > It includes a reference to the window where the event took place. I know. But the phrase "corresponding to buffer position POSITION" was surely misleading. And do we even care about "buffer positions" here? I doubt that. All we do is returning coordinates in terms of frame lines and columns (as opposed to coordinates in terms of pixels as returned by `posn-x-y'). >> possesses a header line (*note Header Lines::), it is _not_ >> counted as the first line. >> >> ... this sounds obvious but what ´does "not counting" stand for? > > It stands for "not counting". IOW, the header line is not included in > the row count, and the first text line is still row number zero, not > number 1. Earlier we say "Row 0 is taken to be the header line if the window has one, or the topmost row of the text area otherwise." which I would interpret as "The header line, if present, is counted as line 0. If no header line is present the first text line is counted as line 0.", that is, the header line _is_ counted. I'm too silly to grok that. >> > into >> > >> > (setq col (- (car (posn-col-row start)) >> > (scroll-bar-columns 'left)) >> > ... >> >> This sounds like the correct solution to me. > > In general, one should stay away of columns when dealing with > coordinates, since columns are measured in logical order, i.e. in a > R2L line they are measured from the right edge of the window. But > since in this case columns are just x coordinates measured in other > units (and therefore calling them "columns" is a misnomer), I think > it's OK in this case. This means that we shouldn't provide `posn-col-row' in the first place which I'd consider the best solution. In any case, ruler mode deals with columns, so it has to either access them somehow or provide an abstraction based on pixel values. martin ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-15 15:09 ` martin rudalics @ 2014-06-15 16:17 ` Eli Zaretskii 2014-06-16 21:05 ` Stefan Monnier 0 siblings, 1 reply; 13+ messages in thread From: Eli Zaretskii @ 2014-06-15 16:17 UTC (permalink / raw To: martin rudalics; +Cc: andrea.rossetti, 17768 > Date: Sun, 15 Jun 2014 17:09:26 +0200 > From: martin rudalics <rudalics@gmx.at> > CC: andrea.rossetti@gmail.com, 17768@debbugs.gnu.org > > > How else can column and row be measured, except from the window edge? > > From the left upper edge of the frame, just as the x-y-coordinates. A column is fundamentally window-related. It's not a coordinate, it's a place in the text, and frames don't display text. > At least that's apparently what the author of ruler mode thought. I'd prefer not to second-guess someone's misconceptions. > > I don't understand the confusion, but I went out and made it more > > clear anyway (r117242 on the emacs-24 branch). > > Thank you. But IIUC the reference to "window edge" is still missing > from the manual entry. The manual text explicitly talks about a column and row of text in a window, so I think it's clear enough. > > In general, one should stay away of columns when dealing with > > coordinates, since columns are measured in logical order, i.e. in a > > R2L line they are measured from the right edge of the window. But > > since in this case columns are just x coordinates measured in other > > units (and therefore calling them "columns" is a misnomer), I think > > it's OK in this case. > > This means that we shouldn't provide `posn-col-row' in the first place > which I'd consider the best solution. I see no reason to delete well established APIs, just because Emacs overgrew the time when they were named. ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-15 16:17 ` Eli Zaretskii @ 2014-06-16 21:05 ` Stefan Monnier 0 siblings, 0 replies; 13+ messages in thread From: Stefan Monnier @ 2014-06-16 21:05 UTC (permalink / raw To: Eli Zaretskii; +Cc: andrea.rossetti, 17768 >> This means that we shouldn't provide `posn-col-row' in the first place >> which I'd consider the best solution. > I see no reason to delete well established APIs, just because Emacs > overgrew the time when they were named. We could consider obsoleting the function if we thing that its use is either less convenient than alternatives, or tends to lead to bugs which don't affect the alternative. I don't know enough posn-col-row's uses to judge. Stefan ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-13 7:29 ` martin rudalics 2014-06-14 16:45 ` Eli Zaretskii @ 2014-06-14 17:22 ` Andrea Rossetti 2014-06-15 15:09 ` martin rudalics 2014-06-16 7:10 ` martin rudalics 1 sibling, 2 replies; 13+ messages in thread From: Andrea Rossetti @ 2014-06-14 17:22 UTC (permalink / raw To: martin rudalics; +Cc: 17768 [-- Attachment #1: Type: text/plain, Size: 479 bytes --] martin rudalics <rudalics@gmx.at> writes: > Could you try testing it > with three and more side-by-side windows and all sorts of clicks ruler > mode can handle and possibly post a corresponding patch? > Hi, here's my tentative patches. I checked out from http://git.savannah.gnu.org/cgit/emacs.git, last commit was 6449128a5ab4a47a281de6117b86661dcc05b599, and made two patches. First patch applies the changes that we supposed could solve the problem of the wrong offset. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-lisp-ruler-mode.el-correct-offset-of-set-margin-and-.patch --] [-- Type: text/x-patch, Size: 1723 bytes --] From 88a4f9fb9d2eace74a737205a26b26f35cb21cf6 Mon Sep 17 00:00:00 2001 From: Andrea Rossetti <andrear1979@hotmail.com> Date: Sat, 14 Jun 2014 17:26:49 +0200 Subject: [PATCH 1/2] lisp/ruler-mode.el: correct offset of "set margin" and "drag column" mouse operations --- lisp/ruler-mode.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index 9e32a2f..238754e 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -306,7 +306,6 @@ or remove a tab stop. \\[ruler-mode-toggle-show-tab-stops] or "Return a column number relative to the selected window. N is a column number relative to selected frame." (- n - (car (window-edges)) (or (car (window-margins)) 0) (fringe-columns 'left) (scroll-bar-columns 'left))) @@ -321,7 +320,7 @@ START-EVENT is the mouse click event." (when (eq start end) ;; mouse click (save-selected-window (select-window (posn-window start)) - (setq col (- (car (posn-col-row start)) (car (window-edges)) + (setq col (- (car (posn-col-row start)) (scroll-bar-columns 'left)) w (- (ruler-mode-full-window-width) (scroll-bar-columns 'left) @@ -343,7 +342,7 @@ START-EVENT is the mouse click event." (when (eq start end) ;; mouse click (save-selected-window (select-window (posn-window start)) - (setq col (- (car (posn-col-row start)) (car (window-edges)) + (setq col (- (car (posn-col-row start)) (scroll-bar-columns 'left)) w (- (ruler-mode-full-window-width) (scroll-bar-columns 'left) -- 1.8.1.msysgit.1 [-- Attachment #3: Type: text/plain, Size: 1124 bytes --] I tested patch1 somewhat randomly, opening 4/5 windows horizontally, 1/2 windows vertically, and did also some attempt splitting windows in two frames. Played also a bit on the text-only Emacs (using MSYS shell). Everything worked fine with patch1, except for an unexpected small and non-blocking issue (let's call it "diagonal-drag" issue) that can be reproduced as follows: - C-x 3 M-x ruler-mode (you should see two windows with ruler) - click S-<mouse-1> on the ruler of the rightmost window, this will set a left margin, choose a width of around 10~20 chars - drag "diagonally" a column, for example moving down-left the fill-column, until the cursor goes a few pixels below the ruler area - you will see that the dragged column will "jump" innaturally to the left of around 10~20 chars Tentative diagnosys: function `ruler-mode-window-col' returns a different column value depending if you are inside or outside the ruler area. The actual problem is probably inherited from `posn-col-row', but I could not clarify any better. I wrote patch 2, that worked for me to solve the "diagonal-drag" issue. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #4: 0002-lisp-ruler-mode.el-fix-offset-for-mouse-dragging-bey.patch --] [-- Type: text/x-patch, Size: 3069 bytes --] From e521c93c296377d1733e8801832f3066e4cc4ede Mon Sep 17 00:00:00 2001 From: Andrea Rossetti <andrear1979@hotmail.com> Date: Sat, 14 Jun 2014 17:32:03 +0200 Subject: [PATCH 2/2] lisp/ruler-mode.el: fix offset for mouse dragging beyond header line --- lisp/ruler-mode.el | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index 238754e..097a13e 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -302,12 +302,17 @@ or remove a tab stop. \\[ruler-mode-toggle-show-tab-stops] or (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges)))) -(defsubst ruler-mode-window-col (n) +(defsubst ruler-mode-window-col (start-or-end-event) "Return a column number relative to the selected window. -N is a column number relative to selected frame." - (- n - (or (car (window-margins)) 0) - (fringe-columns 'left) +START-OR-END-EVENT is the start point or end point +of a mouse click or mouse drag event. + +See also: `event-start', `event-end', `posn-col-row', `posn-area'. +" + (- (car (posn-col-row start-or-end-event)) + (if (eq (posn-area start) 'header-line) + (+ (or (car (window-margins)) 0) (fringe-columns 'left)) + 0) (scroll-bar-columns 'left))) \f (defun ruler-mode-mouse-set-left-margin (start-event) @@ -371,7 +376,7 @@ dragging. See also the variable `ruler-mode-dragged-symbol'." col newc oldc) (save-selected-window (select-window (posn-window start)) - (setq col (ruler-mode-window-col (car (posn-col-row start))) + (setq col (ruler-mode-window-col start) newc (+ col (window-hscroll))) (and (>= col 0) (< col (window-width)) @@ -454,7 +459,7 @@ Called on each mouse motion event START-EVENT." col newc) (save-selected-window (select-window (posn-window start)) - (setq col (ruler-mode-window-col (car (posn-col-row end))) + (setq col (ruler-mode-window-col end) newc (+ col (window-hscroll))) (when (and (>= col 0) (< col (window-width))) (set ruler-mode-dragged-symbol newc))))) @@ -470,7 +475,7 @@ START-EVENT is the mouse click event." (when (eq start end) ;; mouse click (save-selected-window (select-window (posn-window start)) - (setq col (ruler-mode-window-col (car (posn-col-row start))) + (setq col (ruler-mode-window-col start) ts (+ col (window-hscroll))) (and (>= col 0) (< col (window-width)) (not (member ts tab-stop-list)) @@ -490,7 +495,7 @@ START-EVENT is the mouse click event." (when (eq start end) ;; mouse click (save-selected-window (select-window (posn-window start)) - (setq col (ruler-mode-window-col (car (posn-col-row start))) + (setq col (ruler-mode-window-col start) ts (+ col (window-hscroll))) (and (>= col 0) (< col (window-width)) (member ts tab-stop-list) -- 1.8.1.msysgit.1 [-- Attachment #5: Type: text/plain, Size: 802 bytes --] And finally: I noticed another independent bug ("text-scale issue"), i.e. most ruler's mouse operation have wrong offset if you adjust text scale (C-x C-+). If anyone reading is interested to help, here's a proposed action plan: - may you please try to play with patch1, and give advice if it could be acceptable for a commit - I guess that patch2 is unacceptable (BTW it changes the definition of ruler-mode-window-col, I assumed that ruler-mode.el is the only program calling it) but it's the best I could squeeze out of my head... any help or constructive criticism is welcome :) - be aware of the "text-scale" issue but don't test for it; it seems a totally independent issue so I'd rather send another bug report for it Thanks for your attention, kindest regards. Andrea ^ permalink raw reply related [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-14 17:22 ` Andrea Rossetti @ 2014-06-15 15:09 ` martin rudalics 2014-06-15 18:06 ` Andrea Rossetti 2014-06-16 7:10 ` martin rudalics 1 sibling, 1 reply; 13+ messages in thread From: martin rudalics @ 2014-06-15 15:09 UTC (permalink / raw To: Andrea Rossetti; +Cc: 17768 > First patch applies the changes that we supposed could > solve the problem of the wrong offset. Thanks. I'll apply it as soon as I can build again here. > I tested patch1 somewhat randomly, opening 4/5 windows horizontally, > 1/2 windows vertically, and did also some attempt splitting windows > in two frames. Played also a bit on the text-only Emacs (using MSYS shell). > > Everything worked fine with patch1, except for an unexpected small > and non-blocking issue (let's call it "diagonal-drag" issue) that > can be reproduced as follows: > > - C-x 3 M-x ruler-mode (you should see two windows with ruler) > - click S-<mouse-1> on the ruler of the rightmost window, this will set > a left margin, choose a width of around 10~20 chars > - drag "diagonally" a column, for example moving down-left the > fill-column, until the cursor goes a few pixels below the ruler area How do I drag a column? What is "moving down-left"? Can you explain in terms of keystrokes or mouse clicks? > - you will see that the dragged column will "jump" innaturally to the > left of around 10~20 chars > > Tentative diagnosys: function `ruler-mode-window-col' returns a > different column value depending if you are inside or outside the > ruler area. The actual problem is probably inherited from `posn-col-row', > but I could not clarify any better. It seems so (from reading the doc-string of `ruler-mode-window-col'). But I would like to reproduce the problem first. Please advice. > And finally: I noticed another independent bug ("text-scale issue"), > i.e. most ruler's mouse operation have wrong offset if you adjust > text scale (C-x C-+). This should be definitively corrected (as well as other text scale related issues happening, for example, when splitting windows). > If anyone reading is interested to help, here's a proposed action plan: > > - may you please try to play with patch1, and give advice if it could be > acceptable for a commit I only need advice from Stefan whether to install it in the branch or on trunk. > - I guess that patch2 is unacceptable (BTW it changes the definition of > ruler-mode-window-col, I assumed that ruler-mode.el is the only > program calling it) but it's the best I could squeeze out of my head... > any help or constructive criticism is welcome :) The premise of `ruler-mode-window-col' seems wrong so we have to do something about it. > - be aware of the "text-scale" issue but don't test for it; it seems > a totally independent issue so I'd rather send another bug report for it Please do that. Thanks, martin ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-15 15:09 ` martin rudalics @ 2014-06-15 18:06 ` Andrea Rossetti 2014-06-15 23:22 ` Andrea Rossetti 0 siblings, 1 reply; 13+ messages in thread From: Andrea Rossetti @ 2014-06-15 18:06 UTC (permalink / raw To: martin rudalics; +Cc: 17768 martin rudalics <rudalics@gmx.at> writes: >> - drag "diagonally" a column, for example moving down-left the >> fill-column, until the cursor goes a few pixels below the ruler area > > How do I drag a column? What is "moving down-left"? Can you explain in > terms of keystrokes or mouse clicks? > Sincere apologies for having overloaded a bit too much this bug report; I'm now getting a clearer picture: 1) patch1 is intended to solve the problem described at top of this bug report 2) while testing patch1, I noticed the "diagonal drag" issue; I thought it was due to patch1 but now I realize it's an independent and pre-existing problem 3) while testing patch1+patch2, I noticed the "text scale" issue but did not try to solve it I think it's cleaner if you only consider patch1 and forget the rest for now. I will open a ticket for 2) with a better explanation and an independent patch, and a ticket for 3). Kindest regards, Andrea ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-15 18:06 ` Andrea Rossetti @ 2014-06-15 23:22 ` Andrea Rossetti 2014-06-16 7:10 ` martin rudalics 0 siblings, 1 reply; 13+ messages in thread From: Andrea Rossetti @ 2014-06-15 23:22 UTC (permalink / raw To: martin rudalics; +Cc: 17768 Andrea Rossetti <andrea.rossetti@gmail.com> writes: > I will open a ticket for 2) with a better explanation and > an independent patch... I submitted bug report #17788: "24.3; ruler-mode: column indicators 'hop' left if you drag them diagonally", the explanation should be somewhat less messy now :) Cheers, Andrea ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-15 23:22 ` Andrea Rossetti @ 2014-06-16 7:10 ` martin rudalics 0 siblings, 0 replies; 13+ messages in thread From: martin rudalics @ 2014-06-16 7:10 UTC (permalink / raw To: Andrea Rossetti; +Cc: 17768 >> I will open a ticket for 2) with a better explanation and >> an independent patch... > > I submitted bug report #17788: "24.3; ruler-mode: column > indicators 'hop' left if you drag them diagonally", the > explanation should be somewhat less messy now :) Cheers, Thanks. I think you can close bug#17768 now. martin ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 24.3; problem with two ruler-mode windows 2014-06-14 17:22 ` Andrea Rossetti 2014-06-15 15:09 ` martin rudalics @ 2014-06-16 7:10 ` martin rudalics 1 sibling, 0 replies; 13+ messages in thread From: martin rudalics @ 2014-06-16 7:10 UTC (permalink / raw To: Andrea Rossetti; +Cc: 17768 > - may you please try to play with patch1, and give advice if it could be > acceptable for a commit This patch has been now applied to trunk. Thanks, martin ^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#17768: 2014-06-12 23:57 bug#17768: 24.3; problem with two ruler-mode windows Andrea Rossetti 2014-06-13 7:29 ` martin rudalics @ 2014-06-16 8:45 ` Andrea Rossetti 1 sibling, 0 replies; 13+ messages in thread From: Andrea Rossetti @ 2014-06-16 8:45 UTC (permalink / raw To: 17768-done ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-06-16 21:05 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-06-12 23:57 bug#17768: 24.3; problem with two ruler-mode windows Andrea Rossetti 2014-06-13 7:29 ` martin rudalics 2014-06-14 16:45 ` Eli Zaretskii 2014-06-15 15:09 ` martin rudalics 2014-06-15 16:17 ` Eli Zaretskii 2014-06-16 21:05 ` Stefan Monnier 2014-06-14 17:22 ` Andrea Rossetti 2014-06-15 15:09 ` martin rudalics 2014-06-15 18:06 ` Andrea Rossetti 2014-06-15 23:22 ` Andrea Rossetti 2014-06-16 7:10 ` martin rudalics 2014-06-16 7:10 ` martin rudalics 2014-06-16 8:45 ` bug#17768: Andrea Rossetti
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.